diff --git a/test/solidlsp/dart/test_dart_basic.py b/test/solidlsp/dart/test_dart_basic.py index 450f99c4..cdd98a97 100644 --- a/test/solidlsp/dart/test_dart_basic.py +++ b/test/solidlsp/dart/test_dart_basic.py @@ -3,6 +3,7 @@ from pathlib import Path import pytest +from serena.util.text_utils import find_text_coordinates from solidlsp import SolidLanguageServer from solidlsp.ls_config import Language from solidlsp.ls_types import SymbolKind @@ -243,8 +244,12 @@ class TestDartLanguageServer: def test_request_defining_symbol_variable(self, language_server: SolidLanguageServer) -> None: """Test request_defining_symbol for a variable usage.""" file_path = os.path.join("lib", "main.dart") - # Line 14 contains 'final result = a + b;' - test position on 'result' - defining_symbol = language_server.request_defining_symbol(file_path, 13, 10) + + # Find coordinates of 'final result = a + b;' - test position on 'result' + with language_server.open_file(file_path, open_in_ls=False) as f: + pos = find_text_coordinates(f.contents, r"final (result) = a \+ b;") + + defining_symbol = language_server.request_defining_symbol(file_path, pos.line, pos.col) # The defining symbol might be the variable itself or the containing method # This is acceptable behavior - different language servers handle this differently