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

When robot LSP initialises Libraries for Libdoc generation, it passes in variable names instead of values #634

Closed
Serhiy1 opened this issue Apr 1, 2022 · 2 comments
Labels
bug Something isn't working robotframework-ls

Comments

@Serhiy1
Copy link

Serhiy1 commented Apr 1, 2022

Describe the bug
When robot LSP initialises a Library with arguments, it passes in the variable names as arguments instead of their values

To Reproduce

Example library

from robot.api.deco import library

@library(scope="SUITE", auto_keywords=True)
class example:

    def __init__(self, arg_1: str, arg_2: str, arg_3: str):
        raise ValueError(f"arg_1 {arg_1}, arg_2 {arg_2}, arg_2 {arg_2}")

Example usage

*** Settings ***
Library    example.py    ${ARG_1}    ${ARG_2}    ${ARG_3}


*** Variables ***
${ARG_1}=    foo
${ARG_2}=    bar
${ARG_3}=    baz

Error message showing that the variable names get passed in

Unresolved library: example.py.
Error generating libspec:
Initializing library 'example' with arguments [ ${ARG_1} | ${ARG_2} | ${ARG_3} ] failed: ValueError: arg_1 ${ARG_1}, arg_2 ${ARG_2} arg_2 ${ARG_2},

Error message when the variables in the robot file are replaced with string literals

Unresolved library: example.py.
Error generating libspec:
Initializing library 'example' with arguments [ foo | bar | baz ] failed: ValueError: arg_1 foo, arg_2 bar, arg_2 bar

Expected behavior
LSP should pass in the Values of the variables instead of the names

@Serhiy1 Serhiy1 added bug Something isn't working robotframework-ls labels Apr 1, 2022
@Serhiy1 Serhiy1 changed the title When robot LSP initialises Libraries, it passes in variable names instead of values When robot LSP initialises Libraries for Libdoc generation, it passes in variable names instead of values Apr 1, 2022
@fabioz fabioz closed this as completed in bcbf98b Apr 5, 2022
@fabioz
Copy link
Collaborator

fabioz commented Apr 6, 2022

This should be fixed in the 0.43.5 pre-release (please test it -- if everything is ok a new stable release should be done -- hopefully tomorrow).

@Serhiy1
Copy link
Author

Serhiy1 commented Apr 7, 2022

@fabioz I can verify that the Libraries that got variables as arguments are now working correctly for me in the pre-release

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