lte2000 / intellibot

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

Plugin imports wrong file when multiple resource or library files have the same name in different directories #8

Closed awesomeunleashed closed 3 years ago

awesomeunleashed commented 4 years ago

Thanks for working on this plugin, it addresses most of the issues we had in the base plugin.

We have found, however, that when importing a local library or resource file, if there are multiple files named the same in the project (in different folders), the plugin always imports the first one instead of the one specified by the relative path (which robot will import when actually running the tests).

Here is a simple project that demonstrates this behavior. In module2/test.robot in the editor, it can't find the keywords used in the test case, because it is importing module1/keywords.robot and module1/Util.py. However, when the tests are run, robot correctly imports module2/keywords.robot and module2/Util.py.

Any chance this could be addressed? I could look into it myself if you don't have the capacity, but I haven't done any JetBrains plugin development before, so I would need to be pointed to where in the project to look.

lte2000 commented 4 years ago

You can try: Close all files, restart PyCharm. Then if you open module2/tests.robot first, it will import module2/keywords.robot. Howerver, you open module1/test.robot later, it will also import module2/keywords.robot.

That means, if resource/library have same name, the first loaded one will always be used by the plugin.

The issue is caused by that the cache it used is based on the resource/library name only. You can resolve it by improve the function findRobot and findPython in com/millennialmedia/intellibot/psi/ref/RobotFileManager.java Thanks!

lte2000 commented 3 years ago

@awesomeunleashed please try intellibot.zip It now resolve relative library/resource path before cache.

awesomeunleashed commented 3 years ago

@awesomeunleashed please try https://github.com/lte2000/intellibot/raw/c697374f8b00a0f1fd0d25f70c7bb36c9fa78661/intellibot.jar It now resolve relative library/resource path before cache.

I'm not on a team that uses PyCharm or Robot Framework anymore, so unfortunately I can't test it, but I appreciate you working on this! I'll be sure to try it out if I ever start using that stack again.

lte2000 commented 3 years ago

fixed in v0.10.143.398