UnifiedSymbolInformation: Set overload_idx only if there are overloads #515

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2025-11-09 22:19:28 +01:00
1 parent 81052f7e9f
commit 55b4a665fd
2 files changed
+8 -4

No files matched your search

+5 -1
View File
@@ -942,11 +942,15 @@ class SolidLanguageServer(ABC):
Converts the given nodes into UnifiedSymbolInformation with proper parent-child relationships,
adding overload indices for symbols with the same name under the same parent.
"""
total_name_counts = defaultdict(lambda: 0)
for node in nodes:
total_name_counts[node["name"]] += 1
name_counts = defaultdict(lambda: 0)
for node in nodes:
flat_all_symbol_list.append(node)
usymbol_node = turn_item_into_symbol_with_children(node)
usymbol_node["overload_idx"] = name_counts[usymbol_node["name"]]
if total_name_counts[usymbol_node["name"]] > 1:
usymbol_node["overload_idx"] = name_counts[usymbol_node["name"]]
name_counts[usymbol_node["name"]] += 1
usymbol_node["parent"] = parent
if usymbol_node["children"]:
+3 -3
View File
@@ -245,9 +245,9 @@ class UnifiedSymbolInformation(TypedDict):
overload_idx: NotRequired[int]
"""
The overload index of the symbol, if applicable. If the symbol is an overloaded function or method
(same symbol name with the same parent), this index indicates which overload it is.
The index is 0-based.
The overload index of the symbol, if applicable. If a symbol does not have overloads, this field is omitted.
If the symbol is an overloaded function or method (same symbol name with the same parent),
this index indicates which overload it is. The index is 0-based.
Added for Serena, not part of the LSP.
"""