LSP: Fix file URI handling + warn about workspace project mismatch

This commit is contained in:
HolonProduction 2025-03-20 10:24:16 +01:00
parent 019ab8745f
commit d55883b4b1
7 changed files with 170 additions and 18 deletions

View file

@ -494,12 +494,14 @@ Array GDScriptTextDocument::find_symbols(const LSP::TextDocumentPositionParams &
if (symbol) {
LSP::Location location;
location.uri = symbol->uri;
location.range = symbol->selectionRange;
const String &path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(symbol->uri);
if (file_checker->file_exists(path)) {
arr.push_back(location.to_json());
if (!location.uri.is_empty()) {
location.range = symbol->selectionRange;
const String &path = GDScriptLanguageProtocol::get_singleton()->get_workspace()->get_file_path(symbol->uri);
if (file_checker->file_exists(path)) {
arr.push_back(location.to_json());
}
r_list.push_back(symbol);
}
r_list.push_back(symbol);
} else if (GDScriptLanguageProtocol::get_singleton()->is_smart_resolve_enabled()) {
List<const LSP::DocumentSymbol *> list;
GDScriptLanguageProtocol::get_singleton()->get_workspace()->resolve_related_symbols(p_location, list);