Skip to content

Commit

Permalink
fix(langserver): completion in templated test cases should not show k…
Browse files Browse the repository at this point in the history
…eywords and such things
  • Loading branch information
d-biehl committed Jan 10, 2024
1 parent 95f9e66 commit 621c70a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions packages/robot/src/robotcode/robot/utils/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 621c70a

Please sign in to comment.