Merge pull request #118979 from HolonProduction/lsp/annoation-identifier-crash

LSP: Fix crash in `find_usages_in_file` by correctly resolving annotation names
This commit is contained in:
Thaddeus Crews
2026-05-04 12:40:41 -05:00
7 changed files with 126 additions and 54 deletions
@@ -629,12 +629,12 @@ void GDScriptLanguageProtocol::resolve_related_symbols(const LSP::TextDocumentPo
return;
}
String symbol_identifier;
String symbol_name;
LSP::Range range;
symbol_identifier = parser->get_identifier_under_position(p_doc_pos.position, range);
symbol_name = parser->get_symbol_name_under_position(p_doc_pos.position, range);
for (const KeyValue<StringName, ClassMembers> &E : workspace->native_members) {
if (const LSP::DocumentSymbol *const *symbol = E.value.getptr(symbol_identifier)) {
if (const LSP::DocumentSymbol *const *symbol = E.value.getptr(symbol_name)) {
r_list.push_back(*symbol);
}
}
@@ -642,13 +642,13 @@ void GDScriptLanguageProtocol::resolve_related_symbols(const LSP::TextDocumentPo
for (const KeyValue<String, ExtendGDScriptParser *> &E : client->parse_results) {
const ExtendGDScriptParser *scr = E.value;
const ClassMembers &members = scr->get_members();
if (const LSP::DocumentSymbol *const *symbol = members.getptr(symbol_identifier)) {
if (const LSP::DocumentSymbol *const *symbol = members.getptr(symbol_name)) {
r_list.push_back(*symbol);
}
for (const KeyValue<String, ClassMembers> &F : scr->get_inner_classes()) {
const ClassMembers *inner_class = &F.value;
if (const LSP::DocumentSymbol *const *symbol = inner_class->getptr(symbol_identifier)) {
if (const LSP::DocumentSymbol *const *symbol = inner_class->getptr(symbol_name)) {
r_list.push_back(*symbol);
}
}