@codingame/monaco-vscode-snippets-service-override 8.0.2 → 8.0.3
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/configureSnippets.js +18 -18
- 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 +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-snippets-service-override",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.3",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@8.0.
|
|
30
|
-
"@codingame/monaco-vscode-files-service-override": "8.0.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@8.0.3",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "8.0.3"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -58,15 +58,15 @@ async function computePicks(snippetService, userDataProfileService, languageServ
|
|
|
58
58
|
label: basename(file.location),
|
|
59
59
|
filepath: file.location,
|
|
60
60
|
description: names.size === 0
|
|
61
|
-
? ( localize(
|
|
62
|
-
: ( localize(
|
|
61
|
+
? ( localize(6750, "(global)"))
|
|
62
|
+
: ( localize(6751, "({0})", [...names].join(', ')))
|
|
63
63
|
};
|
|
64
64
|
existing.push(snippet);
|
|
65
65
|
if (!source) {
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
68
|
const detail = ( localize(
|
|
69
|
-
|
|
69
|
+
6752,
|
|
70
70
|
"({0}) {1}",
|
|
71
71
|
source,
|
|
72
72
|
labelService.getUriLabel(file.location, { relative: true })
|
|
@@ -128,16 +128,16 @@ async function createSnippetFile(scope, defaultPath, quickInputService, fileServ
|
|
|
128
128
|
}
|
|
129
129
|
await fileService.createFolder(defaultPath);
|
|
130
130
|
const input = await quickInputService.input({
|
|
131
|
-
placeHolder: ( localize(
|
|
131
|
+
placeHolder: ( localize(6753, "Type snippet file name")),
|
|
132
132
|
async validateInput(input) {
|
|
133
133
|
if (!input) {
|
|
134
|
-
return ( localize(
|
|
134
|
+
return ( localize(6754, "Invalid file name"));
|
|
135
135
|
}
|
|
136
136
|
if (!isValidBasename(input)) {
|
|
137
|
-
return ( localize(
|
|
137
|
+
return ( localize(6755, "'{0}' is not a valid file name", input));
|
|
138
138
|
}
|
|
139
139
|
if (await fileService.exists(createSnippetUri(input))) {
|
|
140
|
-
return ( localize(
|
|
140
|
+
return ( localize(6756, "'{0}' already exists", input));
|
|
141
141
|
}
|
|
142
142
|
return undefined;
|
|
143
143
|
}
|
|
@@ -196,10 +196,10 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
196
196
|
constructor() {
|
|
197
197
|
super({
|
|
198
198
|
id: 'workbench.action.openSnippets',
|
|
199
|
-
title: ( localize2(
|
|
199
|
+
title: ( localize2(6757, "Configure Snippets")),
|
|
200
200
|
shortTitle: {
|
|
201
|
-
...( localize2(
|
|
202
|
-
mnemonicTitle: ( localize(
|
|
201
|
+
...( localize2(6758, "Snippets")),
|
|
202
|
+
mnemonicTitle: ( localize(6759, "&&Snippets")),
|
|
203
203
|
},
|
|
204
204
|
f1: true,
|
|
205
205
|
menu: [
|
|
@@ -221,27 +221,27 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
221
221
|
const picks = await computePicks(snippetService, userDataProfileService, languageService, labelService);
|
|
222
222
|
const existing = picks.existing;
|
|
223
223
|
const globalSnippetPicks = [{
|
|
224
|
-
scope: ( localize(
|
|
225
|
-
label: ( localize(
|
|
224
|
+
scope: ( localize(6760, 'global')),
|
|
225
|
+
label: ( localize(6761, "New Global Snippets file...")),
|
|
226
226
|
uri: userDataProfileService.currentProfile.snippetsHome
|
|
227
227
|
}];
|
|
228
228
|
const workspaceSnippetPicks = [];
|
|
229
229
|
for (const folder of workspaceService.getWorkspace().folders) {
|
|
230
230
|
workspaceSnippetPicks.push({
|
|
231
|
-
scope: ( localize(
|
|
232
|
-
label: ( localize(
|
|
231
|
+
scope: ( localize(6762, "{0} workspace", folder.name)),
|
|
232
|
+
label: ( localize(6763, "New Snippets file for '{0}'...", folder.name)),
|
|
233
233
|
uri: folder.toResource('.vscode')
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
236
|
if (existing.length > 0) {
|
|
237
|
-
existing.unshift({ type: 'separator', label: ( localize(
|
|
238
|
-
existing.push({ type: 'separator', label: ( localize(
|
|
237
|
+
existing.unshift({ type: 'separator', label: ( localize(6764, "Existing Snippets")) });
|
|
238
|
+
existing.push({ type: 'separator', label: ( localize(6765, "New Snippets")) });
|
|
239
239
|
}
|
|
240
240
|
else {
|
|
241
|
-
existing.push({ type: 'separator', label: ( localize(
|
|
241
|
+
existing.push({ type: 'separator', label: ( localize(6765, "New Snippets")) });
|
|
242
242
|
}
|
|
243
243
|
const pick = await quickInputService.pick([].concat(existing, globalSnippetPicks, workspaceSnippetPicks, picks.future), {
|
|
244
|
-
placeHolder: ( localize(
|
|
244
|
+
placeHolder: ( localize(6766, "Select Snippets File or Create Snippets")),
|
|
245
245
|
matchOnDescription: true
|
|
246
246
|
});
|
|
247
247
|
if (globalSnippetPicks.indexOf(pick) >= 0) {
|
|
@@ -39,7 +39,7 @@ class InsertSnippetAction extends SnippetEditorAction {
|
|
|
39
39
|
constructor() {
|
|
40
40
|
super({
|
|
41
41
|
id: 'editor.action.insertSnippet',
|
|
42
|
-
title: ( localize2(
|
|
42
|
+
title: ( localize2(6769, "Insert Snippet")),
|
|
43
43
|
f1: true,
|
|
44
44
|
precondition: EditorContextKeys.writable,
|
|
45
45
|
metadata: {
|
|
@@ -18,7 +18,7 @@ async function getSurroundableSnippets(snippetsService, model, position, include
|
|
|
18
18
|
class SurroundWithSnippetEditorAction extends SnippetEditorAction {
|
|
19
19
|
static { this.options = {
|
|
20
20
|
id: 'editor.action.surroundWithSnippet',
|
|
21
|
-
title: ( localize2(
|
|
21
|
+
title: ( localize2(6770, "Surround with Snippet..."))
|
|
22
22
|
}; }
|
|
23
23
|
constructor() {
|
|
24
24
|
super({
|
|
@@ -16,7 +16,7 @@ let SurroundWithSnippetCodeActionProvider = class SurroundWithSnippetCodeActionP
|
|
|
16
16
|
static { this._MAX_CODE_ACTIONS = 4; }
|
|
17
17
|
static { this._overflowCommandCodeAction = {
|
|
18
18
|
kind: CodeActionKind.SurroundWith.value,
|
|
19
|
-
title: ( localize(
|
|
19
|
+
title: ( localize(6771, "More...")),
|
|
20
20
|
command: {
|
|
21
21
|
id: SurroundWithSnippetEditorAction.options.id,
|
|
22
22
|
title: SurroundWithSnippetEditorAction.options.title.value,
|
|
@@ -41,7 +41,7 @@ let SurroundWithSnippetCodeActionProvider = class SurroundWithSnippetCodeActionP
|
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
actions.push({
|
|
44
|
-
title: ( localize(
|
|
44
|
+
title: ( localize(6772, "{0}", snippet.name)),
|
|
45
45
|
kind: CodeActionKind.SurroundWith.value,
|
|
46
46
|
edit: asWorkspaceEdit(model, range, snippet)
|
|
47
47
|
});
|
|
@@ -59,7 +59,7 @@ let FileTemplateCodeActionProvider = class FileTemplateCodeActionProvider {
|
|
|
59
59
|
static { FileTemplateCodeActionProvider_1 = this; }
|
|
60
60
|
static { this._MAX_CODE_ACTIONS = 4; }
|
|
61
61
|
static { this._overflowCommandCodeAction = {
|
|
62
|
-
title: ( localize(
|
|
62
|
+
title: ( localize(6773, 'Start with Snippet')),
|
|
63
63
|
kind: CodeActionKind.SurroundWith.value,
|
|
64
64
|
command: {
|
|
65
65
|
id: ApplyFileSnippetAction.Id,
|
|
@@ -82,7 +82,7 @@ let FileTemplateCodeActionProvider = class FileTemplateCodeActionProvider {
|
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
actions.push({
|
|
85
|
-
title: ( localize(
|
|
85
|
+
title: ( localize(6774, 'Start with: {0}', snippet.name)),
|
|
86
86
|
kind: CodeActionKind.SurroundWith.value,
|
|
87
87
|
edit: asWorkspaceEdit(model, model.getFullModelRange(), snippet)
|
|
88
88
|
});
|
|
@@ -30,13 +30,13 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
30
30
|
let label = '';
|
|
31
31
|
switch (snippet.snippetSource) {
|
|
32
32
|
case SnippetSource.User:
|
|
33
|
-
label = ( localize(
|
|
33
|
+
label = ( localize(10532, "User Snippets"));
|
|
34
34
|
break;
|
|
35
35
|
case SnippetSource.Extension:
|
|
36
36
|
label = snippet.source;
|
|
37
37
|
break;
|
|
38
38
|
case SnippetSource.Workspace:
|
|
39
|
-
label = ( localize(
|
|
39
|
+
label = ( localize(10533, "Workspace Snippets"));
|
|
40
40
|
break;
|
|
41
41
|
}
|
|
42
42
|
result.push({ type: 'separator', label });
|
|
@@ -46,14 +46,14 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
46
46
|
if (isEnabled) {
|
|
47
47
|
pick.buttons = [{
|
|
48
48
|
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
49
|
-
tooltip: ( localize(
|
|
49
|
+
tooltip: ( localize(10534, 'Hide from IntelliSense'))
|
|
50
50
|
}];
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
pick.description = ( localize(
|
|
53
|
+
pick.description = ( localize(10535, "(hidden from IntelliSense)"));
|
|
54
54
|
pick.buttons = [{
|
|
55
55
|
iconClass: ThemeIcon.asClassName(Codicon.eye),
|
|
56
|
-
tooltip: ( localize(
|
|
56
|
+
tooltip: ( localize(10536, 'Show in IntelliSense'))
|
|
57
57
|
}];
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -63,7 +63,7 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
63
63
|
return result;
|
|
64
64
|
};
|
|
65
65
|
const picker = quickInputService.createQuickPick();
|
|
66
|
-
picker.placeholder = ( localize(
|
|
66
|
+
picker.placeholder = ( localize(10537, "Select a snippet"));
|
|
67
67
|
picker.matchOnDetail = true;
|
|
68
68
|
picker.ignoreFocusOut = false;
|
|
69
69
|
picker.keepScrollPosition = true;
|
|
@@ -74,7 +74,7 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
74
74
|
});
|
|
75
75
|
picker.items = makeSnippetPicks();
|
|
76
76
|
if (!picker.items.length) {
|
|
77
|
-
picker.validationMessage = ( localize(
|
|
77
|
+
picker.validationMessage = ( localize(10538, "No snippet available"));
|
|
78
78
|
}
|
|
79
79
|
picker.show();
|
|
80
80
|
await Promise.race([Event.toPromise(picker.onDidAccept), Event.toPromise(picker.onDidHide)]);
|
|
@@ -31,7 +31,7 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, Lifec
|
|
|
31
31
|
'properties': {
|
|
32
32
|
'editor.snippets.codeActions.enabled': {
|
|
33
33
|
'description': ( localize(
|
|
34
|
-
|
|
34
|
+
3000,
|
|
35
35
|
'Controls if surround-with-snippets or file template snippets show as Code Actions.'
|
|
36
36
|
)),
|
|
37
37
|
'type': 'boolean',
|
|
@@ -42,16 +42,16 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, Lifec
|
|
|
42
42
|
const languageScopeSchemaId = 'vscode://schemas/snippets';
|
|
43
43
|
const snippetSchemaProperties = {
|
|
44
44
|
prefix: {
|
|
45
|
-
description: ( localize(
|
|
45
|
+
description: ( localize(3001, 'The prefix to use when selecting the snippet in intellisense')),
|
|
46
46
|
type: ['string', 'array']
|
|
47
47
|
},
|
|
48
48
|
isFileTemplate: {
|
|
49
|
-
description: ( localize(
|
|
49
|
+
description: ( localize(3002, 'The snippet is meant to populate or replace a whole file')),
|
|
50
50
|
type: 'boolean'
|
|
51
51
|
},
|
|
52
52
|
body: {
|
|
53
53
|
markdownDescription: ( localize(
|
|
54
|
-
|
|
54
|
+
3003,
|
|
55
55
|
'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`.'
|
|
56
56
|
)),
|
|
57
57
|
type: ['string', 'array'],
|
|
@@ -60,7 +60,7 @@ const snippetSchemaProperties = {
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
description: {
|
|
63
|
-
description: ( localize(
|
|
63
|
+
description: ( localize(3004, 'The snippet description.')),
|
|
64
64
|
type: ['string', 'array']
|
|
65
65
|
}
|
|
66
66
|
};
|
|
@@ -69,11 +69,11 @@ const languageScopeSchema = {
|
|
|
69
69
|
allowComments: true,
|
|
70
70
|
allowTrailingCommas: true,
|
|
71
71
|
defaultSnippets: [{
|
|
72
|
-
label: ( localize(
|
|
72
|
+
label: ( localize(3005, "Empty snippet")),
|
|
73
73
|
body: { '${1:snippetName}': { 'prefix': '${2:prefix}', 'body': '${3:snippet}', 'description': '${4:description}' } }
|
|
74
74
|
}],
|
|
75
75
|
type: 'object',
|
|
76
|
-
description: ( localize(
|
|
76
|
+
description: ( localize(3006, 'User snippet configuration')),
|
|
77
77
|
additionalProperties: {
|
|
78
78
|
type: 'object',
|
|
79
79
|
required: ['body'],
|
|
@@ -87,11 +87,11 @@ const globalSchema = {
|
|
|
87
87
|
allowComments: true,
|
|
88
88
|
allowTrailingCommas: true,
|
|
89
89
|
defaultSnippets: [{
|
|
90
|
-
label: ( localize(
|
|
90
|
+
label: ( localize(3005, "Empty snippet")),
|
|
91
91
|
body: { '${1:snippetName}': { 'scope': '${2:scope}', 'prefix': '${3:prefix}', 'body': '${4:snippet}', 'description': '${5:description}' } }
|
|
92
92
|
}],
|
|
93
93
|
type: 'object',
|
|
94
|
-
description: ( localize(
|
|
94
|
+
description: ( localize(3006, 'User snippet configuration')),
|
|
95
95
|
additionalProperties: {
|
|
96
96
|
type: 'object',
|
|
97
97
|
required: ['body'],
|
|
@@ -99,7 +99,7 @@ const globalSchema = {
|
|
|
99
99
|
...snippetSchemaProperties,
|
|
100
100
|
scope: {
|
|
101
101
|
description: ( localize(
|
|
102
|
-
|
|
102
|
+
3007,
|
|
103
103
|
"A list of language names to which this snippet applies, e.g. 'typescript,javascript'."
|
|
104
104
|
)),
|
|
105
105
|
type: 'string'
|