diff --git a/packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py b/packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py index 0e01c157d..599b21c54 100644 --- a/packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py +++ b/packages/language_server/src/robotcode/language_server/robotframework/parts/completion.py @@ -1317,6 +1317,13 @@ def check_in_template() -> bool: ): return True + if any( + template + for template in testcase_node.body + if isinstance(template, Template) and template.get_value(Token.NAME) == "NONE" + ): + return False + if any( file for file in nodes_at_position diff --git a/packages/robot/src/robotcode/robot/utils/ast.py b/packages/robot/src/robotcode/robot/utils/ast.py index 9db884ffb..234036ae0 100644 --- a/packages/robot/src/robotcode/robot/utils/ast.py +++ b/packages/robot/src/robotcode/robot/utils/ast.py @@ -201,11 +201,12 @@ def get_tokens_at_position(node: Statement, position: Position, include_end: boo def iter_nodes_at_position(node: ast.AST, position: Position, include_end: bool = False) -> Iterator[ast.AST]: - return ( - n - for n in iter_nodes(node) - if position.is_in_range(range := range_from_node(n), include_end) or include_end and range.end == position - ) + if position.is_in_range(range_from_node(node), include_end): + yield node + + for n in iter_nodes(node): + if position.is_in_range(range := range_from_node(n), include_end) or include_end and range.end == position: + yield n def get_nodes_at_position(node: ast.AST, position: Position, include_end: bool = False) -> List[ast.AST]: