Skip to content

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

Closed as not planned

Description

@M-HALLIDAY

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

Activity

  1. d-biehl commented on Apr 29, 2025

    @d-biehl
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions