diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-06 15:39:25 +0100 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-06 15:39:25 +0100 |
| commit | 9ad098f653748938b202dccccbbad3b767d2cf45 (patch) | |
| tree | d244defb4cfd5de6c4e2ae461b87c0cd8454fbb7 /modules/gdscript/gdscript_editor.cpp | |
| parent | f50f968b8377946d1c64c33bf5128aad0c852971 (diff) | |
| parent | 31749de128e15fa883aaef8d7976bd7c2a2c26f1 (diff) | |
| download | redot-engine-9ad098f653748938b202dccccbbad3b767d2cf45.tar.gz | |
Merge pull request #72276 from dalexeev/gds-rpc-annot
GDScript: Better handling of `@rpc` annotation and autocompletion
Diffstat (limited to 'modules/gdscript/gdscript_editor.cpp')
| -rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 12c10642ec..4e7d278aab 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -800,6 +800,15 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a warning.insert_text = warning.display.quote(p_quote_style); r_result.insert(warning.display, warning); } + } else if (p_annotation->name == SNAME("@rpc")) { + if (p_argument == 0 || p_argument == 1 || p_argument == 2) { + static const char *options[7] = { "call_local", "call_remote", "any_peer", "authority", "reliable", "unreliable", "unreliable_ordered" }; + for (int i = 0; i < 7; i++) { + ScriptLanguage::CodeCompletionOption option(options[i], ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT); + option.insert_text = option.display.quote(p_quote_style); + r_result.insert(option.display, option); + } + } } } |
