Skip to content

Commit 7e74c2d

Browse files
committed
fix(robot): do not override the source on a model if there is already a source field
Newer Robot Framework versions already set the source field on File AST blocks, so overriding it here is unnecessary. fixes #588
1 parent eec1627 commit 7e74c2d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,8 @@ def get_tokens(source: str, data_only: bool = False, lang: Any = None) -> Iterat
319319
else:
320320
model = _get_model(get_tokens, document.uri.to_path(), False, None)
321321

322-
model.source = str(document.uri.to_path())
322+
if not hasattr(model, "source"):
323+
model.source = str(document.uri.to_path())
323324
model.model_type = document_type
324325

325326
return cast(ast.AST, model)

0 commit comments

Comments
 (0)