@@ -332,6 +332,10 @@ def visit_Var(self, node: Statement) -> None: # noqa: N802
332332 if not is_variable (var_name ):
333333 return
334334
335+ stripped_variable = strip_variable_token (
336+ Token (variable .type , var_name , variable .lineno , variable .col_offset , variable .error )
337+ )
338+
335339 scope = cast (Var , node ).scope
336340 if scope :
337341 scope = scope .upper ()
@@ -347,11 +351,11 @@ def visit_Var(self, node: Statement) -> None: # noqa: N802
347351
348352 var = var_type (
349353 name = var_name ,
350- name_token = strip_variable_token (variable ),
351- line_no = variable .lineno ,
352- col_offset = variable .col_offset ,
353- end_line_no = variable .lineno ,
354- end_col_offset = variable .end_col_offset ,
354+ name_token = strip_variable_token (stripped_variable ),
355+ line_no = stripped_variable .lineno ,
356+ col_offset = stripped_variable .col_offset ,
357+ end_line_no = stripped_variable .lineno ,
358+ end_col_offset = stripped_variable .end_col_offset ,
355359 source = self ._namespace .source ,
356360 )
357361
@@ -361,7 +365,9 @@ def visit_Var(self, node: Statement) -> None: # noqa: N802
361365 else :
362366 existing_var = self ._variables [var .matcher ]
363367
364- location = Location (self ._namespace .document_uri , range_from_token (strip_variable_token (variable )))
368+ location = Location (
369+ self ._namespace .document_uri , range_from_token (strip_variable_token (stripped_variable ))
370+ )
365371 self ._variable_references [existing_var ].add (location )
366372 if existing_var in self ._overridden_variables :
367373 self ._variable_references [self ._overridden_variables [existing_var ]].add (location )
0 commit comments