summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-09-25 17:18:23 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-09-25 17:18:23 +0200
commit3e15c8f28597df4354b40ba85056e87cfac56845 (patch)
treea2a68a24e994085314eea21eed288584889faff4 /modules
parent7a291898588f3b7c52b19808de682781073d21c2 (diff)
parent7ea4247c3d48d1b56d97ebb81949eb2cce2ce6f9 (diff)
downloadredot-engine-3e15c8f28597df4354b40ba85056e87cfac56845.tar.gz
Merge pull request #81833 from 0x4448/fix-autocomplete-quotes
Fix autocomplete quotes
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/language_server/gdscript_text_document.cpp9
-rw-r--r--modules/gdscript/language_server/godot_lsp.h11
2 files changed, 20 insertions, 0 deletions
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp
index 1e927f9f6e..d6779dc71c 100644
--- a/modules/gdscript/language_server/gdscript_text_document.cpp
+++ b/modules/gdscript/language_server/gdscript_text_document.cpp
@@ -346,6 +346,15 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
}
}
+ if (item.kind == lsp::CompletionItemKind::Method) {
+ bool is_trigger_character = params.context.triggerKind == lsp::CompletionTriggerKind::TriggerCharacter;
+ bool is_quote_character = params.context.triggerCharacter == "\"" || params.context.triggerCharacter == "'";
+
+ if (is_trigger_character && is_quote_character && item.insertText.is_quoted()) {
+ item.insertText = item.insertText.unquote();
+ }
+ }
+
return item.to_json(true);
}
diff --git a/modules/gdscript/language_server/godot_lsp.h b/modules/gdscript/language_server/godot_lsp.h
index 1ac4267c7b..e09adb74bd 100644
--- a/modules/gdscript/language_server/godot_lsp.h
+++ b/modules/gdscript/language_server/godot_lsp.h
@@ -1429,6 +1429,17 @@ struct CompletionParams : public TextDocumentPositionParams {
TextDocumentPositionParams::load(p_params);
context.load(p_params["context"]);
}
+
+ Dictionary to_json() {
+ Dictionary ctx;
+ ctx["triggerCharacter"] = context.triggerCharacter;
+ ctx["triggerKind"] = context.triggerKind;
+
+ Dictionary dict;
+ dict = TextDocumentPositionParams::to_json();
+ dict["context"] = ctx;
+ return dict;
+ }
};
/**