提交 d5ce11b9 编写于 作者: J Johannes Rieken

swap commands id and context keys

上级 a0148f7b
......@@ -21,7 +21,7 @@ export class SnippetController2 {
return editor.getContribution<SnippetController2>('snippetController2');
}
static InSnippetMode = new RawContextKey('isInSnippet', false);
static InSnippetMode = new RawContextKey('inSnippetMode', false);
static HasNextTabstop = new RawContextKey('hasNextTabstop', false);
static HasPrevTabstop = new RawContextKey('hasPrevTabstop', false);
......@@ -132,7 +132,7 @@ export class SnippetController2 {
const CommandCtor = EditorCommand.bindToContribution<SnippetController2>(SnippetController2.get);
CommonEditorRegistry.registerEditorCommand(new CommandCtor({
id: 'snippet.next',
id: 'jumpToNextSnippetPlaceholder',
precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasNextTabstop),
handler: ctrl => ctrl.next(),
kbOpts: {
......@@ -142,7 +142,7 @@ CommonEditorRegistry.registerEditorCommand(new CommandCtor({
}
}));
CommonEditorRegistry.registerEditorCommand(new CommandCtor({
id: 'snippet.prev',
id: 'jumpToPrevSnippetPlaceholder',
precondition: ContextKeyExpr.and(SnippetController2.InSnippetMode, SnippetController2.HasPrevTabstop),
handler: ctrl => ctrl.prev(),
kbOpts: {
......@@ -152,7 +152,7 @@ CommonEditorRegistry.registerEditorCommand(new CommandCtor({
}
}));
CommonEditorRegistry.registerEditorCommand(new CommandCtor({
id: 'snippet.cancel',
id: 'leaveSnippet',
precondition: SnippetController2.InSnippetMode,
handler: ctrl => ctrl.cancel(),
kbOpts: {
......@@ -164,7 +164,7 @@ CommonEditorRegistry.registerEditorCommand(new CommandCtor({
}));
CommonEditorRegistry.registerEditorCommand(new CommandCtor({
id: 'snippet.accept',
id: 'acceptSnippet',
precondition: SnippetController2.InSnippetMode,
handler: ctrl => ctrl.finish(),
// kbOpts: {
......
......@@ -715,12 +715,12 @@ export class SnippetController {
}
}
export var CONTEXT_SNIPPET_MODE = new RawContextKey<boolean>('inSnippetMode', false);
export var CONTEXT_SNIPPET_MODE = new RawContextKey<boolean>('old.inSnippetMode', false);
const SnippetCommand = EditorCommand.bindToContribution<SnippetController>(SnippetController.get);
CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
id: 'jumpToNextSnippetPlaceholder',
id: 'old.jumpToNextSnippetPlaceholder',
precondition: CONTEXT_SNIPPET_MODE,
handler: x => x.jumpToNextPlaceholder(),
kbOpts: {
......@@ -730,7 +730,7 @@ CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
}
}));
CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
id: 'jumpToPrevSnippetPlaceholder',
id: 'old.jumpToPrevSnippetPlaceholder',
precondition: CONTEXT_SNIPPET_MODE,
handler: x => x.jumpToPrevPlaceholder(),
kbOpts: {
......@@ -740,7 +740,7 @@ CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
}
}));
CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
id: 'acceptSnippet',
id: 'old.acceptSnippet',
precondition: CONTEXT_SNIPPET_MODE,
handler: x => x.acceptSnippet(),
kbOpts: {
......@@ -750,7 +750,7 @@ CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
}
}));
CommonEditorRegistry.registerEditorCommand(new SnippetCommand({
id: 'leaveSnippet',
id: 'old.leaveSnippet',
precondition: CONTEXT_SNIPPET_MODE,
handler: x => x.leaveSnippet(),
kbOpts: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册