Move Show Emmet Commands command to extension #58600

This commit is contained in:
Raymond Zhao 2020-11-17 23:15:00 +00:00 committed by GitHub
parent 9641ad2253
commit 33e7e030d2
5 changed files with 10 additions and 40 deletions

View file

@ -342,6 +342,11 @@
"command": "editor.emmet.action.reflectCSSValue",
"title": "%command.reflectCSSValue%",
"category": "Emmet"
},
{
"command": "editor.emmet.action.showEmmetCommands",
"title": "%command.showEmmetCommands%",
"category": ""
}
],
"menus": {

View file

@ -23,6 +23,7 @@
"command.decrementNumberByOneTenth": "Decrement by 0.1",
"command.incrementNumberByTen": "Increment by 10",
"command.decrementNumberByTen": "Decrement by 10",
"command.showEmmetCommands": "Show Emmet Commands",
"emmetSyntaxProfiles": "Define profile for specified syntax or use your own profile with specific rules.",
"emmetExclude": "An array of languages where Emmet abbreviations should not be expanded.",
"emmetExtensionsPath": "Path to a folder containing Emmet profiles and snippets.",

View file

@ -124,6 +124,10 @@ export function activateEmmetExtension(context: vscode.ExtensionContext) {
return reflectCssValue();
}));
context.subscriptions.push(vscode.commands.registerCommand('editor.emmet.action.showEmmetCommands', () => {
vscode.commands.executeCommand('workbench.action.quickOpen', '>Emmet: ');
}));
updateEmmetExtensionsPath();
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration((e) => {

View file

@ -1,39 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { registerEditorAction, EditorAction, ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { MenuId } from 'vs/platform/actions/common/actions';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
const EMMET_COMMANDS_PREFIX = '>Emmet: ';
class ShowEmmetCommandsAction extends EditorAction {
constructor() {
super({
id: 'workbench.action.showEmmetCommands',
label: nls.localize('showEmmetCommands', "Show Emmet Commands"),
alias: 'Show Emmet Commands',
precondition: EditorContextKeys.writable,
menuOpts: {
menuId: MenuId.MenubarEditMenu,
group: '5_insert',
title: nls.localize({ key: 'miShowEmmetCommands', comment: ['&& denotes a mnemonic'] }, "E&&mmet..."),
order: 4
}
});
}
public async run(accessor: ServicesAccessor, editor: ICodeEditor): Promise<void> {
const quickInputService = accessor.get(IQuickInputService);
quickInputService.quickAccess.show(EMMET_COMMANDS_PREFIX);
}
}
registerEditorAction(ShowEmmetCommandsAction);

View file

@ -3,6 +3,5 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import './actions/showEmmetCommands';
import './actions/expandAbbreviation';