robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
186 stars 15 forks source link

[Enhancement] Variables Which Are Compounds of Scalars and Environmental Variables Not Recognized #329

Open GLMeece opened 1 month ago

GLMeece commented 1 month ago

Description

Variables which are composed of both a partial string and an environmental variable are not recognized, even if both variables are populated and accessible to RobotCode. This is documented in the Variables inside variables section in the official guide.

Example

robot.toml

[env]
ENV_ALIAS = "STAGING"

test.robot

*** Variables ***
${TENANT_PROD}      123456
${TENANT_STAGING}   654321

***Test Cases***
We Are In Staging
    Log To Console                 ${TENANT_%{ENV_ALIAS}}
    Should Be Equal As Integers    ${TENANT_%{ENV_ALIAS}}    654321

Playground example Note: Due to limitations of the Playground environment, I could not replicate my inline example directly, but the essence of the correct behavior should be observable.

Steps To Reproduce

  1. Re-create an example as above (either inline code or the Playground example)
  2. Note how RobotCode flags the first portion of the variable name as well as the compounded name as not found.

Error Examples

Variable '${TENANT_}' not found.robotcode.namespace(VariableNotFound)
Variable '${TENANT_%{ENV_ALIAS}}' not found.

Expected behavior

RobotCode should be able to resolve the combination as a singular variable and not flag these components as unfound variables.

Note that Robot Framework understands the compound correctly and the expected combination is evaluated properly.

Desktop