@codingame/monaco-vscode-snippets-service-override 23.2.2 → 24.1.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 +18 -18
- 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 +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-snippets-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.1.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": "24.1.0",
|
|
19
|
+
"@codingame/monaco-vscode-files-service-override": "24.1.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(10937, "Snippets")),
|
|
8
8
|
};
|
|
9
9
|
class SnippetsAction extends Action2 {
|
|
10
10
|
constructor(desc) {
|
|
@@ -59,15 +59,15 @@ async function computePicks(snippetService, userDataProfileService, languageServ
|
|
|
59
59
|
label: basename(file.location),
|
|
60
60
|
filepath: file.location,
|
|
61
61
|
description: names.size === 0
|
|
62
|
-
? ( localize(
|
|
63
|
-
: ( localize(
|
|
62
|
+
? ( localize(10938, "(global)"))
|
|
63
|
+
: ( localize(10939, "({0})", [...names].join(', ')))
|
|
64
64
|
};
|
|
65
65
|
existing.push(snippet);
|
|
66
66
|
if (!source) {
|
|
67
67
|
continue;
|
|
68
68
|
}
|
|
69
69
|
const detail = ( localize(
|
|
70
|
-
|
|
70
|
+
10940,
|
|
71
71
|
"({0}) {1}",
|
|
72
72
|
source,
|
|
73
73
|
labelService.getUriLabel(file.location, { relative: true })
|
|
@@ -129,16 +129,16 @@ async function createSnippetFile(scope, defaultPath, quickInputService, fileServ
|
|
|
129
129
|
}
|
|
130
130
|
await fileService.createFolder(defaultPath);
|
|
131
131
|
const input = await quickInputService.input({
|
|
132
|
-
placeHolder: ( localize(
|
|
132
|
+
placeHolder: ( localize(10941, "Type snippet file name")),
|
|
133
133
|
async validateInput(input) {
|
|
134
134
|
if (!input) {
|
|
135
|
-
return localize(
|
|
135
|
+
return localize(10942, "Invalid file name");
|
|
136
136
|
}
|
|
137
137
|
if (!isValidBasename(input)) {
|
|
138
|
-
return localize(
|
|
138
|
+
return localize(10943, "'{0}' is not a valid file name", input);
|
|
139
139
|
}
|
|
140
140
|
if (await fileService.exists(createSnippetUri(input))) {
|
|
141
|
-
return localize(
|
|
141
|
+
return localize(10944, "'{0}' already exists", input);
|
|
142
142
|
}
|
|
143
143
|
return undefined;
|
|
144
144
|
}
|
|
@@ -197,10 +197,10 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
197
197
|
constructor() {
|
|
198
198
|
super({
|
|
199
199
|
id: 'workbench.action.openSnippets',
|
|
200
|
-
title: ( localize2(
|
|
200
|
+
title: ( localize2(10945, "Configure Snippets")),
|
|
201
201
|
shortTitle: {
|
|
202
|
-
...( localize2(
|
|
203
|
-
mnemonicTitle: ( localize(
|
|
202
|
+
...( localize2(10946, "Snippets")),
|
|
203
|
+
mnemonicTitle: ( localize(10947, "&&Snippets")),
|
|
204
204
|
},
|
|
205
205
|
f1: true,
|
|
206
206
|
menu: [
|
|
@@ -222,27 +222,27 @@ class ConfigureSnippetsAction extends SnippetsAction {
|
|
|
222
222
|
const picks = await computePicks(snippetService, userDataProfileService, languageService, labelService);
|
|
223
223
|
const existing = picks.existing;
|
|
224
224
|
const globalSnippetPicks = [{
|
|
225
|
-
scope: ( localize(
|
|
226
|
-
label: ( localize(
|
|
225
|
+
scope: ( localize(10948, 'global')),
|
|
226
|
+
label: ( localize(10949, "New Global Snippets file...")),
|
|
227
227
|
uri: userDataProfileService.currentProfile.snippetsHome
|
|
228
228
|
}];
|
|
229
229
|
const workspaceSnippetPicks = [];
|
|
230
230
|
for (const folder of workspaceService.getWorkspace().folders) {
|
|
231
231
|
workspaceSnippetPicks.push({
|
|
232
|
-
scope: ( localize(
|
|
233
|
-
label: ( localize(
|
|
232
|
+
scope: ( localize(10950, "{0} workspace", folder.name)),
|
|
233
|
+
label: ( localize(10951, "New Snippets file for '{0}'...", folder.name)),
|
|
234
234
|
uri: folder.toResource('.vscode')
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
if (existing.length > 0) {
|
|
238
|
-
existing.unshift({ type: 'separator', label: ( localize(
|
|
239
|
-
existing.push({ type: 'separator', label: ( localize(
|
|
238
|
+
existing.unshift({ type: 'separator', label: ( localize(10952, "Existing Snippets")) });
|
|
239
|
+
existing.push({ type: 'separator', label: ( localize(10953, "New Snippets")) });
|
|
240
240
|
}
|
|
241
241
|
else {
|
|
242
|
-
existing.push({ type: 'separator', label: ( localize(
|
|
242
|
+
existing.push({ type: 'separator', label: ( localize(10953, "New Snippets")) });
|
|
243
243
|
}
|
|
244
244
|
const pick = await quickInputService.pick([].concat(existing, globalSnippetPicks, workspaceSnippetPicks, picks.future), {
|
|
245
|
-
placeHolder: ( localize(
|
|
245
|
+
placeHolder: ( localize(10954, "Select Snippets File or Create Snippets")),
|
|
246
246
|
matchOnDescription: true
|
|
247
247
|
});
|
|
248
248
|
if (globalSnippetPicks.indexOf(pick) >= 0) {
|
|
@@ -15,7 +15,7 @@ class ApplyFileSnippetAction extends SnippetsAction {
|
|
|
15
15
|
constructor() {
|
|
16
16
|
super({
|
|
17
17
|
id: ApplyFileSnippetAction.Id,
|
|
18
|
-
title: ( localize2(
|
|
18
|
+
title: ( localize2(10955, "Fill File with Snippet")),
|
|
19
19
|
f1: true,
|
|
20
20
|
});
|
|
21
21
|
}
|
|
@@ -77,7 +77,7 @@ class ApplyFileSnippetAction extends SnippetsAction {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
const pick = await quickInputService.pick(picks, {
|
|
80
|
-
placeHolder: ( localize(
|
|
80
|
+
placeHolder: ( localize(10956, 'Select a snippet')),
|
|
81
81
|
matchOnDetail: true,
|
|
82
82
|
});
|
|
83
83
|
return pick?.snippet;
|
|
@@ -38,7 +38,7 @@ class InsertSnippetAction extends SnippetEditorAction {
|
|
|
38
38
|
constructor() {
|
|
39
39
|
super({
|
|
40
40
|
id: 'editor.action.insertSnippet',
|
|
41
|
-
title: ( localize2(
|
|
41
|
+
title: ( localize2(10957, "Insert Snippet")),
|
|
42
42
|
f1: true,
|
|
43
43
|
precondition: EditorContextKeys.writable,
|
|
44
44
|
metadata: {
|
|
@@ -19,7 +19,7 @@ async function getSurroundableSnippets(snippetsService, model, position, include
|
|
|
19
19
|
class SurroundWithSnippetEditorAction extends SnippetEditorAction {
|
|
20
20
|
static { this.options = {
|
|
21
21
|
id: 'editor.action.surroundWithSnippet',
|
|
22
|
-
title: ( localize2(
|
|
22
|
+
title: ( localize2(10958, "Surround with Snippet..."))
|
|
23
23
|
}; }
|
|
24
24
|
constructor() {
|
|
25
25
|
super({
|
|
@@ -17,7 +17,7 @@ let SurroundWithSnippetCodeActionProvider = class SurroundWithSnippetCodeActionP
|
|
|
17
17
|
static { this._MAX_CODE_ACTIONS = 4; }
|
|
18
18
|
static { this._overflowCommandCodeAction = {
|
|
19
19
|
kind: CodeActionKind.SurroundWith.value,
|
|
20
|
-
title: ( localize(
|
|
20
|
+
title: ( localize(10959, "More...")),
|
|
21
21
|
command: {
|
|
22
22
|
id: SurroundWithSnippetEditorAction.options.id,
|
|
23
23
|
title: SurroundWithSnippetEditorAction.options.title.value,
|
|
@@ -42,7 +42,7 @@ let SurroundWithSnippetCodeActionProvider = class SurroundWithSnippetCodeActionP
|
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
actions.push({
|
|
45
|
-
title: ( localize(
|
|
45
|
+
title: ( localize(10960, "{0}", snippet.name)),
|
|
46
46
|
kind: CodeActionKind.SurroundWith.value,
|
|
47
47
|
edit: asWorkspaceEdit(model, range, snippet)
|
|
48
48
|
});
|
|
@@ -60,7 +60,7 @@ let FileTemplateCodeActionProvider = class FileTemplateCodeActionProvider {
|
|
|
60
60
|
static { FileTemplateCodeActionProvider_1 = this; }
|
|
61
61
|
static { this._MAX_CODE_ACTIONS = 4; }
|
|
62
62
|
static { this._overflowCommandCodeAction = {
|
|
63
|
-
title: ( localize(
|
|
63
|
+
title: ( localize(10961, 'Start with Snippet')),
|
|
64
64
|
kind: CodeActionKind.SurroundWith.value,
|
|
65
65
|
command: {
|
|
66
66
|
id: ApplyFileSnippetAction.Id,
|
|
@@ -83,7 +83,7 @@ let FileTemplateCodeActionProvider = class FileTemplateCodeActionProvider {
|
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
actions.push({
|
|
86
|
-
title: ( localize(
|
|
86
|
+
title: ( localize(10962, 'Start with: {0}', snippet.name)),
|
|
87
87
|
kind: CodeActionKind.SurroundWith.value,
|
|
88
88
|
edit: asWorkspaceEdit(model, model.getFullModelRange(), snippet)
|
|
89
89
|
});
|
|
@@ -32,13 +32,13 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
32
32
|
let label = '';
|
|
33
33
|
switch (snippet.snippetSource) {
|
|
34
34
|
case SnippetSource.User:
|
|
35
|
-
label = ( localize(
|
|
35
|
+
label = ( localize(10965, "User Snippets"));
|
|
36
36
|
break;
|
|
37
37
|
case SnippetSource.Extension:
|
|
38
38
|
label = snippet.source;
|
|
39
39
|
break;
|
|
40
40
|
case SnippetSource.Workspace:
|
|
41
|
-
label = ( localize(
|
|
41
|
+
label = ( localize(10966, "Workspace Snippets"));
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
result.push({ type: 'separator', label });
|
|
@@ -48,14 +48,14 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
48
48
|
if (isEnabled) {
|
|
49
49
|
pick.buttons = [{
|
|
50
50
|
iconClass: ThemeIcon.asClassName(Codicon.eyeClosed),
|
|
51
|
-
tooltip: ( localize(
|
|
51
|
+
tooltip: ( localize(10967, 'Hide from IntelliSense'))
|
|
52
52
|
}];
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
pick.description = ( localize(
|
|
55
|
+
pick.description = ( localize(10968, "(hidden from IntelliSense)"));
|
|
56
56
|
pick.buttons = [{
|
|
57
57
|
iconClass: ThemeIcon.asClassName(Codicon.eye),
|
|
58
|
-
tooltip: ( localize(
|
|
58
|
+
tooltip: ( localize(10969, 'Show in IntelliSense'))
|
|
59
59
|
}];
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -66,7 +66,7 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
66
66
|
};
|
|
67
67
|
const disposables = ( new DisposableStore());
|
|
68
68
|
const picker = disposables.add(quickInputService.createQuickPick({ useSeparators: true }));
|
|
69
|
-
picker.placeholder = ( localize(
|
|
69
|
+
picker.placeholder = ( localize(10970, "Select a snippet"));
|
|
70
70
|
picker.matchOnDetail = true;
|
|
71
71
|
picker.ignoreFocusOut = false;
|
|
72
72
|
picker.keepScrollPosition = true;
|
|
@@ -77,7 +77,7 @@ async function pickSnippet(accessor, languageIdOrSnippets) {
|
|
|
77
77
|
}));
|
|
78
78
|
picker.items = makeSnippetPicks();
|
|
79
79
|
if (!picker.items.length) {
|
|
80
|
-
picker.validationMessage = ( localize(
|
|
80
|
+
picker.validationMessage = ( localize(10971, "No snippet available"));
|
|
81
81
|
}
|
|
82
82
|
picker.show();
|
|
83
83
|
await Promise.race([Event.toPromise(picker.onDidAccept), Event.toPromise(picker.onDidHide)]);
|
|
@@ -32,7 +32,7 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, Lifec
|
|
|
32
32
|
'properties': {
|
|
33
33
|
'editor.snippets.codeActions.enabled': {
|
|
34
34
|
'description': ( localize(
|
|
35
|
-
|
|
35
|
+
10972,
|
|
36
36
|
'Controls if surround-with-snippets or file template snippets show as Code Actions.'
|
|
37
37
|
)),
|
|
38
38
|
'type': 'boolean',
|
|
@@ -43,16 +43,16 @@ workbenchContribRegistry.registerWorkbenchContribution(SnippetCodeActions, Lifec
|
|
|
43
43
|
const languageScopeSchemaId = 'vscode://schemas/snippets';
|
|
44
44
|
const snippetSchemaProperties = {
|
|
45
45
|
prefix: {
|
|
46
|
-
description: ( localize(
|
|
46
|
+
description: ( localize(10973, 'The prefix to use when selecting the snippet in intellisense')),
|
|
47
47
|
type: ['string', 'array']
|
|
48
48
|
},
|
|
49
49
|
isFileTemplate: {
|
|
50
|
-
description: ( localize(
|
|
50
|
+
description: ( localize(10974, 'The snippet is meant to populate or replace a whole file')),
|
|
51
51
|
type: 'boolean'
|
|
52
52
|
},
|
|
53
53
|
body: {
|
|
54
54
|
markdownDescription: ( localize(
|
|
55
|
-
|
|
55
|
+
10975,
|
|
56
56
|
'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`.'
|
|
57
57
|
)),
|
|
58
58
|
type: ['string', 'array'],
|
|
@@ -61,7 +61,7 @@ const snippetSchemaProperties = {
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
description: {
|
|
64
|
-
description: ( localize(
|
|
64
|
+
description: ( localize(10976, 'The snippet description.')),
|
|
65
65
|
type: ['string', 'array']
|
|
66
66
|
}
|
|
67
67
|
};
|
|
@@ -70,11 +70,11 @@ const languageScopeSchema = {
|
|
|
70
70
|
allowComments: true,
|
|
71
71
|
allowTrailingCommas: true,
|
|
72
72
|
defaultSnippets: [{
|
|
73
|
-
label: ( localize(
|
|
73
|
+
label: ( localize(10977, "Empty snippet")),
|
|
74
74
|
body: { '${1:snippetName}': { 'prefix': '${2:prefix}', 'body': '${3:snippet}', 'description': '${4:description}' } }
|
|
75
75
|
}],
|
|
76
76
|
type: 'object',
|
|
77
|
-
description: ( localize(
|
|
77
|
+
description: ( localize(10978, 'User snippet configuration')),
|
|
78
78
|
additionalProperties: {
|
|
79
79
|
type: 'object',
|
|
80
80
|
required: ['body'],
|
|
@@ -88,11 +88,11 @@ const globalSchema = {
|
|
|
88
88
|
allowComments: true,
|
|
89
89
|
allowTrailingCommas: true,
|
|
90
90
|
defaultSnippets: [{
|
|
91
|
-
label: ( localize(
|
|
91
|
+
label: ( localize(10977, "Empty snippet")),
|
|
92
92
|
body: { '${1:snippetName}': { 'scope': '${2:scope}', 'prefix': '${3:prefix}', 'body': '${4:snippet}', 'description': '${5:description}' } }
|
|
93
93
|
}],
|
|
94
94
|
type: 'object',
|
|
95
|
-
description: ( localize(
|
|
95
|
+
description: ( localize(10978, 'User snippet configuration')),
|
|
96
96
|
additionalProperties: {
|
|
97
97
|
type: 'object',
|
|
98
98
|
required: ['body'],
|
|
@@ -100,7 +100,7 @@ const globalSchema = {
|
|
|
100
100
|
...snippetSchemaProperties,
|
|
101
101
|
scope: {
|
|
102
102
|
description: ( localize(
|
|
103
|
-
|
|
103
|
+
10979,
|
|
104
104
|
"A list of language names to which this snippet applies, e.g. 'typescript,javascript'."
|
|
105
105
|
)),
|
|
106
106
|
type: 'string'
|