Merge pull request #59482 from kurtlachmann/lsp_better_parentheses
This commit is contained in:
commit
9839761e24
|
@ -169,6 +169,7 @@ Array GDScriptTextDocument::completion(const Dictionary &p_params) {
|
||||||
lsp::CompletionItem item;
|
lsp::CompletionItem item;
|
||||||
item.label = option.display;
|
item.label = option.display;
|
||||||
item.data = request_data;
|
item.data = request_data;
|
||||||
|
item.insertText = option.insert_text;
|
||||||
|
|
||||||
switch (option.kind) {
|
switch (option.kind) {
|
||||||
case ScriptLanguage::CODE_COMPLETION_KIND_ENUM:
|
case ScriptLanguage::CODE_COMPLETION_KIND_ENUM:
|
||||||
|
@ -278,12 +279,7 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
|
||||||
item.documentation = symbol->render();
|
item.documentation = symbol->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((item.kind == lsp::CompletionItemKind::Method || item.kind == lsp::CompletionItemKind::Function) && !item.label.ends_with("):")) {
|
if (item.kind == lsp::CompletionItemKind::Event) {
|
||||||
item.insertText = item.label + "(";
|
|
||||||
if (symbol && symbol->children.is_empty()) {
|
|
||||||
item.insertText += ")";
|
|
||||||
}
|
|
||||||
} else if (item.kind == lsp::CompletionItemKind::Event) {
|
|
||||||
if (params.context.triggerKind == lsp::CompletionTriggerKind::TriggerCharacter && (params.context.triggerCharacter == "(")) {
|
if (params.context.triggerKind == lsp::CompletionTriggerKind::TriggerCharacter && (params.context.triggerCharacter == "(")) {
|
||||||
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
|
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
|
||||||
item.insertText = item.label.quote(quote_style);
|
item.insertText = item.label.quote(quote_style);
|
||||||
|
|
|
@ -1004,8 +1004,8 @@ struct CompletionItem {
|
||||||
dict["label"] = label;
|
dict["label"] = label;
|
||||||
dict["kind"] = kind;
|
dict["kind"] = kind;
|
||||||
dict["data"] = data;
|
dict["data"] = data;
|
||||||
if (resolved) {
|
|
||||||
dict["insertText"] = insertText;
|
dict["insertText"] = insertText;
|
||||||
|
if (resolved) {
|
||||||
dict["detail"] = detail;
|
dict["detail"] = detail;
|
||||||
dict["documentation"] = documentation.to_json();
|
dict["documentation"] = documentation.to_json();
|
||||||
dict["deprecated"] = deprecated;
|
dict["deprecated"] = deprecated;
|
||||||
|
|
Loading…
Reference in New Issue