-
-
Notifications
You must be signed in to change notification settings - Fork 21
[Enhancement] New keywords not found until cache is manually cleared #402
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
How did you add the new keyword? There are so many ways to do this. And where is your repository located and your libraries located, directly on the hard drive? Sometimes this can happen, because RobotCode listens to file changes from vscode, but vscode is not able to send this everytime because of the location of the repository. |
Ok, this might be an edge case maybe. I have a test library that I import like this: .robot file: *** Settings ***
Documentation Test suite for the SwRS tests
Metadata SemVer ${SEMVER}
Library ../../python/SwRSRAE3.py If I add a keyword in the SwRSRAE3 class it gets picked up by RobotCode without the need to manually clear the cache. However, the keywords I've been adding lately have been added to AgvHelper, a parent class to SwRSRAE3: SwRSRAE3.py: """Module containing the keywords for the SwRS RAE 3 test suite"""
import random
import time
import AgvHelper
from robot.api.deco import keyword, library, not_keyword
from robot.api.exceptions import Failure
@library
class SwRSRAE3(AgvHelper.AgvHelper): |
Currently, RobotCode only has access to information provided by Libdoc, which includes the file or module where the keyword class is defined. It does not, however, have insight into the internal structure of a class, such as parent classes and their respective file locations. If you import a library as a file (as shown in the example above), RobotCode can only track changes in that specific file. Consequently, if you modify keywords within a parent class located in a separate file, RobotCode won't be able to detect those changes. On the other hand, if you import your library as a Python module—which is the recommended approach—RobotCode attempts to track all files belonging to that module and monitors changes across all related files. For details on different ways to import libraries in Robot Framework, see the official documentation. I'm currently unable to confirm whether this approach fully addresses your issue due to limited investigation time. Given this uncertainty, the issue cannot be immediately resolved, but I will reclassify it from a bug to an enhancement. We might revisit this once the planned rewrite of Robot Framework's import functionality is complete. |
I've added the path to the Python Path: "robotcode.robot.pythonPath": [
"HIL-rig/python"
] Then I changed the import to Library SwRSRAE3 A newly created keyword in the parent class of SwRSRAE3 was immediately picked up by RobotCode, but any subsequent changes or keyword additions in the file where not. However, it's not a show stopper by any means so I completely understand if this goes to the bottom part of your priority list. |
Describe the bug
If I write a new keyword in an existing test library and use it in a .robot/resource file, RobotCode doesn't recognize it until I do a "Clear Cache And Restart Language Servers".
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
When I save the test library file after adding the new keyword, RobotCode should recognize that a test library that it's already aware of has changed and update the cache automatically. This should also be the case when a keyword is removed.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: