question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Robotframework-lsp do not find keywords imported relatively

See original GitHub issue

cc. @fabioz @avaissi @orlof

I have xeus-robot and robotframework-lsp installed in my environement. I have a keywords.robot file containing:

*** Settings ***
Library  String

*** Keywords ***
This Is A Dummy KeyWord
    Convert To Lower Case  "HELLO"

And a Notebook running xeus-robot next to it: Screenshot from 2021-03-31 17-16-43

The problem is that it doesn’t find the keywords defined in keywords.robot that is imported relatively.

Although we saw that there was a .virtual_documents directory created, that seem to contain files that were opened from JupyterLab and that are used by jupyterlab-lsp. It seems that once keywords.robot is added to this .virtual_documents directory it works and the keywords are found properly.

I cannot seem to be able to reproduce the issue in Python (having a local python module next to a Notebook), is there something special that python-language-server does?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fabiozcommented, Apr 1, 2021

Now seeing https://github.com/krassowski/jupyterlab-lsp/issues/537, it seems that’s the same request as this…

0reactions
fabiozcommented, Apr 1, 2021

I think the main issue is that you’re seeing the use-case where the .robot is embedded in a notebook (where the notebook is usually standalone and thus the uri in the .virtual_documents may make sense) vs. a case where the user opens a .robot file directly, where the original uri should be kept.

Although even in the case where it’s in a notebook, a concrete file in the .virtual_documents may not really be needed (just keeping the contents in memory and passing the original uri postfixed by .robot may be better as the language server can then search for other – actual .robot files in the filesystem).

It’s then the job of the language server to actually know how to work with partial contents in-memory or in-disk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LSP library search path does not match Robot Framework #266
Robot Framework searches relative library imports based on sys.path as a fallback. LSP only searches relative to the working directory.
Read more >
VSCode new Create Robot Project can't find Python Keywords
Return code: 252 Output: Importing test library 'Library.py' failed: Module 'Library' does not contain 'py'. Try --help for usage information.
Read more >
robotframework-lsp - PyPI
Casing of keywords from libraries used in code-completion can be configured. Go to definition for keywords, variables, resource imports and library imports.
Read more >
RequestsLibrary always shows red in RIDE - Google Groups
Most probable is RIDE not finding the library spec. If you right click (context menu) over the red Library import, there should be...
Read more >
Robotframework dictionary problem for help - Robot Framework
Hi, I am trying to extract keywords from resources into my test case, but it is showing import file not found. hw can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found