Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent stack overflow with cyclic menu contributions #13264

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

dhuebner
Copy link
Member

What it does

  • Notifies about a menu item contribution where both a command and submenu is used. In such a case the command will be used and submenu entry ignored (vs-code behavior).
  • Checks for menu recursion in MenuModelRegistry.linkSubmenu(). If detected a warning is logged and the contribution is ignored.

How to test

Follow the steps from #13036. After installing the extension several warnings should be logged:

2024-01-12T08:44:30.199Z root WARN Menu item robot.runSuite from plugin robocorp.robotframework-lsp contributed both submenu and command. Only command will be registered.
...
2024-01-12T08:44:30.199Z root WARN Recursive menu contribution detected: robotsubmenu is already in hierarchy of 1_run.

A "Maximum call stack size exceeded" should not be thrown and you should be able to see a new "Robot Framework" submenu in the explorer view.

Review checklist

Reminder for reviewers

@dhuebner dhuebner force-pushed the huebner/cyclic-menu-13036 branch from fd5ec70 to d3a1284 Compare January 12, 2024 10:02
@JonasHelming JonasHelming requested a review from planger January 15, 2024 07:48
Copy link
Contributor

@planger planger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, code looks good to me, prevents call stack error and the context menu now opens with the correctly contributed items 👍

Tested with robocorp.robotframework-lsp-1.11.0.vsix in example browser app.

Thank you @dhuebner!

@msujew msujew added vscode issues related to VSCode compatibility menus issues related to the menu labels Jan 15, 2024
@JonasHelming
Copy link
Contributor

@msujew Do you want to merge this?

@msujew msujew merged commit a6d7e9b into eclipse-theia:master Jan 16, 2024
13 of 14 checks passed
@dhuebner dhuebner deleted the huebner/cyclic-menu-13036 branch January 17, 2024 08:10
@msujew msujew linked an issue Jan 22, 2024 that may be closed by this pull request
@jfaltermeier jfaltermeier added this to the 1.46.0 milestone Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
menus issues related to the menu vscode issues related to VSCode compatibility
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Maximum call stack size exceeded after install robot-lsp extension
5 participants