Skip to content

[BUG] Using variables from Python files in Robot Framework does not navigate to the correct line #428

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

Open
M-HALLIDAY opened this issue Apr 15, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@M-HALLIDAY
Copy link

Describe the bug
Some variables are defined in a Python file, and the file is imported in the *** Variables *** section of a Robot Framework file. When clicking on a variable in *** Test Cases ***, it does not navigate to the corresponding line in the Python file.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Create a Python variables file, e.g., test.py.
  2. Import the Variables file in the Robot file.
  3. Hover over the variable name—the variable value is displayed.
  4. Press Ctrl + Left Click.
  5. The cursor jumps to the Python file but defaults to the first line instead of the line where the variable is defined.

test.py

# encoding=utf-8

ip="10.1.100.1"
name="centos7"

test.robot

*** Settings ***
Variables         ./test.py 

*** Test Cases ***
00_TEST
    [Setup]
    log    ${ip}
    Log    ${name}

Screenshots/ Videos
step3:Hover over the variable ${ip} —the variable value is displayed.
Image

When clicking on the variable ${ip}, it should navigate to the third line.
Image

Desktop (please complete the following information):

  • VS Code Version 1.99.2
  • RobotCode Version 1.0.3
  • OS: Windows
  • Python Version 3.8.10
  • RobotFramework Version 6.1.1
  • Additional tools like robocop, robotidy
@M-HALLIDAY M-HALLIDAY added the bug Something isn't working label Apr 15, 2025
@d-biehl
Copy link
Member

d-biehl commented Apr 29, 2025

this is not supported yet, i know RFLS can do something like this, but it used his own algorithm to find variables in variable files and not the robot framework algorithm, so it does only support simple variables, but on complex things or dynamic variable files. RobotCode uses Robot Frameworks algorithm to find variables, but unfortunally RobotFramework has no information about where, on which line this variable is defined.

Should we convert this bug in an enhancement request?

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

No branches or pull requests

2 participants