mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 10:16:00 +00:00
Fix language server (sometimes) returning absolute paths in relativePath
This commit is contained in:
1 parent
d33b67eec2
commit
ec397617e8
1 file changed
+14
-1
@@ -814,7 +814,20 @@ class LanguageServer:
|
||||
continue
|
||||
|
||||
_, root_nodes = await self.request_document_symbols(item_path, include_body=include_body)
|
||||
|
||||
|
||||
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"])
|
||||
|
||||
fix_relative_path(root_nodes)
|
||||
|
||||
# Create file symbol
|
||||
file_symbol = multilspy_types.UnifiedSymbolInformation( # type: ignore
|
||||
name=os.path.splitext(item)[0],
|
||||
|
||||
Reference in new issue
Block a user