HyperRobotFrameworkPlugin icon indicating copy to clipboard operation
HyperRobotFrameworkPlugin copied to clipboard

Keywords prefixed by resource/library don't offer autocomplete

Open Santherus opened this issue 1 year ago • 12 comments

If I have an imported resource file, I'm not getting code completion hints when using the resource.keyword notation, e.g.

*** Settings *** Library Collections Resource my_resource.resource

*** Keywords *** my_resource.my_keyword ${myList} create list Collections.log list ${myList}

In the above, I'm not getting code completion when entering my_resource, or when entering Collections into the pycharm IDE.

Santherus avatar May 21 '24 08:05 Santherus

the library/resource name prefix can be omitted.

*** Settings ***
Library    Collections
Resource    my_resource.resource

*** Keywords ***
my_keyword
${myList}    create list
log list    ${myList}

in plugin 0.1.17 you can use library alias:

*** Settings ***
Library    Collections    AS    c
Resource    my_resource.resource

*** Keywords ***
my_keyword
c.create list    ...

while for resource alias is not supported yet.

jnhyperion avatar May 21 '24 09:05 jnhyperion

Hello there - I'm not actually looking for/interested in aliases. I'm just looking for code completion when entering a library/resource name.keyword - just basic code completion when operating in that fashion.

Santherus avatar May 25 '24 10:05 Santherus

Like I mentioned, you do not need to add library/resource name. prefix, unless you have multi same name kw in different imported libraries, resources, in this case, you need to use the aliases. Please try to directly input the kw.

jnhyperion avatar May 27 '24 01:05 jnhyperion

For me it is not clear. Why should I create an alias for a library name, when I could use the library name as a prefix?

ZsoZso23 avatar Nov 18 '24 08:11 ZsoZso23

Like I mentioned, you do not need to add library/resource name. prefix, unless you have multi same name kw in different imported libraries, resources, in this case, you need to use the aliases. Please try to directly input the kw.

Please read the bold lines.

jnhyperion avatar Nov 18 '24 09:11 jnhyperion

I understood this part, this was not my question.

Lets say I have the following structure:

Kewords
     A.robot
        SomeKeyword
     B.robot
        SomeKeyword

In this case, I have same name keyword, with different named robot files, so we can make a difference by the robot file names. So, why should we make:

Library         A    AS    A_alias
Library         B    AS    B_alias

Keyword
    A_alias.SomeKeyword
    B_alias.SomeKeyword

Instead of more easier use:

Library         A
Library         B

Keyword
    A.SomeKeyword
    B.SomeKeyword

ZsoZso23 avatar Nov 18 '24 11:11 ZsoZso23

Aliases should be used only when our robot file names are also identical, in this case I don't see the practical use.

ZsoZso23 avatar Nov 18 '24 11:11 ZsoZso23

I see, this is a non documented robot feature, looks like this:

  • Import python file library / resource file like: Library foo/bar/lib.py / Resource foo/bar/lib.resource
  • Then you can use the file name lib as the alias like lib.my kw

I didn't know this feature before, so plugin does not support that.

When to use robot lib alias, please check: https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#library-name

jnhyperion avatar Nov 19 '24 02:11 jnhyperion

Actually, this is a documented feature: https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#specifying-a-keyword-explicitly

But you are right with the alias, it is not only useful in identical file names.

So based on this doc, can I request code completion support when I type the Libary name with a dot?

ZsoZso23 avatar Nov 19 '24 07:11 ZsoZso23

Thanks for sharing, I'll add this to my TODO list.

jnhyperion avatar Nov 19 '24 08:11 jnhyperion

Hello - I can see that this one was closed, but (at the same time) on your TODO list; does that mean that this is still 'open' , and will receive a change?

Santherus avatar Apr 23 '25 10:04 Santherus

Sorry, this should be reopened and marked as enhancement.

jnhyperion avatar Apr 24 '25 01:04 jnhyperion