mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 10:16:00 +00:00
Add checks for 'location' and 'relativePath' in fix_relative_path function
This commit is contained in:
1 parent
e51cb768db
commit
af35f48ac1
1 file changed
+10
-8
@@ -952,14 +952,16 @@ class LanguageServer:
|
||||
# TODO: Not sure if this is actually still needed given recent changes to relative path handling
|
||||
def fix_relative_path(nodes: List[multilspy_types.UnifiedSymbolInformation]):
|
||||
for node in nodes:
|
||||
path = Path(node["location"]["relativePath"])
|
||||
if path.is_absolute():
|
||||
try:
|
||||
path = path.relative_to(self.repository_root_path)
|
||||
node["location"]["relativePath"] = str(path)
|
||||
except:
|
||||
pass
|
||||
fix_relative_path(node["children"])
|
||||
if "location" in node and "relativePath" in node["location"]:
|
||||
path = Path(node["location"]["relativePath"])
|
||||
if path.is_absolute():
|
||||
try:
|
||||
path = path.relative_to(self.repository_root_path)
|
||||
node["location"]["relativePath"] = str(path)
|
||||
except Exception:
|
||||
pass
|
||||
if "children" in node:
|
||||
fix_relative_path(node["children"])
|
||||
|
||||
fix_relative_path(root_nodes)
|
||||
|
||||
|
||||
Reference in new issue
Block a user