Skip to content

Commit 692fd06

Browse files
gkorlandCopilot
andcommitted
fix: address review — fix return types, indentation, path normalization
- Fix resolve_symbol return type annotation: Entity -> list[Entity] in abstract and Kotlin implementations to match actual behavior - Fix pyproject.toml indentation for tree-sitter-kotlin dependency - Add path.resolve() in analyze_sources for LSP compatibility - Remove unused exception variable Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 20d093b commit 692fd06

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

api/analyzers/analyzer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def resolve(self, files: dict[Path, File], lsp: SyncLanguageServer, file_path: P
5656
try:
5757
locations = lsp.request_definition(str(file_path), node.start_point.row, node.start_point.column)
5858
return [(files[Path(self.resolve_path(location['absolutePath'], path))], files[Path(self.resolve_path(location['absolutePath'], path))].tree.root_node.descendant_for_point_range(Point(location['range']['start']['line'], location['range']['start']['character']), Point(location['range']['end']['line'], location['range']['end']['character']))) for location in locations if location and Path(self.resolve_path(location['absolutePath'], path)) in files]
59-
except Exception as e:
59+
except Exception:
6060
return []
6161

6262
@abstractmethod
@@ -133,9 +133,9 @@ def add_symbols(self, entity: Entity) -> None:
133133
pass
134134

135135
@abstractmethod
136-
def resolve_symbol(self, files: dict[Path, File], lsp: SyncLanguageServer, file_path: Path, path: Path, key: str, symbol: Node) -> Entity:
136+
def resolve_symbol(self, files: dict[Path, File], lsp: SyncLanguageServer, file_path: Path, path: Path, key: str, symbol: Node) -> list[Entity]:
137137
"""
138-
Resolve a symbol to an entity.
138+
Resolve a symbol to entities.
139139
140140
Args:
141141
lsp (SyncLanguageServer): The language server.
@@ -144,7 +144,7 @@ def resolve_symbol(self, files: dict[Path, File], lsp: SyncLanguageServer, file_
144144
symbol (Node): The symbol node.
145145
146146
Returns:
147-
Entity: The entity.
147+
list[Entity]: The resolved entities.
148148
"""
149149

150150
pass

api/analyzers/kotlin/analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def resolve_method(self, files: dict[Path, File], lsp: SyncLanguageServer, file_
145145
break
146146
return res
147147

148-
def resolve_symbol(self, files: dict[Path, File], lsp: SyncLanguageServer, file_path: Path, path: Path, key: str, symbol: Node) -> Entity:
148+
def resolve_symbol(self, files: dict[Path, File], lsp: SyncLanguageServer, file_path: Path, path: Path, key: str, symbol: Node) -> list[Entity]:
149149
if key in ["implement_interface", "base_class", "parameters", "return_type"]:
150150
return self.resolve_type(files, lsp, file_path, path, symbol)
151151
elif key in ["call"]:

0 commit comments

Comments
 (0)