mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-17 10:14:45 +00:00
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:
1 parent
7377a84337
commit
d30cdf8474
59 files changed
+1015
-97
No files matched your search
@@ -6,8 +6,10 @@ from serena.symbol import LanguageServerSymbol
|
||||
from solidlsp import SolidLanguageServer
|
||||
from solidlsp.language_servers.al_language_server import ALLanguageServer
|
||||
from solidlsp.ls_config import Language
|
||||
from solidlsp.ls_types import SymbolKind
|
||||
from solidlsp.ls_utils import SymbolUtils
|
||||
from test.conftest import language_tests_enabled
|
||||
from test.solidlsp.conftest import format_symbol_for_assert, has_malformed_name, request_all_symbols
|
||||
|
||||
pytestmark = [pytest.mark.al, pytest.mark.skipif(not language_tests_enabled(Language.AL), reason="AL tests are disabled")]
|
||||
|
||||
@@ -556,3 +558,38 @@ class TestALPathNormalization:
|
||||
f"Hover for {symbol_name} should have injection with mixed paths. Got: {value[:200]}"
|
||||
)
|
||||
break
|
||||
|
||||
@pytest.mark.parametrize("language_server", [Language.AL], 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:
|
||||
is_al_display_symbol = (
|
||||
s["name"].endswith((".Codeunit", ".Page", ".Table", ".TableExt", ".Enum", ".Interface"))
|
||||
or (s["name"].startswith('"') and s["name"].endswith('"'))
|
||||
or s["name"].startswith(
|
||||
(
|
||||
"Enum Name ",
|
||||
"Area ",
|
||||
"Group ",
|
||||
"Field ",
|
||||
"Part ",
|
||||
"SystemPart ",
|
||||
"Repeater ",
|
||||
"ActionRef ",
|
||||
"Key ",
|
||||
"FieldGroup ",
|
||||
)
|
||||
)
|
||||
or ":" in s["name"]
|
||||
)
|
||||
if not is_al_display_symbol and has_malformed_name(
|
||||
s,
|
||||
whitespace_allowed=s["kind"] in {SymbolKind.Class, SymbolKind.Struct, SymbolKind.Interface, SymbolKind.Enum},
|
||||
):
|
||||
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,
|
||||
)
|
||||
Reference in new issue
Block a user