Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Code navigation not working for custom keywords having a keyword argument #5401

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
djalan opened this issue Apr 14, 2025 · 3 comments
Open

Comments

@djalan
Copy link

djalan commented Apr 14, 2025

Hello

Is there a way to create a custom keyword where a keyword argument can be clickable just like Log in Repeat Keyword?

Image

When a string is in yellow, it can be navigated to by control-click or right-click/Go To Definition and you will see the source code.

Also, in Uno, I can mouse hover Log and see the parameters that can be passed to it. It is not possible in Deuxio because it is considered to be a string thus the red color.

I tried creating my own annotation based on:

@run_keyword_variant(resolve=1, dry_run=True)

where I changed the first string "BuiltIn", but it didn't work.

RUN_KW_REGISTER.register_run_keyword('BuiltIn', method.__name__,

Convenient repo @ https://github.com/djalan/robotcode-clickable-keyword-argument

from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn

class MyTools:
    
    def __init__(self):
        self.bi = BuiltIn()
    
    @keyword
    def repeater_of_keyword(self, repeat: int, name: str, *args):
        for i in range(0, repeat):
            self.bi.run_keyword(name, *args)
  • RobotCode Version [1.0.3]
  • Python Version [3.11.7]
  • RobotFramework Version [6.1.1]
  • robotidy 4.16.0
  • OS: Windows_NT x64 10.0.26100
  • VsCode:
    Version: 1.99.2 (user setup)
    Commit: 4949701c880d4bdb949e3c0e6b400288da7f474b
    Date: 2025-04-10T01:21:25.295Z
    Electron: 34.3.2
    ElectronBuildId: 11161073
    Chromium: 132.0.6834.210
    Node.js: 20.18.3
    V8: 13.2.152.41-electron.0
    OS: Windows_NT x64 10.0.26100
@d-biehl
Copy link
Contributor

d-biehl commented Apr 14, 2025

to be complete here is the original issue from robotcode robotcodedev/robotcode#426

and we allready discussed this in #4857

@djalan
Copy link
Author

djalan commented Apr 14, 2025

I was about to link #4857 (comment) myself. Thanks

@pekkaklarck
Copy link
Member

Isn't this basically a duplicate of #4857? If yes, let's close this one and continue discussion there.

The enhancement itself is useful and I believe using type hints is the best solution. A problem with type hints has been that BuiltIn doesn't otherwise use them, but that is going to be addressed by #5373 in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants