@codingame/monaco-vscode-snippets-service-override 10.1.0 → 10.1.2
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": "10.1.
|
|
3
|
+
"version": "10.1.2",
|
|
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@10.1.
|
|
30
|
-
"@codingame/monaco-vscode-files-service-override": "10.1.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@10.1.2",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "10.1.2"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -57,15 +57,15 @@ async function computePicks(snippetService, userDataProfileService, languageServ
|
|
|
57
57
|
label: basename(file.location),
|
|
58
58
|
filepath: file.location,
|
|
59
59
|
description: names.size === 0
|
|
60
|
-
? ( localize(
|
|
61
|
-
: ( localize(
|
|
60
|
+
? ( localize(6679, "(global)"))
|
|
61
|
+
: ( localize(6680, "({0})", [...names].join(', ')))
|
|
62
62
|
};
|
|
63
63
|
existing.push(snippet);
|
|
64
64
|
if (!source) {
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
const detail = ( localize(
|
|
68
|
-
|
|
68
|
+
6681,
|
|
69
69
|
"({0}) {1}",
|
|
70
70
|
source,
|
|
71
71
|
labelService.getUriLabel(file.location, { relative: true })
|
|
@@ -127,16 +127,16 @@ async function createSnippetFile(scope, defaultPath, quickInputService, fileServ
|
|
|
127
127
|
}
|
|
128
128
|
await fileService.createFolder(defaultPath);
|
|
129
129
|
const input = await quickInputService.input({
|
|
130
|
-
placeHolder: ( localize(
|
|
130
|
+
placeHolder: ( localize(6682, "Type snippet file name")),
|
|
131
131
|
async validateInput(input) {
|
|
132
132
|
if (!input) {
|
|
133
|
-
return ( localize(
|
|
133
|
+
return ( localize(6683, "Invalid file name"));
|
|
134
134
|
}
|
|
135
135
|
if (!isValidBasename(input)) {
|
|
136
|
-
return ( localize(
|
|
136
|
+
return ( localize(6684, "'{0}' is not a valid file name", input));
|
|
137
137
|
}
|
|
138
138
|
if (await fileService.exists(createSnippetUri(input))) {
|
|
139
|
-
return ( localize(
|
|
139
|
+
return ( localize(6685, "'{0}' already exists", input));
|
|
140
140
|
}
|
|
141
141
|
return undefined;
|
|
142
142
|
}
|
|
@@ -195,10 +195,10 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
195
195
|
constructor() {
|
|
196
196
|
super({
|
|
197
197
|
id: 'workbench.action.openSnippets',
|
|
198
|
-
title: ( localize2(
|
|
198
|
+
title: ( localize2(6686, "Configure Snippets")),
|
|
199
199
|
shortTitle: {
|
|
200
|
-
...( localize2(
|
|
201
|
-
mnemonicTitle: ( localize(
|
|
200
|
+
...( localize2(6687, "Snippets")),
|
|
201
|
+
mnemonicTitle: ( localize(6688, "&&Snippets")),
|
|
202
202
|
},
|
|
203
203
|
f1: true,
|
|
204
204
|
menu: [
|
|
@@ -220,27 +220,27 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
220
220
|
const picks = await computePicks(snippetService, userDataProfileService, languageService, labelService);
|
|
221
221
|
const existing = picks.existing;
|
|
222
222
|
const globalSnippetPicks = [{
|
|
223
|
-
scope: ( localize(
|
|
224
|
-
label: ( localize(
|
|
223
|
+
scope: ( localize(6689, 'global')),
|
|
224
|
+
label: ( localize(6690, "New Global Snippets file...")),
|
|
225
225
|
uri: userDataProfileService.currentProfile.snippetsHome
|
|
226
226
|
}];
|
|
227
227
|
const workspaceSnippetPicks = [];
|
|
228
228
|
for (const folder of workspaceService.getWorkspace().folders) {
|
|
229
229
|
workspaceSnippetPicks.push({
|
|
230
|
-
scope: ( localize(
|
|
231
|
-
label: ( localize(
|
|
230
|
+
scope: ( localize(6691, "{0} workspace", folder.name)),
|
|
231
|
+
label: ( localize(6692, "New Snippets file for '{0}'...", folder.name)),
|
|
232
232
|
uri: folder.toResource('.vscode')
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
235
|
if (existing.length > 0) {
|
|
236
|
-
existing.unshift({ type: 'separator', label: ( localize(
|
|
237
|
-
existing.push({ type: 'separator', label: ( localize(
|
|
236
|
+
existing.unshift({ type: 'separator', label: ( localize(6693, "Existing Snippets")) });
|
|
237
|
+
existing.push({ type: 'separator', label: ( localize(6694, "New Snippets")) });
|
|
238
238
|
}
|
|
239
239
|
else {
|
|
240
|
-
existing.push({ type: 'separator', label: ( localize(
|
|
240
|
+
existing.push({ type: 'separator', label: ( localize(6694, "New Snippets")) });
|
|
241
241
|
}
|
|
242
242
|
const pick = await quickInputService.pick([].concat(existing, globalSnippetPicks, workspaceSnippetPicks, picks.future), {
|
|
243
|
-
placeHolder: ( localize(
|
|
243
|
+
placeHolder: ( localize(6695, "Select Snippets File or Create Snippets")),
|
|
244
244
|
matchOnDescription: true
|
|
245
245
|
});
|
|
246
246
|
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(6698, "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(6699, "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(6700, "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(6701, "{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(6702, '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(6703, '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 1 :
|
|
33
|
-
label = ( localize(
|
|
33
|
+
label = ( localize(10656, "User Snippets"));
|
|
34
34
|
break;
|
|
35
35
|
case 3 :
|
|
36
36
|
label = snippet.source;
|
|
37
37
|
break;
|
|
38
38
|
case 2 :
|
|
39
|
-
label = ( localize(
|
|
39
|
+
label = ( localize(10657, "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(10658, 'Hide from IntelliSense'))
|
|
50
50
|
}];
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
pick.description = ( localize(
|
|
53
|
+
pick.description = ( localize(10659, "(hidden from IntelliSense)"));
|
|
54
54
|
pick.buttons = [{
|
|
55
55
|
iconClass: ThemeIcon.asClassName(Codicon.eye),
|
|
56
|
-
tooltip: ( localize(
|
|
56
|
+
tooltip: ( localize(10660, 'Show in IntelliSense'))
|
|
57
57
|
}];
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -64,7 +64,7 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
64
64
|
};
|
|
65
65
|
const disposables = ( (new DisposableStore()));
|
|
66
66
|
const picker = disposables.add(quickInputService.createQuickPick({ useSeparators: true }));
|
|
67
|
-
picker.placeholder = ( localize(
|
|
67
|
+
picker.placeholder = ( localize(10661, "Select a snippet"));
|
|
68
68
|
picker.matchOnDetail = true;
|
|
69
69
|
picker.ignoreFocusOut = false;
|
|
70
70
|
picker.keepScrollPosition = true;
|
|
@@ -75,7 +75,7 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
75
75
|
}));
|
|
76
76
|
picker.items = makeSnippetPicks();
|
|
77
77
|
if (!picker.items.length) {
|
|
78
|
-
picker.validationMessage = ( localize(
|
|
78
|
+
picker.validationMessage = ( localize(10662, "No snippet available"));
|
|
79
79
|
}
|
|
80
80
|
picker.show();
|
|
81
81
|
await Promise.race([Event.toPromise(picker.onDidAccept), Event.toPromise(picker.onDidHide)]);
|
|
@@ -29,7 +29,7 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, 3 );
|
|
|
29
29
|
'properties': {
|
|
30
30
|
'editor.snippets.codeActions.enabled': {
|
|
31
31
|
'description': ( localize(
|
|
32
|
-
|
|
32
|
+
2985,
|
|
33
33
|
'Controls if surround-with-snippets or file template snippets show as Code Actions.'
|
|
34
34
|
)),
|
|
35
35
|
'type': 'boolean',
|
|
@@ -40,16 +40,16 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, 3 );
|
|
|
40
40
|
const languageScopeSchemaId = 'vscode://schemas/snippets';
|
|
41
41
|
const snippetSchemaProperties = {
|
|
42
42
|
prefix: {
|
|
43
|
-
description: ( localize(
|
|
43
|
+
description: ( localize(2986, 'The prefix to use when selecting the snippet in intellisense')),
|
|
44
44
|
type: ['string', 'array']
|
|
45
45
|
},
|
|
46
46
|
isFileTemplate: {
|
|
47
|
-
description: ( localize(
|
|
47
|
+
description: ( localize(2987, 'The snippet is meant to populate or replace a whole file')),
|
|
48
48
|
type: 'boolean'
|
|
49
49
|
},
|
|
50
50
|
body: {
|
|
51
51
|
markdownDescription: ( localize(
|
|
52
|
-
|
|
52
|
+
2988,
|
|
53
53
|
'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`.'
|
|
54
54
|
)),
|
|
55
55
|
type: ['string', 'array'],
|
|
@@ -58,7 +58,7 @@ const snippetSchemaProperties = {
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
description: {
|
|
61
|
-
description: ( localize(
|
|
61
|
+
description: ( localize(2989, 'The snippet description.')),
|
|
62
62
|
type: ['string', 'array']
|
|
63
63
|
}
|
|
64
64
|
};
|
|
@@ -67,11 +67,11 @@ const languageScopeSchema = {
|
|
|
67
67
|
allowComments: true,
|
|
68
68
|
allowTrailingCommas: true,
|
|
69
69
|
defaultSnippets: [{
|
|
70
|
-
label: ( localize(
|
|
70
|
+
label: ( localize(2990, "Empty snippet")),
|
|
71
71
|
body: { '${1:snippetName}': { 'prefix': '${2:prefix}', 'body': '${3:snippet}', 'description': '${4:description}' } }
|
|
72
72
|
}],
|
|
73
73
|
type: 'object',
|
|
74
|
-
description: ( localize(
|
|
74
|
+
description: ( localize(2991, 'User snippet configuration')),
|
|
75
75
|
additionalProperties: {
|
|
76
76
|
type: 'object',
|
|
77
77
|
required: ['body'],
|
|
@@ -85,11 +85,11 @@ const globalSchema = {
|
|
|
85
85
|
allowComments: true,
|
|
86
86
|
allowTrailingCommas: true,
|
|
87
87
|
defaultSnippets: [{
|
|
88
|
-
label: ( localize(
|
|
88
|
+
label: ( localize(2990, "Empty snippet")),
|
|
89
89
|
body: { '${1:snippetName}': { 'scope': '${2:scope}', 'prefix': '${3:prefix}', 'body': '${4:snippet}', 'description': '${5:description}' } }
|
|
90
90
|
}],
|
|
91
91
|
type: 'object',
|
|
92
|
-
description: ( localize(
|
|
92
|
+
description: ( localize(2991, 'User snippet configuration')),
|
|
93
93
|
additionalProperties: {
|
|
94
94
|
type: 'object',
|
|
95
95
|
required: ['body'],
|
|
@@ -97,7 +97,7 @@ const globalSchema = {
|
|
|
97
97
|
...snippetSchemaProperties,
|
|
98
98
|
scope: {
|
|
99
99
|
description: ( localize(
|
|
100
|
-
|
|
100
|
+
2992,
|
|
101
101
|
"A list of language names to which this snippet applies, e.g. 'typescript,javascript'."
|
|
102
102
|
)),
|
|
103
103
|
type: 'string'
|