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

Duplicate Clipboard actions in editor context menu #13619

Open
dhuebner opened this issue Apr 19, 2024 · 3 comments
Open

Duplicate Clipboard actions in editor context menu #13619

dhuebner opened this issue Apr 19, 2024 · 3 comments

Comments

@dhuebner
Copy link
Contributor

Bug Description:

Duplicate entries for Copy/Paste/Cut actions in the editor's context menu. Es extensions I have only ESLint installed, everything else should be the built-in extensions set.

Bildschirmfoto 2024-04-19 um 10 20 33

Steps to Reproduce:

  1. Open a file editor
  2. Open context menu, check the clipboard actions section.

Additional Information

  • Operating System:
    Mac OSX Sonoma

  • Theia Version:
    Eclipse Theia IDE
    Version 1.48.300
    VS Code API Version: 1.87.2

@dhuebner
Copy link
Contributor Author

Here is the editor context menu in a browser app:
Bildschirmfoto 2024-04-19 um 10 37 22

@dhuebner
Copy link
Contributor Author

Seems like the one contribution comes from monaco editor e.g. Command ID for cut editor.action.clipboardCutAction and the other from common editor menu ID core.cut registered in editor-menu.ts.

@dhuebner
Copy link
Contributor Author

One possible solution would be to skip context menu registration in MonacoEditorMenuContribution when a command with the mapped id from MonacoCommands.COMMON_ACTIONS is already registered.
In example when handling editor.action.clipboardCutAction check in the MenuRegistry if the mapper command core.cut already registered in the given item group and skip.

if (commandId) {
    const menuPath = [...EDITOR_CONTEXT_MENU, (item.group || '')];
    const coreId = MonacoCommands.COMMON_ACTIONS.get(commandId);
    if (coreId && registry.getMenu(menuPath).children.some(it => it.id === coreId)) {
        console.debug(`The command '${commandId}' is already registered in the context menu as '${coreId}'.`);
    } else {
        registry.registerMenuAction(menuPath, this.buildMenuAction(commandId, item));
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant