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

Implementation of some editor.action commands needed for plugin API #5222

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/editor/src/browser/editor-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ export namespace EditorCommands {

const EDITOR_CATEGORY = 'Editor';

export const RENAME: Command = {
id: 'editor.action.rename'
};

export const FORMAT_SELECTION: Command = {
id: 'editor.action.formatSelection'
};

export const FORMAT_DOCUMENT: Command = {
id: 'editor.action.formatDocument'
};

/**
* Show editor references
*/
Expand Down Expand Up @@ -115,6 +127,9 @@ export class EditorCommandContribution implements CommandContribution {
protected readonly editorManager: EditorManager;

registerCommands(registry: CommandRegistry): void {
registry.registerCommand(EditorCommands.RENAME);
registry.registerCommand(EditorCommands.FORMAT_SELECTION);
registry.registerCommand(EditorCommands.FORMAT_DOCUMENT);
registry.registerCommand(EditorCommands.SHOW_REFERENCES);
registry.registerCommand(EditorCommands.CONFIG_INDENTATION);
registry.registerCommand(EditorCommands.CONFIG_EOL);
Expand Down
3 changes: 3 additions & 0 deletions packages/monaco/src/browser/monaco-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
this.registry.registerHandler(EditorCommands.CONFIG_EOL.id, this.newConfigEolHandler());
this.registry.registerHandler(EditorCommands.INDENT_USING_SPACES.id, this.newConfigTabSizeHandler(true));
this.registry.registerHandler(EditorCommands.INDENT_USING_TABS.id, this.newConfigTabSizeHandler(false));
this.registry.registerHandler(EditorCommands.RENAME.id, this.newCommandHandler('monaco.editor.action.rename'));
this.registry.registerHandler(EditorCommands.FORMAT_SELECTION.id, this.newCommandHandler('monaco.editor.action.formatSelection'));
this.registry.registerHandler(EditorCommands.FORMAT_DOCUMENT.id, this.newCommandHandler('monaco.editor.action.formatDocument'));
}

protected newShowReferenceHandler(): MonacoEditorCommandHandler {
Expand Down