mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 06:15:43 +00:00
Remove startswith() workaround from SymbolUtils
Now that C# language server normalizes symbol names at the source, the utility function can use simple exact matching. This is cleaner and follows the principle of fixing root causes rather than patching callsites. All 24 C# tests still pass.
This commit is contained in:
1 parent
611acebe67
commit
c59dee87eb
1 file changed
+1
-5
@@ -416,13 +416,9 @@ class SymbolUtils:
|
||||
def symbol_tree_contains_name(roots: list[UnifiedSymbolInformation], name: str) -> bool:
|
||||
"""
|
||||
Check if any symbol in the tree has a name matching the given name.
|
||||
Supports both old format (exact match) and new Roslyn format with type annotations
|
||||
(e.g., "Add(int, int) : int" matches "Add").
|
||||
"""
|
||||
for symbol in roots:
|
||||
symbol_name = symbol["name"]
|
||||
# Check for exact match (old format) or prefix match (new format with type annotations)
|
||||
if symbol_name == name or symbol_name.startswith((name + "(", name + " :")):
|
||||
if symbol["name"] == name:
|
||||
return True
|
||||
if SymbolUtils.symbol_tree_contains_name(symbol["children"], name):
|
||||
return True
|
||||
|
||||
Reference in new issue
Block a user