robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
176 stars 14 forks source link

[ENHANCEMENT] Navigate from python file to robot file #303

Open nicolasbillamboz-flowbird opened 3 weeks ago

nicolasbillamboz-flowbird commented 3 weeks ago

When I use "Find All References" from a function implemented in a python file, the usages in robot files are not found. Is this feature implemented? If so, is there something to configure? If not, could this feature be implemented?

Note: I'm able to navigate from robot file to python file with "Go to Definition"

d-biehl commented 3 weeks ago

No this is not possible, because the RobotCode language server only knows robot files and if you import a library into a robot file, robot framework only get line numbers from python.

The trick here is, instead going to the python function/method and try to find all references from here, you can also use "Find All References" from a keyword call in a robot/resource file and you will get all location where this keyword is used in robot/resource files

nicolasbillamboz-flowbird commented 3 weeks ago

Thx for the quick reply. I know that I can still workaround this by using search tool, or going to a usage in a robot file and using "Find All References", but this is still a bit frustrating. Is there any chance to see this feature implemented? Is it conceivable that the language server listens to python files only for this purpose?

d-biehl commented 3 weeks ago

Listen also for Python files is easy, but finding the exact position of a declaration can be tricky since the RobotFramework Libdoc tool, which RobotCode uses internally, only provides the start line numbers of the methods/functions in the Python file. Additionally, there are dynamic libraries like remote libraries that do not provide a line number and so on.

I have changed this issue to an enhancement so that we don’t forget about it and can take a closer look at it later.