-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feature request/suggestion: libdoc invocation sets special environment variable #4906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you clarify how checking for some environment variable set by Libdoc would be better or easier that just gracefully handling the situation where the environment variables you need during execution don't exist? |
@pekkaklarck you were right. I found an easier solution which works in my case. In the if "libdoc.py" in sys.argv[0]:
return This is a simpler solution. Now I can load my environment in the init but still get the code completion in vscode. |
Not sure how I got here ;-) But, I also regularly get such requests for robotcode that the keywords for some library cannot be loaded correctly or dead processes remain when the library is loaded in robotcode, or ... or ... or ... because people don't know that their library has to be instantiated correctly when creating a libdoc to get the keywords and that the code has to be executed in the constructor of the library. For older RobotFramework versions I always refer to the undocumented check Both properties are not really described anywhere. Wouldn't that be a topic for the UserGuide? |
This is the issue for creating these properties #4666 |
Mentioning these properties in the User Guide is a good idea. That should have been done already as part of #4666. I'm on mobile but try to remember to do that later. If you want to make sure it's not forgotten, please submit an issue. |
@d-biehl thanks for your hint to these |
@pekkaklarck did you allready create an issue about this? if not I can create one. |
@d-biehl I didn't submit an issue so please go ahead and submit one. Even better if you can take a look where to add this information in the User Guide. |
Hello,
I am relatively new to robot framework and stumpled upon a problem while developing a rf library in vscode while using the robot framework lsp extension:
The lsp extension runs
libdoc
while linting/checking the code.In my library code i check for custom environment variables on class object init. These variables are only set on real test exection but of course not while just developing the tests. This results in erros of the extension while developing.
The vscode extension runs libdoc.
As a workaround I suggest that the libdoc robot framework runs sets a special environment variable like
Then my code could first check this environment variable and could skip the rest of the init code to avoid robot framework lsp errors.
Does this solution make sense or is my approach wrong?
Here I described my problem in the lsp repo:
robocorp/robotframework-lsp#988
The text was updated successfully, but these errors were encountered: