@codingame/monaco-vscode-snippets-service-override 28.4.0 → 29.0.0
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 +3 -3
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/configureSnippets.js +17 -17
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets.js +2 -2
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/insertSnippet.js +1 -1
- package/vscode/src/vs/workbench/contrib/snippets/browser/commands/surroundWithSnippet.js +1 -1
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetCodeActionProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetPicker.js +7 -7
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippets.contribution.js +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-snippets-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "29.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - snippets service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
19
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "29.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-files-service-override": "29.0.0"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
package/vscode/src/vs/workbench/contrib/snippets/browser/commands/abstractSnippetsActions.js
CHANGED
|
@@ -4,7 +4,7 @@ import { localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
4
4
|
import { Action2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
5
5
|
|
|
6
6
|
const defaultOptions = {
|
|
7
|
-
category: ( localize2(
|
|
7
|
+
category: ( localize2(12732, "Snippets"))
|
|
8
8
|
};
|
|
9
9
|
class SnippetsAction extends Action2 {
|
|
10
10
|
constructor(desc) {
|
|
@@ -58,13 +58,13 @@ async function computePicks(snippetService, userDataProfileService, languageServ
|
|
|
58
58
|
const snippet = {
|
|
59
59
|
label: basename(file.location),
|
|
60
60
|
filepath: file.location,
|
|
61
|
-
description: names.size === 0 ? ( localize(
|
|
61
|
+
description: names.size === 0 ? ( localize(12733, "(global)")) : ( localize(12734, "({0})", [...names].join(", ")))
|
|
62
62
|
};
|
|
63
63
|
existing.push(snippet);
|
|
64
64
|
if (!source) {
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
const detail = ( localize(
|
|
67
|
+
const detail = ( localize(12735, "({0}) {1}", source, labelService.getUriLabel(file.location, {
|
|
68
68
|
relative: true
|
|
69
69
|
})));
|
|
70
70
|
const lastItem = added.get(basename(file.location));
|
|
@@ -132,16 +132,16 @@ async function createSnippetFile(
|
|
|
132
132
|
}
|
|
133
133
|
await fileService.createFolder(defaultPath);
|
|
134
134
|
const input = await quickInputService.input({
|
|
135
|
-
placeHolder: ( localize(
|
|
135
|
+
placeHolder: ( localize(12736, "Type snippet file name")),
|
|
136
136
|
async validateInput(input) {
|
|
137
137
|
if (!input) {
|
|
138
|
-
return localize(
|
|
138
|
+
return localize(12737, "Invalid file name");
|
|
139
139
|
}
|
|
140
140
|
if (!isValidBasename(input)) {
|
|
141
|
-
return localize(
|
|
141
|
+
return localize(12738, "'{0}' is not a valid file name", input);
|
|
142
142
|
}
|
|
143
143
|
if (await fileService.exists(createSnippetUri(input))) {
|
|
144
|
-
return localize(
|
|
144
|
+
return localize(12739, "'{0}' already exists", input);
|
|
145
145
|
}
|
|
146
146
|
return undefined;
|
|
147
147
|
}
|
|
@@ -219,10 +219,10 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
219
219
|
constructor() {
|
|
220
220
|
super({
|
|
221
221
|
id: "workbench.action.openSnippets",
|
|
222
|
-
title: ( localize2(
|
|
222
|
+
title: ( localize2(12740, "Configure Snippets")),
|
|
223
223
|
shortTitle: {
|
|
224
|
-
...( localize2(
|
|
225
|
-
mnemonicTitle: ( localize(
|
|
224
|
+
...( localize2(12741, "Snippets")),
|
|
225
|
+
mnemonicTitle: ( localize(12742, "&&Snippets"))
|
|
226
226
|
},
|
|
227
227
|
f1: true,
|
|
228
228
|
menu: [{
|
|
@@ -249,37 +249,37 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
249
249
|
const picks = await computePicks(snippetService, userDataProfileService, languageService, labelService);
|
|
250
250
|
const existing = picks.existing;
|
|
251
251
|
const globalSnippetPicks = [{
|
|
252
|
-
scope: ( localize(
|
|
253
|
-
label: ( localize(
|
|
252
|
+
scope: ( localize(12743, "global")),
|
|
253
|
+
label: ( localize(12744, "New Global Snippets file...")),
|
|
254
254
|
uri: userDataProfileService.currentProfile.snippetsHome
|
|
255
255
|
}];
|
|
256
256
|
const workspaceSnippetPicks = [];
|
|
257
257
|
for (const folder of workspaceService.getWorkspace().folders) {
|
|
258
258
|
workspaceSnippetPicks.push({
|
|
259
|
-
scope: ( localize(
|
|
260
|
-
label: ( localize(
|
|
259
|
+
scope: ( localize(12745, "{0} workspace", folder.name)),
|
|
260
|
+
label: ( localize(12746, "New Snippets file for '{0}'...", folder.name)),
|
|
261
261
|
uri: folder.toResource(".vscode")
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
264
|
if (existing.length > 0) {
|
|
265
265
|
existing.unshift({
|
|
266
266
|
type: "separator",
|
|
267
|
-
label: ( localize(
|
|
267
|
+
label: ( localize(12747, "Existing Snippets"))
|
|
268
268
|
});
|
|
269
269
|
existing.push({
|
|
270
270
|
type: "separator",
|
|
271
|
-
label: ( localize(
|
|
271
|
+
label: ( localize(12748, "New Snippets"))
|
|
272
272
|
});
|
|
273
273
|
} else {
|
|
274
274
|
existing.push({
|
|
275
275
|
type: "separator",
|
|
276
|
-
label: ( localize(
|
|
276
|
+
label: ( localize(12748, "New Snippets"))
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
const pick = await quickInputService.pick(
|
|
280
280
|
[].concat(existing, globalSnippetPicks, workspaceSnippetPicks, picks.future),
|
|
281
281
|
{
|
|
282
|
-
placeHolder: ( localize(
|
|
282
|
+
placeHolder: ( localize(12749, "Select Snippets File or Create Snippets")),
|
|
283
283
|
matchOnDescription: true
|
|
284
284
|
}
|
|
285
285
|
);
|
|
@@ -17,7 +17,7 @@ class ApplyFileSnippetAction extends SnippetsAction {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
super({
|
|
19
19
|
id: ApplyFileSnippetAction.Id,
|
|
20
|
-
title: ( localize2(
|
|
20
|
+
title: ( localize2(12750, "Fill File with Snippet")),
|
|
21
21
|
f1: true
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -89,7 +89,7 @@ class ApplyFileSnippetAction extends SnippetsAction {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
const pick = await quickInputService.pick(picks, {
|
|
92
|
-
placeHolder: ( localize(
|
|
92
|
+
placeHolder: ( localize(12751, "Select a snippet")),
|
|
93
93
|
matchOnDetail: true
|
|
94
94
|
});
|
|
95
95
|
return pick?.snippet;
|
|
@@ -44,7 +44,7 @@ class InsertSnippetAction extends SnippetEditorAction {
|
|
|
44
44
|
constructor() {
|
|
45
45
|
super({
|
|
46
46
|
id: "editor.action.insertSnippet",
|
|
47
|
-
title: ( localize2(
|
|
47
|
+
title: ( localize2(12752, "Insert Snippet")),
|
|
48
48
|
f1: true,
|
|
49
49
|
precondition: EditorContextKeys.writable,
|
|
50
50
|
metadata: {
|
|
@@ -26,7 +26,7 @@ class SurroundWithSnippetEditorAction extends SnippetEditorAction {
|
|
|
26
26
|
static {
|
|
27
27
|
this.options = {
|
|
28
28
|
id: "editor.action.surroundWithSnippet",
|
|
29
|
-
title: ( localize2(
|
|
29
|
+
title: ( localize2(12753, "Surround with Snippet..."))
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
constructor() {
|
|
@@ -22,7 +22,7 @@ let SurroundWithSnippetCodeActionProvider = class SurroundWithSnippetCodeActionP
|
|
|
22
22
|
static {
|
|
23
23
|
this._overflowCommandCodeAction = {
|
|
24
24
|
kind: CodeActionKind.SurroundWith.value,
|
|
25
|
-
title: ( localize(
|
|
25
|
+
title: ( localize(12754, "More...")),
|
|
26
26
|
command: {
|
|
27
27
|
id: SurroundWithSnippetEditorAction.options.id,
|
|
28
28
|
title: SurroundWithSnippetEditorAction.options.title.value
|
|
@@ -48,7 +48,7 @@ let SurroundWithSnippetCodeActionProvider = class SurroundWithSnippetCodeActionP
|
|
|
48
48
|
break;
|
|
49
49
|
}
|
|
50
50
|
actions.push({
|
|
51
|
-
title: ( localize(
|
|
51
|
+
title: ( localize(12755, "{0}", snippet.name)),
|
|
52
52
|
kind: CodeActionKind.SurroundWith.value,
|
|
53
53
|
edit: asWorkspaceEdit(model, range, snippet)
|
|
54
54
|
});
|
|
@@ -69,7 +69,7 @@ let FileTemplateCodeActionProvider = class FileTemplateCodeActionProvider {
|
|
|
69
69
|
}
|
|
70
70
|
static {
|
|
71
71
|
this._overflowCommandCodeAction = {
|
|
72
|
-
title: ( localize(
|
|
72
|
+
title: ( localize(12756, "Start with Snippet")),
|
|
73
73
|
kind: CodeActionKind.SurroundWith.value,
|
|
74
74
|
command: {
|
|
75
75
|
id: ApplyFileSnippetAction.Id,
|
|
@@ -96,7 +96,7 @@ let FileTemplateCodeActionProvider = class FileTemplateCodeActionProvider {
|
|
|
96
96
|
break;
|
|
97
97
|
}
|
|
98
98
|
actions.push({
|
|
99
|
-
title: ( localize(
|
|
99
|
+
title: ( localize(12757, "Start with: {0}", snippet.name)),
|
|
100
100
|
kind: CodeActionKind.SurroundWith.value,
|
|
101
101
|
edit: asWorkspaceEdit(model, model.getFullModelRange(), snippet)
|
|
102
102
|
});
|
|
@@ -34,13 +34,13 @@ async function pickSnippet(accessor, languageIdOrSnippets, resourceUri) {
|
|
|
34
34
|
let label = "";
|
|
35
35
|
switch (snippet.snippetSource) {
|
|
36
36
|
case SnippetSource.User:
|
|
37
|
-
label = ( localize(
|
|
37
|
+
label = ( localize(12760, "User Snippets"));
|
|
38
38
|
break;
|
|
39
39
|
case SnippetSource.Extension:
|
|
40
40
|
label = snippet.source;
|
|
41
41
|
break;
|
|
42
42
|
case SnippetSource.Workspace:
|
|
43
|
-
label = ( localize(
|
|
43
|
+
label = ( localize(12761, "Workspace Snippets"));
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
46
46
|
result.push({
|
|
@@ -53,13 +53,13 @@ async function pickSnippet(accessor, languageIdOrSnippets, resourceUri) {
|
|
|
53
53
|
if (isEnabled) {
|
|
54
54
|
pick.buttons = [{
|
|
55
55
|
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
56
|
-
tooltip: ( localize(
|
|
56
|
+
tooltip: ( localize(12762, "Hide from IntelliSense"))
|
|
57
57
|
}];
|
|
58
58
|
} else {
|
|
59
|
-
pick.description = ( localize(
|
|
59
|
+
pick.description = ( localize(12763, "(hidden from IntelliSense)"));
|
|
60
60
|
pick.buttons = [{
|
|
61
61
|
iconClass: ThemeIcon.asClassName(Codicon.eye),
|
|
62
|
-
tooltip: ( localize(
|
|
62
|
+
tooltip: ( localize(12764, "Show in IntelliSense"))
|
|
63
63
|
}];
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -72,7 +72,7 @@ async function pickSnippet(accessor, languageIdOrSnippets, resourceUri) {
|
|
|
72
72
|
const picker = disposables.add(quickInputService.createQuickPick({
|
|
73
73
|
useSeparators: true
|
|
74
74
|
}));
|
|
75
|
-
picker.placeholder = ( localize(
|
|
75
|
+
picker.placeholder = ( localize(12765, "Select a snippet"));
|
|
76
76
|
picker.matchOnDetail = true;
|
|
77
77
|
picker.ignoreFocusOut = false;
|
|
78
78
|
picker.keepScrollPosition = true;
|
|
@@ -83,7 +83,7 @@ async function pickSnippet(accessor, languageIdOrSnippets, resourceUri) {
|
|
|
83
83
|
}));
|
|
84
84
|
picker.items = makeSnippetPicks();
|
|
85
85
|
if (!picker.items.length) {
|
|
86
|
-
picker.validationMessage = ( localize(
|
|
86
|
+
picker.validationMessage = ( localize(12766, "No snippet available"));
|
|
87
87
|
}
|
|
88
88
|
picker.show();
|
|
89
89
|
await Promise.race([Event.toPromise(picker.onDidAccept), Event.toPromise(picker.onDidHide)]);
|
|
@@ -30,7 +30,7 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, Lifec
|
|
|
30
30
|
"properties": {
|
|
31
31
|
"editor.snippets.codeActions.enabled": {
|
|
32
32
|
"description": ( localize(
|
|
33
|
-
|
|
33
|
+
12767,
|
|
34
34
|
"Controls if surround-with-snippets or file template snippets show as Code Actions."
|
|
35
35
|
)),
|
|
36
36
|
"type": "boolean",
|
|
@@ -41,16 +41,16 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, Lifec
|
|
|
41
41
|
const languageScopeSchemaId = "vscode://schemas/snippets";
|
|
42
42
|
const snippetSchemaProperties = {
|
|
43
43
|
prefix: {
|
|
44
|
-
description: ( localize(
|
|
44
|
+
description: ( localize(12768, "The prefix to use when selecting the snippet in intellisense")),
|
|
45
45
|
type: ["string", "array"]
|
|
46
46
|
},
|
|
47
47
|
isFileTemplate: {
|
|
48
|
-
description: ( localize(
|
|
48
|
+
description: ( localize(12769, "The snippet is meant to populate or replace a whole file")),
|
|
49
49
|
type: "boolean"
|
|
50
50
|
},
|
|
51
51
|
body: {
|
|
52
52
|
markdownDescription: ( localize(
|
|
53
|
-
|
|
53
|
+
12770,
|
|
54
54
|
"The snippet content. Use `$1`, `${1:defaultText}` to define cursor positions, use `$0` for the final cursor position. Insert variable values with `${varName}` and `${varName:defaultText}`, e.g. `This is file: $TM_FILENAME`."
|
|
55
55
|
)),
|
|
56
56
|
type: ["string", "array"],
|
|
@@ -59,12 +59,12 @@ const snippetSchemaProperties = {
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
description: {
|
|
62
|
-
description: ( localize(
|
|
62
|
+
description: ( localize(12771, "The snippet description.")),
|
|
63
63
|
type: ["string", "array"]
|
|
64
64
|
},
|
|
65
65
|
include: {
|
|
66
66
|
markdownDescription: ( localize(
|
|
67
|
-
|
|
67
|
+
12772,
|
|
68
68
|
"A list of [glob patterns](https://aka.ms/vscode-glob-patterns) to include the snippet for specific files, e.g. `[\"**/*.test.ts\", \"*.spec.ts\"]` or `\"**/*.spec.ts\"`. Patterns will match on the absolute path of a file if they contain a path separator and will match on the name of the file otherwise. You can exclude matching files via the `exclude` property."
|
|
69
69
|
)),
|
|
70
70
|
type: ["string", "array"],
|
|
@@ -74,7 +74,7 @@ const snippetSchemaProperties = {
|
|
|
74
74
|
},
|
|
75
75
|
exclude: {
|
|
76
76
|
markdownDescription: ( localize(
|
|
77
|
-
|
|
77
|
+
12773,
|
|
78
78
|
"A list of [glob patterns](https://aka.ms/vscode-glob-patterns) to exclude the snippet from specific files, e.g. `[\"**/*.min.js\"]` or `\"*.min.js\"`. Patterns will match on the absolute path of a file if they contain a path separator and will match on the name of the file otherwise. Exclude patterns take precedence over `include` patterns."
|
|
79
79
|
)),
|
|
80
80
|
type: ["string", "array"],
|
|
@@ -88,7 +88,7 @@ const languageScopeSchema = {
|
|
|
88
88
|
allowComments: true,
|
|
89
89
|
allowTrailingCommas: true,
|
|
90
90
|
defaultSnippets: [{
|
|
91
|
-
label: ( localize(
|
|
91
|
+
label: ( localize(12774, "Empty snippet")),
|
|
92
92
|
body: {
|
|
93
93
|
"${1:snippetName}": {
|
|
94
94
|
"prefix": "${2:prefix}",
|
|
@@ -98,7 +98,7 @@ const languageScopeSchema = {
|
|
|
98
98
|
}
|
|
99
99
|
}],
|
|
100
100
|
type: "object",
|
|
101
|
-
description: ( localize(
|
|
101
|
+
description: ( localize(12775, "User snippet configuration")),
|
|
102
102
|
additionalProperties: {
|
|
103
103
|
type: "object",
|
|
104
104
|
required: ["body"],
|
|
@@ -112,7 +112,7 @@ const globalSchema = {
|
|
|
112
112
|
allowComments: true,
|
|
113
113
|
allowTrailingCommas: true,
|
|
114
114
|
defaultSnippets: [{
|
|
115
|
-
label: ( localize(
|
|
115
|
+
label: ( localize(12774, "Empty snippet")),
|
|
116
116
|
body: {
|
|
117
117
|
"${1:snippetName}": {
|
|
118
118
|
"scope": "${2:scope}",
|
|
@@ -123,7 +123,7 @@ const globalSchema = {
|
|
|
123
123
|
}
|
|
124
124
|
}],
|
|
125
125
|
type: "object",
|
|
126
|
-
description: ( localize(
|
|
126
|
+
description: ( localize(12775, "User snippet configuration")),
|
|
127
127
|
additionalProperties: {
|
|
128
128
|
type: "object",
|
|
129
129
|
required: ["body"],
|
|
@@ -131,7 +131,7 @@ const globalSchema = {
|
|
|
131
131
|
...snippetSchemaProperties,
|
|
132
132
|
scope: {
|
|
133
133
|
description: ( localize(
|
|
134
|
-
|
|
134
|
+
12776,
|
|
135
135
|
"A list of language names to which this snippet applies, e.g. 'typescript,javascript'."
|
|
136
136
|
)),
|
|
137
137
|
type: "string"
|