Skip to content

Commit 5ada10a

Browse files
committed
dont report 'variable not found" if variable contains another variable
1 parent e8fb253 commit 5ada10a

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

robotcode/language_server/robotframework/diagnostics/namespace.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,6 @@ async def get_variable_matchers(
841841

842842
return {m: v async for m, v in self.yield_variables(nodes, position)}
843843

844-
_match_extended = re.compile(
845-
r"""
846-
(.+?) # base name (group 1)
847-
([^\s\w].+) # extended part (group 2)
848-
""",
849-
re.UNICODE | re.VERBOSE,
850-
)
851-
852844
@_logger.call
853845
async def find_variable(
854846
self,

robotcode/language_server/robotframework/parts/model_helper.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -440,16 +440,18 @@ async def iter_token(
440440
if is_number(name):
441441
continue
442442
elif return_not_found:
443-
yield strip_variable_token(sub_sub_token), VariableNotFoundDefinition(
444-
sub_sub_token.lineno,
445-
sub_sub_token.col_offset,
446-
sub_sub_token.lineno,
447-
sub_sub_token.end_col_offset,
448-
namespace.source,
449-
name,
450-
sub_sub_token,
451-
)
452-
continue
443+
if contains_variable(sub_token.value[2:-1]):
444+
continue
445+
else:
446+
yield strip_variable_token(sub_sub_token), VariableNotFoundDefinition(
447+
sub_sub_token.lineno,
448+
sub_sub_token.col_offset,
449+
sub_sub_token.lineno,
450+
sub_sub_token.end_col_offset,
451+
namespace.source,
452+
name,
453+
sub_sub_token,
454+
)
453455
if return_not_found:
454456
yield strip_variable_token(sub_token), VariableNotFoundDefinition(
455457
sub_token.lineno,

0 commit comments

Comments
 (0)