mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 22:14:54 +00:00
Fix health check incorrectly checking symbol kind against int instead of SymbolKind.name
This commit is contained in:
1 parent
63377658d7
commit
2139552b0f
2 files changed
+11
-6
No files matched your search
+2
-3
@@ -39,6 +39,7 @@ from serena.tools import FindReferencingSymbolsTool, FindSymbolTool, GetSymbolsO
|
||||
from serena.util.dataclass import get_dataclass_default
|
||||
from serena.util.logging import MemoryLogHandler
|
||||
from solidlsp.ls_config import Language
|
||||
from solidlsp.ls_types import SymbolKind
|
||||
from solidlsp.util.subprocess_util import subprocess_kwargs
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -808,9 +809,7 @@ class ProjectCommands(AutoRegisteringGroup):
|
||||
return
|
||||
|
||||
# Extract suitable symbol (prefer class or function over variables)
|
||||
# LSP symbol kinds: 5=class, 12=function, 6=method, 9=constructor
|
||||
preferred_kinds = [5, 12, 6, 9] # class, function, method, constructor
|
||||
|
||||
preferred_kinds = {SymbolKind.Class.name, SymbolKind.Function.name, SymbolKind.Method.name, SymbolKind.Constructor.name}
|
||||
selected_symbol = None
|
||||
for symbol in overview_data:
|
||||
if symbol.get("kind") in preferred_kinds:
|
||||
|
||||
@@ -212,14 +212,17 @@ class LanguageServerSymbol(Symbol, ToStringMixin):
|
||||
return []
|
||||
|
||||
def _tostring_additional_entries(self) -> dict[str, Any]:
|
||||
return dict(name=self.name, kind=self.kind, num_children=len(self.symbol_root["children"]))
|
||||
return dict(name=self.name, kind=self.symbol_kind_name, num_children=len(self.symbol_root["children"]))
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self.symbol_root["name"]
|
||||
|
||||
@property
|
||||
def kind(self) -> str:
|
||||
def symbol_kind_name(self) -> str:
|
||||
"""
|
||||
:return: string representation of the symbol kind (name attribute of the `SymbolKind` enum item)
|
||||
"""
|
||||
return SymbolKind(self.symbol_kind).name
|
||||
|
||||
@property
|
||||
@@ -403,6 +406,9 @@ class LanguageServerSymbol(Symbol, ToStringMixin):
|
||||
body_location: NotRequired[dict[str, Any]]
|
||||
body: NotRequired[str | None]
|
||||
kind: NotRequired[str]
|
||||
"""
|
||||
string representation of the symbol kind (name attribute of the `SymbolKind` enum item)
|
||||
"""
|
||||
children: NotRequired[list["LanguageServerSymbol.OutputDict"]]
|
||||
|
||||
OutputDictKey = Literal["name", "name_path", "relative_path", "location", "body_location", "body", "kind", "children"]
|
||||
@@ -450,7 +456,7 @@ class LanguageServerSymbol(Symbol, ToStringMixin):
|
||||
result["name"] = self.name
|
||||
|
||||
if kind:
|
||||
result["kind"] = self.kind
|
||||
result["kind"] = self.symbol_kind_name
|
||||
|
||||
if location:
|
||||
result["location"] = self.location.to_dict(include_relative_path=relative_path)
|
||||
|
||||
Reference in new issue
Block a user