Merge pull request #81833 from 0x4448/fix-autocomplete-quotes
Fix autocomplete quotes
This commit is contained in:
commit
3e15c8f285
@ -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);
|
return item.to_json(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1429,6 +1429,17 @@ struct CompletionParams : public TextDocumentPositionParams {
|
|||||||
TextDocumentPositionParams::load(p_params);
|
TextDocumentPositionParams::load(p_params);
|
||||||
context.load(p_params["context"]);
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user