Skip to content

Commit

Permalink
Deprecating old emmet (#31783)
Browse files Browse the repository at this point in the history
* Deprecate old emmet

* Update translations
  • Loading branch information
ramya-rao-a authored Jul 31, 2017
1 parent f4871bf commit 593ecbe
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 1,044 deletions.
2 changes: 1 addition & 1 deletion extensions/emmet/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"command.decrementNumberByTen": "Decrement by 10",
"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, snippets and preferences. Only profiles are honored from extensions path when emmet.useNewEmmet is set to true.'",
"emmetExtensionsPath": "Path to a folder containing emmet profiles and snippets.'",
"emmetShowExpandedAbbreviation": "Shows expanded emmet abbreviations as suggestions.\nThe option \"inMarkupAndStylesheetFilesOnly\" applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option \"always\" applies to all parts of the file regardless of markup/css.",
"emmetShowAbbreviationSuggestions": "Shows possible emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to \"never\".",
"emmetIncludeLanguages": "Enable emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and emmet supported language.\n Eg: {\"vue-html\": \"html\", \"javascript\": \"javascriptreact\"}",
Expand Down
2 changes: 1 addition & 1 deletion extensions/emmet/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export function sameNodes(node1: Node, node2: Node): boolean {
export function getEmmetConfiguration() {
const emmetConfig = vscode.workspace.getConfiguration('emmet');
return {
useNewEmmet: emmetConfig['useNewEmmet'],
useNewEmmet: true,
showExpandedAbbreviation: emmetConfig['showExpandedAbbreviation'],
showAbbreviationSuggestions: emmetConfig['showAbbreviationSuggestions'],
syntaxProfiles: emmetConfig['syntaxProfiles'],
Expand Down
5 changes: 0 additions & 5 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"dependencies": {
"applicationinsights": "0.17.1",
"chokidar": "bpasero/chokidar#vscode",
"emmet": "ramya-rao-a/emmet#vscode",
"fast-plist": "0.1.2",
"gc-signals": "^0.0.1",
"getmac": "1.0.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,22 @@
*--------------------------------------------------------------------------------------------*/

'use strict';

import nls = require('vs/nls');
import { BasicEmmetEditorAction } from 'vs/workbench/parts/emmet/electron-browser/emmetActions';

import { EmmetEditorAction } from 'vs/workbench/parts/emmet/electron-browser/emmetActions';
import { editorAction } from 'vs/editor/common/editorCommonExtensions';
import { ICommonCodeEditor } from 'vs/editor/common/editorCommon';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { CoreEditingCommands } from 'vs/editor/common/controller/coreCommands';

import { KeyCode } from 'vs/base/common/keyCodes';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';

@editorAction
class ExpandAbbreviationAction extends BasicEmmetEditorAction {
class ExpandAbbreviationAction extends EmmetEditorAction {

constructor() {
super(
'editor.emmet.action.expandAbbreviation',
nls.localize('expandAbbreviationAction', "Emmet: Expand Abbreviation"),
'Emmet: Expand Abbreviation',
'expand_abbreviation',
{
primary: KeyCode.Tab,
kbExpr: ContextKeyExpr.and(
EditorContextKeys.textFocus,
EditorContextKeys.hasOnlyEmptySelection,
EditorContextKeys.hasSingleSelection,
EditorContextKeys.tabDoesNotMoveFocus,
ContextKeyExpr.has('config.emmet.triggerExpansionOnTab'),
ContextKeyExpr.not('config.emmet.useNewEmmet')
)
}
);
}
super({
id: 'editor.emmet.action.expandAbbreviation',
label: nls.localize('expandAbbreviationAction', "Emmet: Expand Abbreviation"),
alias: 'Emmet: Expand Abbreviation',
precondition: EditorContextKeys.writable,
actionName: 'expand_abbreviation'
});

protected noExpansionOccurred(editor: ICommonCodeEditor): void {
// forward the tab key back to the editor
CoreEditingCommands.Tab.runEditorCommand(null, editor, null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
'use strict';

import nls = require('vs/nls');
import { EmmetEditorAction, EmmetActionContext } from 'vs/workbench/parts/emmet/electron-browser/emmetActions';
import { EmmetEditorAction } from 'vs/workbench/parts/emmet/electron-browser/emmetActions';

import { ServicesAccessor, editorAction } from 'vs/editor/common/editorCommonExtensions';
import { editorAction } from 'vs/editor/common/editorCommonExtensions';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { IQuickOpenService, IInputOptions } from 'vs/platform/quickOpen/common/quickOpen';

@editorAction
class WrapWithAbbreviationAction extends EmmetEditorAction {
Expand All @@ -25,21 +24,4 @@ class WrapWithAbbreviationAction extends EmmetEditorAction {
});
}

public runEmmetAction(accessor: ServicesAccessor, ctx: EmmetActionContext) {
const quickOpenService = accessor.get(IQuickOpenService);

let options: IInputOptions = {
prompt: nls.localize('enterAbbreviation', "Enter Abbreviation"),
placeHolder: nls.localize('abbreviation', "Abbreviation")
};
quickOpenService.input(options).then(abbreviation => {
this.wrapAbbreviation(ctx, abbreviation);
});
}

private wrapAbbreviation(ctx: EmmetActionContext, abbreviation: string) {
if (abbreviation && !ctx.emmet.run('wrap_with_abbreviation', ctx.editorAccessor, abbreviation)) {
this.noExpansionOccurred(ctx.editor);
}
}
}
Loading

0 comments on commit 593ecbe

Please sign in to comment.