Skip to content
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

Resource imports with Builtin Operating System variables are marked as errors #599

Closed
weltings opened this issue Mar 11, 2022 · 2 comments
Closed
Labels
bug Something isn't working robotframework-ls

Comments

@weltings
Copy link
Contributor

Describe the bug
Resources with built-in path variables do tnot get resolved

To Reproduce
Create the following files:
C:\Temp\example\foobar.robot
C:\Temp\example\foobar.resource
C:\Temp\example\foobar.py

The contents of foobar.robot should be:
*** Settings ***
Resource ${EXECDIR}\foobar.resource
Resource ${CURDIR}\foobar.resource
Resource C:\Temp\example\foobar.resource
Library ${EXECDIR}\foobar.py
Library ${CURDIR}\foobar.py
Library C:\Temp\example\foobar.py

Expected behavior
Note that all 3 Library references get resolved correctly.
However the Resources with ${EXECDIR} and ${CURDIR} do not get resolved and are marked as error with red underline.
I would expect all resources to be resolved correctly.

Screenshots
image

Versions:

  • OS: Windows 10
  • Robot Framework Version: 4.0
  • Robot Framework Language Server Version: PreRelease
  • Client Version: VSCode 1.65.1
@weltings weltings added bug Something isn't working robocorp-code labels Mar 11, 2022
@weltings
Copy link
Contributor Author

Maybe I can look into this. If you can show me the code parts that need to be changed. It seems to work for Library imports but not Resource imports. Can you point out the code for each one?

@fabioz
Copy link
Collaborator

fabioz commented Mar 11, 2022

Well, ${EXECDIR} is really expected not to be defined because it depends on your current working directory when you execute (which can't be known prior to execution).

See: #263 (comment) for how to define it to be used in the language server.

${CURDIR} should work though (as it resolves to the directory where the robot file is defined and is supported).

Please reopen if you're able to have a working example where ${CURDIR} doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working robotframework-ls
Projects
None yet
Development

No branches or pull requests

2 participants