robotcodedev / robotcode

RobotFramework support for Visual Studio Code
https://robotcode.io
Apache License 2.0
168 stars 13 forks source link

[QUESTION] Disable Keyword Error notification for duplicate keyword names #267

Open burrk opened 2 weeks ago

burrk commented 2 weeks ago

This is from https://robotframework.slack.com/archives/C0103745J7P/p1718374099910529 and is the same problem as this one was in LSP: https://github.com/robocorp/robotframework-lsp/issues/724

Simply, we use library search order to enable Page Objects to use the same keywords - just like objects should do. Please see the Robocorp issue for examples etc. We would like to switch to RobotCode but our code is covered in red squiggles - How do we turn the robotcode.namespace(KeywordError) off for multiple keywords with the same name?

Right now I would almost be happy to turn off all error messages! (There are so many squiggles we can't see them anyways)

We have tried setting robotcode.analysis.robot.globalLibrarySearchOrder, and it is very good at finding all the duplicates. Can we just turn this check off?

Thank-you!

Desktop (please complete the following information):

burrk commented 2 weeks ago

I found a "Disable Keyword Error for this line" option in the right button context menu when I click on the error in the Problems pane, or in the error lightbulb's "quick fix" menu.

It doesn't seem to do anything... and the 'error' is on far too many lines to disable it on each one...

d-biehl commented 2 weeks ago

Hello @burrk,

Unfortunately, it is not currently possible to disable this check. However, I am working on some options to optimize the analysis of Robot files and make it executable on the console as well. By then, it should be possible to disable these checks.

I might also be able to prioritize this and enable the disabling of checks globally or for an entire file sooner.

There is also Enhancement #203, which aims to incorporate the search order into the analysis.

Could you please provide an example of how such test cases look in your setup and how you manage the search order once it is set in a suite? What impact does this have on other test cases or keywords?

burrk commented 2 weeks ago

Thanks @d-biehl

I could copy everything from the same bug in LSP: https://github.com/robocorp/robotframework-lsp/issues/724 if that helps?

This is the initial message in the conversation:


Enhancement https://github.com/robocorp/robotframework-lsp/issues/432 causes code which depends on Builtin.Set Library Search Order (http://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Set%20Library%20Search%20Order) for pseudo-OOP polymorphism to be detected as errors (most of our robot code turns red).

In addition setting "robot.lint.keywordResolvesToMultipleKeywords": false to turn this feature off, causes LSP to miss other problems in the same code.

This is from a conversation with @fabioz on the RobotFramework's Slack channel: https://robotframework.slack.com/archives/C01AWSNKC2H/p1659529202045659?thread_ts=1659365333.316959&cid=C01AWSNKC2H

Set Library Search Order is especially important for RF Page Object frameworks:

burrk commented 3 days ago

Hi @d-biehl, Does that provide enough information and examples of code from Git?

d-biehl commented 3 days ago

He @burrk,

I have enough information ;-) I've already started to implement a solution, but I still need a bit more time...