Skip to content

Commit b8f25cc

Browse files
committed
correct find keyword references
1 parent 863ec5c commit b8f25cc

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

robotcode/language_server/robotframework/parts/references.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,7 @@ async def _find_keyword_references_in_namespace(
321321
self, namespace: Namespace, kw_doc: KeywordDoc, cancel_token: CancelationToken
322322
) -> List[Location]:
323323
from robot.parsing.lexer.tokens import Token as RobotToken
324-
from robot.parsing.model.statements import (
325-
Fixture,
326-
KeywordCall,
327-
Template,
328-
TestTemplate,
329-
)
324+
from robot.parsing.model.statements import Fixture, KeywordCall
330325

331326
result: List[Location] = []
332327

@@ -339,15 +334,19 @@ async def _find_keyword_references_in_namespace(
339334
if isinstance(node, KeywordCall):
340335
kw_token = node.get_token(RobotToken.KEYWORD)
341336
arguments = list(node.get_tokens(RobotToken.ARGUMENT) or [])
337+
338+
async for location in self.get_keyword_references_from_tokens(
339+
namespace, kw_doc, node, kw_token, arguments
340+
):
341+
result.append(location)
342342
elif isinstance(node, Fixture):
343343
kw_token = node.get_token(RobotToken.NAME)
344344
arguments = list(node.get_tokens(RobotToken.ARGUMENT) or [])
345-
elif isinstance(node, (Template, TestTemplate)):
346-
kw_token = node.get_token(RobotToken.NAME)
347-
arguments = list(node.get_tokens(RobotToken.ARGUMENT) or [])
348345

349-
async for location in self.get_keyword_references_from_tokens(namespace, kw_doc, node, kw_token, arguments):
350-
result.append(location)
346+
async for location in self.get_keyword_references_from_tokens(
347+
namespace, kw_doc, node, kw_token, arguments
348+
):
349+
result.append(location)
351350

352351
return result
353352

@@ -398,7 +397,7 @@ async def get_keyword_references_from_any_run_keyword(
398397
arguments: List[Token],
399398
) -> AsyncGenerator[Location, None]:
400399

401-
if kw_token is None or is_not_variable_token(kw_token):
400+
if kw_token is None or not is_not_variable_token(kw_token):
402401
return
403402

404403
kw = await namespace.find_keyword(str(kw_token.value))

0 commit comments

Comments
 (0)