@codingame/monaco-vscode-emmet-service-override 25.1.2 → 26.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-emmet-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - emmet service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.0.1"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -11,23 +11,23 @@ import { MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/
|
|
|
11
11
|
class ExpandAbbreviationAction extends EmmetEditorAction {
|
|
12
12
|
constructor() {
|
|
13
13
|
super({
|
|
14
|
-
id:
|
|
15
|
-
label: ( localize2(
|
|
14
|
+
id: "editor.emmet.action.expandAbbreviation",
|
|
15
|
+
label: ( localize2(7572, "Emmet: Expand Abbreviation")),
|
|
16
16
|
precondition: EditorContextKeys.writable,
|
|
17
|
-
actionName:
|
|
17
|
+
actionName: "expand_abbreviation",
|
|
18
18
|
kbOpts: {
|
|
19
19
|
primary: KeyCode.Tab,
|
|
20
20
|
kbExpr: ( ContextKeyExpr.and(
|
|
21
21
|
EditorContextKeys.editorTextFocus,
|
|
22
22
|
EditorContextKeys.tabDoesNotMoveFocus,
|
|
23
|
-
( ContextKeyExpr.has(
|
|
23
|
+
( ContextKeyExpr.has("config.emmet.triggerExpansionOnTab"))
|
|
24
24
|
)),
|
|
25
25
|
weight: KeybindingWeight.EditorContrib
|
|
26
26
|
},
|
|
27
27
|
menuOpts: {
|
|
28
28
|
menuId: MenuId.MenubarEditMenu,
|
|
29
|
-
group:
|
|
30
|
-
title: ( localize(
|
|
29
|
+
group: "5_insert",
|
|
30
|
+
title: ( localize(7573, "Emmet: E&&xpand Abbreviation")),
|
|
31
31
|
order: 3
|
|
32
32
|
}
|
|
33
33
|
});
|
|
@@ -5,15 +5,17 @@ import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
5
5
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
6
6
|
|
|
7
7
|
class GrammarContributions {
|
|
8
|
-
static {
|
|
8
|
+
static {
|
|
9
|
+
this._grammars = {};
|
|
10
|
+
}
|
|
9
11
|
constructor(contributions) {
|
|
10
12
|
if (!( Object.keys(GrammarContributions._grammars)).length) {
|
|
11
13
|
this.fillModeScopeMap(contributions);
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
fillModeScopeMap(contributions) {
|
|
15
|
-
contributions.forEach(
|
|
16
|
-
contribution.value.forEach(
|
|
17
|
+
contributions.forEach(contribution => {
|
|
18
|
+
contribution.value.forEach(grammar => {
|
|
17
19
|
if (grammar.language && grammar.scopeName) {
|
|
18
20
|
GrammarContributions._grammars[grammar.language] = grammar.scopeName;
|
|
19
21
|
}
|
|
@@ -31,11 +33,28 @@ class EmmetEditorAction extends EditorAction {
|
|
|
31
33
|
this._lastExtensionService = null;
|
|
32
34
|
this.emmetActionName = opts.actionName;
|
|
33
35
|
}
|
|
34
|
-
static {
|
|
36
|
+
static {
|
|
37
|
+
this.emmetSupportedModes = [
|
|
38
|
+
"html",
|
|
39
|
+
"css",
|
|
40
|
+
"xml",
|
|
41
|
+
"xsl",
|
|
42
|
+
"haml",
|
|
43
|
+
"jade",
|
|
44
|
+
"jsx",
|
|
45
|
+
"slim",
|
|
46
|
+
"scss",
|
|
47
|
+
"sass",
|
|
48
|
+
"less",
|
|
49
|
+
"stylus",
|
|
50
|
+
"styl",
|
|
51
|
+
"svg"
|
|
52
|
+
];
|
|
53
|
+
}
|
|
35
54
|
_withGrammarContributions(extensionService) {
|
|
36
55
|
if (this._lastExtensionService !== extensionService) {
|
|
37
56
|
this._lastExtensionService = extensionService;
|
|
38
|
-
this._lastGrammarContributions = extensionService.readExtensionPointContributions(grammarsExtPoint).then(
|
|
57
|
+
this._lastGrammarContributions = extensionService.readExtensionPointContributions(grammarsExtPoint).then(contributions => {
|
|
39
58
|
return ( new GrammarContributions(contributions));
|
|
40
59
|
});
|
|
41
60
|
}
|
|
@@ -44,9 +63,12 @@ class EmmetEditorAction extends EditorAction {
|
|
|
44
63
|
run(accessor, editor) {
|
|
45
64
|
const extensionService = accessor.get(IExtensionService);
|
|
46
65
|
const commandService = accessor.get(ICommandService);
|
|
47
|
-
return this._withGrammarContributions(extensionService).then(
|
|
48
|
-
if (this.id ===
|
|
49
|
-
return commandService.executeCommand(
|
|
66
|
+
return this._withGrammarContributions(extensionService).then(grammarContributions => {
|
|
67
|
+
if (this.id === "editor.emmet.action.expandAbbreviation" && grammarContributions) {
|
|
68
|
+
return commandService.executeCommand(
|
|
69
|
+
"emmet.expandAbbreviation",
|
|
70
|
+
EmmetEditorAction.getLanguage(editor, grammarContributions)
|
|
71
|
+
);
|
|
50
72
|
}
|
|
51
73
|
return undefined;
|
|
52
74
|
});
|
|
@@ -60,7 +82,7 @@ class EmmetEditorAction extends EditorAction {
|
|
|
60
82
|
const position = selection.getStartPosition();
|
|
61
83
|
model.tokenization.tokenizeIfCheap(position.lineNumber);
|
|
62
84
|
const languageId = model.getLanguageIdAtPosition(position.lineNumber, position.column);
|
|
63
|
-
const syntax = languageId.split(
|
|
85
|
+
const syntax = languageId.split(".").pop();
|
|
64
86
|
if (!syntax) {
|
|
65
87
|
return null;
|
|
66
88
|
}
|
|
@@ -69,7 +91,7 @@ class EmmetEditorAction extends EditorAction {
|
|
|
69
91
|
if (!languageGrammar) {
|
|
70
92
|
return syntax;
|
|
71
93
|
}
|
|
72
|
-
const languages = languageGrammar.split(
|
|
94
|
+
const languages = languageGrammar.split(".");
|
|
73
95
|
if (languages.length < 2) {
|
|
74
96
|
return syntax;
|
|
75
97
|
}
|