robotcode icon indicating copy to clipboard operation
robotcode copied to clipboard

[ENHANCEMENT] Support syntax-highlighting and auto-completion for Keyword arguments / run keyword variants

Open touchedthecode opened this issue 1 year ago • 0 comments

We have talked about this on the RobotFramework Forum (https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598/3), thank you again for your reply and feedback!

Is your enhancement request related to a problem? Please describe. Currently the editor doesn't recognize Keywords as arguments in custom python libraries, this makes it hard working with custom keywords that take Keywords as an argument, one example is my own library: https://github.com/touchedthecode/robotframework-pipe

The editor will treat the *keywords argument as strings:


def pipe(self, *keywords):
    """Executes a series of Robot Framework keywords in a piped sequence.

meanwhile the Run Keywords Keyword from the BuiltIn Library is recognized correctly and the editor shows syntax-highlighting and auto-completion for the *keywords here:

def run_keywords(self, *keywords):
    """Executes all the given keywords in a sequence.

Describe the solution you'd like I would like to be able to somehow declare my arguments as a Keyword, so that Visual Studio Code / RobotCode would recognize this and show the correct syntax-highlighting and auto-completion, the same way it works with all the BuiltIn Run Keyword. The easiest way would be to have a type hint for arguments that can contain keywords imo. I'm thinking about something like:

def pipe(self, *keywords: Keyword):
    """Executes a series of Robot Framework keywords in a piped sequence.

Additional context You have already proposed a few ideas in a robotframework issue like special type hints or a keyword parser API to extend the parser itself: https://github.com/robotframework/robotframework/issues/4857#issuecomment-1864106042

touchedthecode avatar Jan 14 '24 10:01 touchedthecode