Configuration in VS code

Hello, I’m using LSP in VS Code.
For robot files I use a path-variable-file for my pathes to directories.

*** Settings ***
Resource ${RESOURCES_DIR}/common.resource

*** Test Cases ***
Test Name
Common Keyword (KW from common.resource)

this implementation raises the following problem:
“undefinded keyword”

When I use “…/…/resources/common.resource” in Setting, I have no error.
How can i configure the lsp (robotframework-lsp/ at robotframework-lsp-0.8.0 · robocorp/robotframework-lsp · GitHub) to use the variables in my development? Is it possible?

Hi @jens. Good question and welcome to the forum :+1:

You can define directories which can contain libraries or resources with PYTHONPATH setting in the robot.yaml

  - .
  - resources

And then you can just

*** Settings ***
Resource          my.resource

hello @mika , thanks for your answer.

when i start robot with “robot -V robot.yaml test.robot” I got an error. The resource file is not found.
while developing I have still the problem with the lsp “undefinded keyword” error.

I start my the tests with the following command:
“robot -V test.robot”

content of looks like this:
RESOURCES_DIR =… /… / resources

If I define it in my framework then I always have an error with LSP that the keyword is not found. I would like to fix that. I am using python.

Greetings, Jens

You should be running the robot with rcc and not directly with python. You are not using benefits of us setting up the environment and running when you run it like that.

My settings basically work only if you are running with rcc. For pure Python execution you need to handle pythonpaths yourself also.