lte2000 / intellibot

IntelliJ/PyCharm plugin for Robot Automation Framework
https://github.com/lte2000/intellibot
MIT License
91 stars 26 forks source link

Does not find variables and resources on PYTHONPATH / folders marked as "Sources" #30

Closed a-w closed 2 years ago

a-w commented 2 years ago

When running, robotframework will find variables and resources files whose path is given relative to a component in PYTHONPATH.

This used to be supported by intellibot being able to find files in paths relative to any folder marked as "Sources" in the project structure, but does not work anymore with this version of the plugin (as of 0.10.143.397). Currently, it is necessary to provide a path relative to the referring file to find a variable or a resource file.

It should also work again for paths relative to any folder marked as "Sources", please.

a-w commented 2 years ago

git bisect says: 26152497501249da591a86b96f00d4fc182fd41b is the first bad commit (tagged dev_0.10.143.383)

lte2000 commented 2 years ago

can you give an example?

lte2000 commented 2 years ago

@a-w please try intellibot.zip

It resolve relative library/resource path according to current file first. If not found, it resolve the path relative to project "content root".

I ever try to resolve relative path in whole project in any directory, but it may result too many unwanted founds. So I restrict it to "relative to project content root".

lte2000 commented 2 years ago

fixed in v0.10.143.398

a-w commented 2 years ago

can you give an example?

Please find an example here

The issue still persists with release IntelliBot #patched 0.10.143.398

I ever try to resolve relative path in whole project in any directory, but it may result too many unwanted founds. So I restrict it to "relative to project content root".

I am not asking for "any directory". Im asking only that all directories which contribute to PYTHONPATH at runtime be used as bases for relative path evaluation in the plugin.

Rationale: by default, both content roots and source roots are used to populate PYTHONPATH at runtime, and that's what Robotframework uses to resolve relative paths. So, when RF is able to resolve a path, then the plugin should be able to resolve that same path too.

That used to work until dev_0.10.143.382 (and also in the original version from Millennial Media). The request is to restore the original search algorithm, as the behavior since dev_0.10.143.383 breaks many existing scripts (around 1k in my case).

If you think that limiting the search scope is necessary, you could provide options to select whether content and/or source roots should be used to resolve paths, but IMHO it is not a major performance concern to leave both on at all times. Usually, projects don't have that many source roots...

lte2000 commented 2 years ago

@a-w please try this one, search order of relative physical resource/library path: robot file, project source root, project content root intellibot.zip

original version from Millennial Media it not suitable if you have multiple resource files having same name in different directory. Current method improve this though in some situation it still match wrong file.

tryb93 commented 2 years ago

I have the same problem.

lte2000 commented 2 years ago

I have the same problem.

@tryb93 do you still have the problem with https://github.com/lte2000/intellibot/files/7080761/intellibot.zip

lte2000 commented 2 years ago

search order of relative physical resource/library path:

Implemented in version 0.11.191.8026