mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 22:17:35 +00:00
Fix coordinates in TestDartLanguageServer.test_request_defining_symbol_variable
This commit is contained in:
1 parent
971941d5c6
commit
28bf726f53
1 file changed
+7
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user