Skip to content

Commit c34455f

Browse files
committed
fix(analyzer): do not report embedded arguments as VariableNotFound in template keywords
When a test case uses [Template] or Test Template with a keyword that has embedded arguments (e.g. "The result of ${calculation} should be ${expected}"), the embedded argument placeholders were incorrectly analyzed as unresolved variables, producing false VariableNotFound diagnostics. Skip variable analysis for embedded argument tokens when the keyword call originates from a template declaration. Fixes #542
1 parent dad536e commit c34455f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/robot/src/robotcode/robot/diagnostics/namespace_analyzer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ def _analyze_keyword_call(
691691
allow_variables: bool = False,
692692
ignore_errors_if_contains_variables: bool = False,
693693
unescape_keyword: bool = True,
694+
is_template: bool = False,
694695
) -> Optional[KeywordDoc]:
695696
result: Optional[KeywordDoc] = None
696697

@@ -776,7 +777,7 @@ def _analyze_keyword_call(
776777
else:
777778
self._keyword_references[result].add(Location(self._document_uri, kw_range))
778779

779-
if result.is_embedded:
780+
if result.is_embedded and not is_template:
780781
self._analyze_token_variables(keyword_token)
781782

782783
if result.errors:
@@ -1099,6 +1100,7 @@ def visit_TestTemplate(self, node: TestTemplate) -> None: # noqa: N802
10991100
[],
11001101
analyze_run_keywords=False,
11011102
allow_variables=True,
1103+
is_template=True,
11021104
)
11031105

11041106
self._test_template = node
@@ -1116,6 +1118,7 @@ def visit_Template(self, node: Template) -> None: # noqa: N802
11161118
[],
11171119
analyze_run_keywords=False,
11181120
allow_variables=True,
1121+
is_template=True,
11191122
)
11201123
self._template = node
11211124

0 commit comments

Comments
 (0)