-
-
Notifications
You must be signed in to change notification settings - Fork 21
[BUG] Global variable not found #390
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
Comments
This is the same topic, but it seems that it's a frequent problem. I don't think that static analyzers in other languages have the same behavior for global vars. |
By the way the global variables from Robot Framework are parsed without errors, why? |
That is an interesting question. I don't think they are treated as global variables, they are presented as “automatic” variables. And I guess the decision was to add them for autocompletion, but there is no real check of their availability. In some cases (see availability column) these variables are actually not there, for instance Note that this case is a simple one, when the availability is "Everywhere" then there is no issue either. But for other availability like "Test Case", "Test Teardown", "Suite Teardown" and "User Keyword Teardown" I am not sure that RobotCode can actually work out if the variable is used in the correct situation, again because of static vs dynamic analysis. Nor would it make a lot of sense to require the user to define them in the variable section to set a default value to remove the warning (it does not seem to be good idea). I guess we could have a warning like: "${TEST NAME}" variable is used in this keyword, but the keyword is used in a suite setup. (Although there could be a TRY/EXCEPT block, or something else, specifically to deal with this situation, so a warning could be a false positive...). |
Describe the bug
If a global variable is set, the extension doesn't see it.
Steps To Reproduce
Steps to reproduce the behavior:
__init__.robot
withVAR ${WELCOME} Hello scope=GLOBAL
Variable '${WELCOME}' not found.robotcode(VariableNotFound)
in VS CodeDesktop:
The text was updated successfully, but these errors were encountered: