# How to make the IDE recognize Keyword as Arguments in Custom Python Library?

**URL:** <https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598>\
**Category:** Robot Framework\
**Created:** [2 January 2024 21:57 UTC](https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598 "2024-01-02T21:57:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![touchedthecode](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/touchedthecode/32/3284_2.png) [@touchedthecode](https://forum.robotframework.org/u/touchedthecode)\
**Post date:** [2 January 2024 21:57 UTC](https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598/1 "2024-01-02T21:57:42Z")

</div>

I’ve created some custom python libraries that, similar to the builtin run\_keword and its variants, have Keywords that take other Keywords as arguments. It works fine, but it is currently not user friendly to work with, because the IDE is interpreting it as a string so I don’t get the correct syntax highlighting and autocompletion in my IDE.

With Keywords like the builtin “Run Keyword”, the syntax highlighting and autocompletion works, but I couldn’t really figure out why that is, even after looking at the source code. I’m not experienced with this stuff, but I guess it must be something hard-mapped into the LSP?

Any way I could make this work with my keywords?

Thanks!

---

<div class="post-metadata">

**Author:** ![daniel](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/daniel/32/1492_2.png) [@daniel](https://forum.robotframework.org/u/daniel)\
**Post date:** [5 January 2024 16:34 UTC](https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598/2 "2024-01-05T16:34:25Z")

</div>

Which IDE are you using?

---

<div class="post-metadata">

**Author:** ![touchedthecode](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/touchedthecode/32/3284_2.png) [@touchedthecode](https://forum.robotframework.org/u/touchedthecode)\
**Post date:** [6 January 2024 19:10 UTC](https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598/3 "2024-01-06T19:10:05Z")

</div>

I’m using VS Code and (your?) Extension “Robot Code” 🙂  
(Sorry for calling it an IDE 😃 )

As an example here is a Keyword of one of my custom python libraries taking keywords as an argument:

> <https://github.com/touchedthecode/robotframework-pipe/blob/d3e7ca0c6ab6aa3a02b1140f4fa9f77496366c6b/PipeLibrary/ __init__.py#L95-L96>

I’m not sure if there is a way to mark that argument as a Keyword instead of a string, if you look at the bultin library and `run_keyword` Keyword arguments, they also don’t have anything special on them:

> <https://github.com/robotframework/robotframework/blob/9e8b64a0650796c0f6995ae76cec8bf2d4ec9895/src/robot/libraries/BuiltIn.py#L1926C1-L1927C1>

---

<div class="post-metadata">

**Author:** ![daniel](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/daniel/32/1492_2.png) [@daniel](https://forum.robotframework.org/u/daniel)\
**Post date:** [10 January 2024 18:54 UTC](https://forum.robotframework.org/t/how-to-make-the-ide-recognize-keyword-as-arguments-in-custom-python-library/6598/4 "2024-01-10T18:54:45Z")

</div>

Unfortunately, this is not possible because there is no standardised interface for implementing such keywords.

In RobotCode this is hard-coded for the BuiltIn keywords `Run Keyword`, `Run Keyword If` etc. because we know how to handle them. If, as in your case, it is a variant where it is implemented differently again, how am I supposed to know? On the other hand, I don’t want to maintain all variants.

There have long been discussions in the RobotFramework that something like this should be implemented, see for example here [Enhance parser to optionally detect keywords used in arguments of other keywords (e.g. `Wait Until Keyword Succeeds`) · Issue #4857 · robotframework/robotframework · GitHub](https://github.com/robotframework/robotframework/issues/4857)  
But they have never really led to a solution.

I could also imagine that the whole thing could be done on the RobotCode side, so it doesn’t have to happen in the RobotFramework. However, this would again require a defined API. Can you maybe open an issue as an extension at RobotCode [Issues · d-biehl/robotcode · GitHub](https://github.com/d-biehl/robotcode/issues) and describe what you want and link to this post, maybe also find some matching issues in RobotFramework and link to them. I’m not sure when I could implement something like that, but I don’t want to forget the idea.

And what else I wanted to say: Great idea, your library!!!
