Merge pull request #114186 from voylin/language_server_highlight_support
Add highlight support to Language Server for external editors
This commit is contained in:
commit
8d2c8b5433
4 changed files with 44 additions and 1 deletions
|
|
@ -150,6 +150,25 @@ Array GDScriptTextDocument::documentSymbol(const Dictionary &p_params) {
|
|||
return arr;
|
||||
}
|
||||
|
||||
Array GDScriptTextDocument::documentHighlight(const Dictionary &p_params) {
|
||||
Array arr;
|
||||
LSP::TextDocumentPositionParams params;
|
||||
params.load(p_params);
|
||||
|
||||
const LSP::DocumentSymbol *symbol = GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_symbol(params);
|
||||
if (symbol) {
|
||||
String path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(params.textDocument.uri);
|
||||
Vector<LSP::Location> usages = GDScriptLanguageProtocol::get_singleton()->get_workspace()->find_usages_in_file(*symbol, path);
|
||||
|
||||
for (const LSP::Location &usage : usages) {
|
||||
LSP::DocumentHighlight highlight;
|
||||
highlight.range = usage.range;
|
||||
arr.push_back(highlight.to_json());
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
Array GDScriptTextDocument::completion(const Dictionary &p_params) {
|
||||
Array arr;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue