Fix symbol name resolution in selected LS (#1247)

Adds tests for name resolution for each language and fixes the name resolution where tests have failed.

Also:

Extends python tests to cover ty
Extends skipping conditions for several LS (but only when not in CI)
Better test output in CI
Removed a wrong python test (started failing for ty and should have failed for pyright too)
This commit is contained in:
Michael Panchenko authored and GitHub committed 2026-04-01 16:29:00 +02:00
1 parent 7377a84337
commit d30cdf8474
59 files changed
+1015 -97

No files matched your search

@@ -9,6 +9,8 @@ import pytest
from solidlsp import SolidLanguageServer
from solidlsp.ls_config import Language
from solidlsp.ls_utils import SymbolUtils
from test.solidlsp.conftest import format_symbol_for_assert, has_malformed_name, request_all_symbols
@pytest.mark.powershell
@@ -130,6 +132,14 @@ class TestPowerShellLanguageServerBasics:
assert len(main_functions) >= 3, f"Should find at least 3 functions in main.ps1, found {len(main_functions)}"
assert len(utils_functions) >= 8, f"Should find at least 8 functions in utils.ps1, found {len(utils_functions)}"
@pytest.mark.parametrize("language_server", [Language.POWERSHELL], indirect=True)
def test_powershell_class_method_symbols_use_bare_method_name(self, language_server: SolidLanguageServer) -> None:
"""Test whether PSES already reports class methods with bare names."""
symbols = language_server.request_full_symbol_tree(within_relative_path="main.ps1")
assert SymbolUtils.symbol_tree_contains_name(symbols, "PersonFormatter"), "Should find PersonFormatter class in symbol tree"
assert SymbolUtils.symbol_tree_contains_name(symbols, "FormatName"), "Expected PowerShell method to be exposed with bare name"
@pytest.mark.parametrize("language_server", [Language.POWERSHELL], indirect=True)
def test_powershell_find_references_within_file(self, language_server: SolidLanguageServer) -> None:
"""Test finding references to a function within the same file."""
@@ -172,3 +182,16 @@ class TestPowerShellLanguageServerBasics:
assert any("utils.ps1" in loc.get("uri", "") for loc in definition_locations), (
f"Should find definition in utils.ps1, got {definition_locations}"
)
@pytest.mark.parametrize("language_server", [Language.POWERSHELL], indirect=True)
def test_bare_symbol_names(self, language_server) -> None:
all_symbols = request_all_symbols(language_server)
malformed_symbols = []
for s in all_symbols:
if has_malformed_name(s, colon_allowed=s["name"].startswith("$")):
malformed_symbols.append(s)
if malformed_symbols:
pytest.fail(
f"Found malformed symbols: {[format_symbol_for_assert(sym) for sym in malformed_symbols]}",
pytrace=False,
)