Skip to content

Commit 433278c

Browse files
committed
[FIX] server: fix character index on Hover and Definition features.
Character index was 1 ahead of parso indexation and the server was then crashing if the user hover the last character of a file
1 parent a265da4 commit 433278c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/features/parso_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def get_symbols(fileSymbol, parsoTree,line, character):
1111
"return the Symbols at the given position in a file, the range of the selected symbol and the context"
1212
range = None
1313
scope_symbol = fileSymbol.get_scope_symbol(line)
14-
element = parsoTree.get_leaf_for_position((line, character), include_prefixes=True)
14+
element = parsoTree.get_leaf_for_position((line, character-1), include_prefixes=True)
1515
range = Range(
1616
start=Position(line=element.start_pos[0]-1, character=element.start_pos[1]),
1717
end=Position(line=element.end_pos[0]-1, character=element.end_pos[1])

0 commit comments

Comments
 (0)