Skip to content

[ENHANCEMENT] Option to hide keywords tagged robot:private from other files in keyword completion #652

Description

@d-biehl

Is your enhancement request related to a problem? Please describe.

Keywords tagged with robot:private are meant to be used only in the file that defines them. Robot Framework logs a warning when such a keyword is called from another file, and RobotCode reports the same as a PrivateKeyword warning.

Keyword completion does not know about this. After importing a resource file into a suite, its private keywords are offered in the completion list like every other keyword. So the editor first proposes a keyword and then complains when it is used. In projects that use private keywords to hide helper keywords, they also make the completion list longer than necessary.

Describe the solution you'd like

  • Keyword completion does not offer keywords tagged robot:private that come from another file. Inside the file that defines them they are still offered, because using them there is valid.
  • This can be switched on and off with a setting (for example robotcode.completion.hidePrivateKeywords), so that users who want to see every keyword still can.
  • When private keywords are shown, they could be marked as private and sorted after the public ones, similar to how deprecated keywords are marked.

Describe alternatives you've considered

  • Keeping the current behaviour and relying on the PrivateKeyword warning only. It works, but it tells the user about the problem after the keyword was inserted.
  • Always hiding private keywords without a setting. Simpler, but some users call private keywords from other files on purpose and only accept the warning.

Additional context

  • The private state follows what RobotCode already uses for the PrivateKeyword diagnostic and for preferring public over private keywords when names collide. That includes robot:private declared in the keyword documentation (Tags: robot:private), which Libdoc reports as private too.
  • Robot Framework checks private calls only for keywords of resource files. Whether library keywords tagged robot:private should be hidden as well has to be decided.
  • The setting has to be available in VS Code and IntelliJ.

AI / tooling disclosure

This issue was drafted with Claude Code while working on Robot Framework 7.5 support. I checked the current behaviour in the code (no private filtering in keyword completion, existing PrivateKeyword diagnostic) and reviewed the text.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlangserverThis issue is specific to the language server

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions