robotframework-lsp icon indicating copy to clipboard operation
robotframework-lsp copied to clipboard

Multiple Keyword Matching Error but only one keyword defined

Open lucieb31 opened this issue 2 years ago • 2 comments

Hello,

I have project with keywords defined in file outside on the test. So the tree structure is like this for example :

actuators

ntp.robot journalctl.py utils.py ...

tests

mytest.robot

Inside "journalctl" I have keywords that I call inside mytest.robot, the same for utils.py. The keywords from journalctl are in error : image But the keywords are defined only once. And when I went through the keyword, vscode finds one in actuators and one in \actuators : image I don't know where this is defined and why for this file and not for the others.

Thanks Lucie

Versions:

  • OS: Windows 10
  • Robot Framework Version: 6.1
  • Robot Framework Language Server Version: 1.11.0
  • Client Version:VSCode 1.82.2

lucieb31 avatar Sep 20 '23 14:09 lucieb31

@lucieb31 seems like we found the same bug https://github.com/robocorp/robotframework-lsp/issues/983

JonathanRoth13 avatar Sep 21 '23 15:09 JonathanRoth13

I think I hit the same problem, and I think I'm one step closer to the root cause: I have a variable {"robot": "variables": {"ROOT": "/home/user/test/"}} passed via the workspace/didChangeConfiguration Later I refer to this variable in the robot file: Resource ${ROOT}/resources/my_lib.robot Note: If you resolve the path, there is a duplicate slash in the path

A keyword "My Keyword" is defined in the my_lib.robot. If the resource is included more than once (can be included indirectly) robot LSP marks this as duplicate. This is most probably a path sanitation issue, as the keyword now can be resolved twice. There is a duplicate _KeyworFoundFromAst object with similar, but not the same source (/home/user/test//resources/my_lib.robot != /home/user/test/resources/my_lib.robot)

A reproducer is attached. test.tar.gz

matthew11 avatar Jun 25 '24 08:06 matthew11