Coder Social home page Coder Social logo

Comments (9)

sparkymartin avatar sparkymartin commented on July 26, 2024 1

I went ahead and created a pull request with the changes we made to support the built-in ${EXECDIR} variable in Resource and Library path references.

With this fix, instead of having to use messy relative paths like this:

Library ../../../Path/To/File/MyLibrary.py
Resource ../../../Path/To/File/MyResource.robot

You can use absolute paths with the ${EXECDIR} variable referencing the root of your project like this:

Library ${EXECDIR}/Path/To/File/MyLibrary.py
Resource ${EXECDIR}/Path/To/File/MyResource.robot

And still be able to resolve the keyword names and navigate between keywords in the IDE using the usual Ctrl+B or Command+B.

from intellibot.

lte2000 avatar lte2000 commented on July 26, 2024 1

@sparkymartin , I'm not working on it. You're the contributor :)

Indeed, our projects also use variable in library path (please see the screenshot below):

image

We are using the method of "Strip Variable in library path" I described in previous comment (that's why I develop such feature), it works very well.

from intellibot.

lte2000 avatar lte2000 commented on July 26, 2024

${EXECDIR}: An absolute path to the directory where test execution was started from.

This is a running time variable. You can start execution from any directory. So can't know the value during static parse.

For work around, you can create a fake directory named "EXECDIR" in Pycharm project, put or link Settings.robot in it. Or you may link the directory "EXECDIR" directly. Or change your directory hierarchy, e.g, change from /home/tester/repo/ to /home/tester/EXECDIR/repo/

Then in Pycharm, menu, File | Settings | Languages & Frameworks | Robot Options, Check "Strip Variable in library path (${name}/ to be name/)".

After that, when it see "${EXECDIR}/Settings.robot", it will search "EXECDIR/Settings.robot".

from intellibot.

sparkymartin avatar sparkymartin commented on July 26, 2024

I have a forked version of the original intellibot plugin that solves this exact issue (and is the only reason we created our own version to begin with). I would be happy to share how we solved it if you like. I would much rather this be fixed in your version of the plugin so I can stop maintaining my own. The only files we changed to implement this functionality are RobotFileManager.java and RobotPythonReferenceSearch.java.

from intellibot.

lte2000 avatar lte2000 commented on July 26, 2024

@sparkymartin Thanks for the code sharing.
I see you replace ${EXECDIR} to project.getBasePath(). I believe this works well in your environment.
But I checked several projects in our organization. Some ${EXECDIR} are users's home directory, other ${EXECDIR} are Jenkins's workspace, none of them set to project.getBasePath().

So I suggest could your add a field in Settings | Languages & Frameworks | Robot Options to let user input what's value of ${EXECDIR}. And add a flag in same page to enable/disable this feature.
Thanks!

from intellibot.

sparkymartin avatar sparkymartin commented on July 26, 2024

Good point @lte2000. This code was actually written by a previous intern and employee who are no longer with my team. The environment that they used to build and test this is no longer available. Is this something that you would be able to add to the code? I just simply wanted to share how we solved it, but if there is fine tuning to be made to make it a more widely acceptable solution, I am fine with whatever tweaks need to be made to make it usable by anyone. I am just not in a position to easily make further changes.

from intellibot.

sparkymartin avatar sparkymartin commented on July 26, 2024

@lte2000, is adding the setting to the Robot Options page something that you or another contributor can do?

from intellibot.

lte2000 avatar lte2000 commented on July 26, 2024

now, you can provide the value for any variable yourself in Robot Option.
For example, input:
${EXECDIR}=/path/to/execution
${ANYVAR}=/path/to/VAR
Then
Library ${EXECDIR}/aa/bb/${ANYVAR}/lib.py
will be
Library /path/to/execution/aa/bb/path/to/VAR/lib.py

Note: it just do simple string replacement, no any other function.

Please try dev_0.10.143.397 from https://github.com/lte2000/intellibot

from intellibot.

lte2000 avatar lte2000 commented on July 26, 2024

please install "intellibot #patched" v0.10.143.397 from jetbrain marketplace, which can define value the ${EXECDIR} so can resolve the import path.

from intellibot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.