go to line.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-07-18 14:43:46 +02:00
parent 33af9b6005
commit 939a905a6b
3 changed files with 48 additions and 1 deletions

View File

@ -97,6 +97,7 @@ import { VerifySketch } from './contributions/verify-sketch';
import { UploadSketch } from './contributions/upload-sketch';
import { CommonFrontendContribution } from './customization/core/common-frontend-contribution';
import { CopyToForum } from './contributions/copy-to-forum';
import { GoToLine } from './contributions/go-to-line';
const ElementQueries = require('css-element-queries/src/ElementQueries');
@ -326,4 +327,5 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
Contribution.configure(bind, VerifySketch);
Contribution.configure(bind, UploadSketch);
Contribution.configure(bind, CopyToForum);
Contribution.configure(bind, GoToLine);
});

View File

@ -12,7 +12,7 @@ export class CopyToForum extends EditorContribution {
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(CopyToForum.Commands.COPY_TO_FORUM, {
execute: () => this.copyToForum()
})
});
}
registerMenus(registry: MenuModelRegistry): void {

View File

@ -0,0 +1,45 @@
import { injectable } from 'inversify';
import { EditorContribution, Command, MenuModelRegistry, KeybindingRegistry, CommandRegistry } from './contribution';
import { ArduinoMenus } from '../menu/arduino-menus';
@injectable()
export class GoToLine extends EditorContribution {
registerCommands(registry: CommandRegistry): void {
registry.registerCommand(GoToLine.Commands.GO_TO_LINE, {
execute: () => this.goToLine()
});
}
registerMenus(registry: MenuModelRegistry): void {
registry.registerMenuAction(ArduinoMenus.EDIT__TEXT_CONTROL_GROUP, {
commandId: GoToLine.Commands.GO_TO_LINE.id,
label: 'Go to Line...',
order: '6'
});
}
registerKeybindings(registry: KeybindingRegistry): void {
registry.registerKeybinding({
command: GoToLine.Commands.GO_TO_LINE.id,
keybinding: 'CtrlCmd+L'
});
}
async goToLine(): Promise<void> {
const editor = await this.current();
if (editor) {
const action = editor.getControl().getAction('editor.action.gotoLine');
return action.run();
}
}
}
export namespace GoToLine {
export namespace Commands {
export const GO_TO_LINE: Command = {
id: 'arduino-go-to-line'
};
}
}