@innovatorved/code-lab 0.5.0 → 0.6.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/ARCHITECTURE.md +3 -3
- package/CHANGELOG.md +23 -0
- package/README.md +3 -3
- package/dist/code-lab-sql.css +87 -64
- package/dist/code-lab-sql.esm.js +109 -86
- package/dist/code-lab-sql.umd.js +110 -87
- package/dist/code-lab.css +32 -7273
- package/dist/code-lab.d.ts +1 -1
- package/dist/code-lab.esm.js +4966 -74622
- package/dist/code-lab.js +4974 -74631
- package/dist/code-lab.umd.js +4974 -74631
- package/dist/extensions/cpp.d.ts +2 -2
- package/dist/extensions/cpp.esm.js +1788 -14707
- package/dist/extensions/cpp.js +1788 -14707
- package/dist/extensions/guided-lab.esm.js +2938 -16127
- package/dist/extensions/guided-lab.js +2938 -16127
- package/dist/extensions/python.d.ts +2 -2
- package/dist/extensions/python.esm.js +1769 -14701
- package/dist/extensions/python.js +1769 -14701
- package/dist/index.d.ts +1 -1
- package/dist/packages/sql/src/styles.d.ts +1 -1
- package/dist/packages/ui/src/settings-dialog.d.ts +2 -0
- package/dist/preview-sw.js +4 -188
- package/dist/runtime.esm.js +109 -10284
- package/dist/runtime.js +107 -10284
- package/dist/schemas.d.ts +2 -2
- package/dist/schemas.esm.js +2938 -16127
- package/dist/schemas.js +2941 -16130
- package/dist/scm.d.ts +221 -20
- package/dist/shell.esm.js +811 -10002
- package/dist/shell.js +811 -10002
- package/dist/storage.d.ts +9 -0
- package/dist/terminal.esm.js +20 -1347
- package/dist/terminal.js +20 -1347
- package/dist/workbench/command-palette.d.ts +16 -1
- package/dist/workbench/diff-editor.d.ts +27 -1
- package/dist/workbench/icons.d.ts +6 -2
- package/dist/workbench/index.d.ts +33 -1
- package/dist/workbench/intellisense.d.ts +194 -0
- package/dist/workbench/styles.d.ts +1 -1
- package/dist/workbench/xterm-adapter.d.ts +122 -0
- package/package.json +7 -1
- package/packages/commands/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/editor/package.json +1 -1
- package/packages/fs/package.json +1 -1
- package/packages/preview/package.json +1 -1
- package/packages/runtime/package.json +1 -1
- package/packages/settings/package.json +1 -1
- package/packages/sql/package.json +1 -1
- package/packages/sql/src/styles.ts +87 -64
- package/packages/terminal/package.json +1 -1
- package/packages/ui/package.json +1 -1
- package/packages/ui/src/observability.ts +12 -14
- package/packages/ui/src/settings-dialog.ts +383 -47
- package/packages/ui/src/themes.ts +89 -23
- package/src/code-lab.css +1883 -578
- package/src/extensions/cpp.ts +304 -38
- package/src/extensions/python.ts +342 -43
- package/src/index.ts +1 -1
- package/src/runtime.ts +272 -43
- package/src/schemas.ts +2 -2
- package/src/scm.ts +1467 -92
- package/src/shell.ts +1075 -93
- package/src/storage.ts +66 -3
- package/src/terminal.ts +148 -12
- package/src/workbench/command-palette.ts +289 -48
- package/src/workbench/diff-editor.ts +244 -78
- package/src/workbench/drawer.ts +5 -5
- package/src/workbench/icons.ts +250 -53
- package/src/workbench/index.ts +7 -1
- package/src/workbench/intellisense.ts +1871 -0
- package/src/workbench/styles.ts +58 -54
- package/src/workbench/toolbar.ts +1 -1
- package/src/workbench/xterm-adapter.ts +1571 -0
- package/src/workbench.ts +1699 -324
|
@@ -1,23 +1,113 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @innovatorved/code-lab — Fuzzy
|
|
2
|
+
* @innovatorved/code-lab — VS Code Quick Open & Fuzzy Command Palette (Cmd+P / Cmd+Shift+P / F1)
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { CL_ICONS } from './icons';
|
|
6
|
-
|
|
7
5
|
export interface CommandPaletteItem {
|
|
8
6
|
id: string;
|
|
9
7
|
label: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
detail?: string;
|
|
10
10
|
shortcut?: string;
|
|
11
11
|
action: () => void;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export interface FuzzyMatchResult {
|
|
15
|
+
score: number;
|
|
16
|
+
indices: number[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function escapeHtml(str: unknown): string {
|
|
20
|
+
return String(str ?? '')
|
|
21
|
+
.replace(/&/g, '&')
|
|
22
|
+
.replace(/</g, '<')
|
|
23
|
+
.replace(/>/g, '>')
|
|
24
|
+
.replace(/"/g, '"')
|
|
25
|
+
.replace(/'/g, ''');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* VS Code-style subsequence fuzzy matcher with bonuses for consecutive matches,
|
|
30
|
+
* word-boundary / camelCase transitions, and prefix alignment.
|
|
31
|
+
*/
|
|
32
|
+
export function fuzzyScoreText(query: string, candidate: string): FuzzyMatchResult | null {
|
|
33
|
+
const q = String(query || '').trim();
|
|
34
|
+
const text = String(candidate || '');
|
|
35
|
+
if (!q) return { score: 1, indices: [] };
|
|
36
|
+
if (!text) return null;
|
|
37
|
+
|
|
38
|
+
const qLower = q.toLowerCase();
|
|
39
|
+
const tLower = text.toLowerCase();
|
|
40
|
+
|
|
41
|
+
const indices: number[] = [];
|
|
42
|
+
let qi = 0;
|
|
43
|
+
let score = 0;
|
|
44
|
+
let prevMatchIdx = -2;
|
|
45
|
+
|
|
46
|
+
for (let ti = 0; ti < text.length && qi < qLower.length; ti++) {
|
|
47
|
+
if (tLower[ti] === qLower[qi]) {
|
|
48
|
+
indices.push(ti);
|
|
49
|
+
score += 10;
|
|
50
|
+
|
|
51
|
+
// Consecutive match bonus
|
|
52
|
+
if (ti === prevMatchIdx + 1) {
|
|
53
|
+
score += 14;
|
|
54
|
+
}
|
|
55
|
+
// Prefix match bonus
|
|
56
|
+
if (ti === 0) {
|
|
57
|
+
score += 18;
|
|
58
|
+
} else {
|
|
59
|
+
const prev = text[ti - 1];
|
|
60
|
+
const curr = text[ti];
|
|
61
|
+
// Path separator / word boundary / camelCase transition bonus
|
|
62
|
+
if (prev === '/' || prev === '-' || prev === '_' || prev === ' ' || prev === ':' || prev === '.') {
|
|
63
|
+
score += 12;
|
|
64
|
+
} else if (prev >= 'a' && prev <= 'z' && curr >= 'A' && curr <= 'Z') {
|
|
65
|
+
score += 10;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
prevMatchIdx = ti;
|
|
70
|
+
qi++;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (qi < qLower.length) return null;
|
|
75
|
+
|
|
76
|
+
// Slightly prefer shorter, tighter matches
|
|
77
|
+
score -= Math.min(20, Math.floor((text.length - q.length) * 0.25));
|
|
78
|
+
return { score, indices };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Renders HTML with `<mark class="codelab-palette-hl">` around matched subsequence characters.
|
|
83
|
+
*/
|
|
84
|
+
export function renderHighlightedText(text: string, indices: number[]): string {
|
|
85
|
+
if (!indices || indices.length === 0) return escapeHtml(text);
|
|
86
|
+
const matchSet = new Set(indices);
|
|
87
|
+
let html = '';
|
|
88
|
+
let inMark = false;
|
|
89
|
+
for (let i = 0; i < text.length; i++) {
|
|
90
|
+
const isHit = matchSet.has(i);
|
|
91
|
+
if (isHit && !inMark) {
|
|
92
|
+
html += '<mark class="codelab-palette-hl">';
|
|
93
|
+
inMark = true;
|
|
94
|
+
} else if (!isHit && inMark) {
|
|
95
|
+
html += '</mark>';
|
|
96
|
+
inMark = false;
|
|
97
|
+
}
|
|
98
|
+
html += escapeHtml(text[i]);
|
|
99
|
+
}
|
|
100
|
+
if (inMark) html += '</mark>';
|
|
101
|
+
return html;
|
|
102
|
+
}
|
|
103
|
+
|
|
14
104
|
export function getStandardWorkbenchCommands(workbench: any): CommandPaletteItem[] {
|
|
15
105
|
const isGuided = Boolean(workbench.hasGuidedLab && workbench.mode === 'guided');
|
|
16
106
|
|
|
17
|
-
|
|
107
|
+
const commands: CommandPaletteItem[] = [
|
|
18
108
|
{
|
|
19
109
|
id: 'run-code',
|
|
20
|
-
label: isGuided ? 'CodeLab: Verify Current Guided Step' : '
|
|
110
|
+
label: isGuided ? 'CodeLab: Verify Current Guided Step' : 'Run: Run Active File',
|
|
21
111
|
shortcut: '⌘↵',
|
|
22
112
|
action: () => {
|
|
23
113
|
if (isGuided) workbench.verifyCurrentStep();
|
|
@@ -32,49 +122,83 @@ export function getStandardWorkbenchCommands(workbench: any): CommandPaletteItem
|
|
|
32
122
|
},
|
|
33
123
|
{
|
|
34
124
|
id: 'run-tests',
|
|
35
|
-
label: '
|
|
125
|
+
label: 'Test: Run Unit Tests',
|
|
36
126
|
shortcut: '⌘↵',
|
|
37
127
|
action: () => workbench.runTests()
|
|
38
128
|
},
|
|
39
129
|
{
|
|
40
130
|
id: 'format-document',
|
|
41
|
-
label: 'Format
|
|
131
|
+
label: 'Format Document',
|
|
132
|
+
category: 'Editor',
|
|
42
133
|
shortcut: '⇧⌥F',
|
|
43
134
|
action: () => workbench.formatActiveDocument()
|
|
44
135
|
},
|
|
45
136
|
{
|
|
46
|
-
id: '
|
|
47
|
-
label: '
|
|
48
|
-
|
|
137
|
+
id: 'view-toggle-panel',
|
|
138
|
+
label: 'View: Toggle Panel',
|
|
139
|
+
shortcut: '⌘J',
|
|
140
|
+
action: () => {
|
|
141
|
+
if (typeof workbench.togglePanel === 'function') workbench.togglePanel();
|
|
142
|
+
else if (typeof workbench.setPanelVisible === 'function') workbench.setPanelVisible(Boolean(workbench._panelCollapsed));
|
|
143
|
+
}
|
|
49
144
|
},
|
|
50
145
|
{
|
|
51
|
-
id: '
|
|
52
|
-
label: '
|
|
53
|
-
|
|
146
|
+
id: 'view-toggle-terminal',
|
|
147
|
+
label: 'View: Toggle Terminal',
|
|
148
|
+
shortcut: '⌃`',
|
|
149
|
+
action: () => {
|
|
150
|
+
if (typeof workbench.toggleTerminalPanel === 'function') workbench.toggleTerminalPanel();
|
|
151
|
+
else if (typeof workbench.togglePanel === 'function') workbench.togglePanel('terminal');
|
|
152
|
+
}
|
|
54
153
|
},
|
|
55
154
|
{
|
|
56
|
-
id: '
|
|
57
|
-
label: '
|
|
58
|
-
|
|
155
|
+
id: 'view-toggle-sidebar',
|
|
156
|
+
label: 'View: Toggle Primary Side Bar',
|
|
157
|
+
shortcut: '⌘B',
|
|
158
|
+
action: () => {
|
|
159
|
+
if (typeof workbench.togglePrimarySidebar === 'function') workbench.togglePrimarySidebar();
|
|
160
|
+
}
|
|
59
161
|
},
|
|
60
162
|
{
|
|
61
|
-
id: '
|
|
62
|
-
label: '
|
|
163
|
+
id: 'terminal-new',
|
|
164
|
+
label: 'Terminal: Create New Terminal',
|
|
165
|
+
shortcut: '⌃⇧`',
|
|
63
166
|
action: () => {
|
|
64
|
-
workbench.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
167
|
+
if (typeof workbench.createNewTerminalSession === 'function') workbench.createNewTerminalSession();
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: 'terminal-split',
|
|
172
|
+
label: 'Terminal: Split Terminal',
|
|
173
|
+
shortcut: '⌘\\',
|
|
174
|
+
action: () => {
|
|
175
|
+
if (typeof workbench.splitTerminalSession === 'function') workbench.splitTerminalSession();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: 'terminal-clear',
|
|
180
|
+
label: 'Terminal: Clear',
|
|
181
|
+
action: () => {
|
|
182
|
+
if (typeof workbench.clearTerminal === 'function') workbench.clearTerminal();
|
|
68
183
|
}
|
|
69
184
|
},
|
|
70
185
|
{
|
|
71
186
|
id: 'open-problems',
|
|
72
|
-
label: 'View:
|
|
187
|
+
label: 'View: Focus Problems (Errors, Warnings)',
|
|
188
|
+
shortcut: '⇧⌘M',
|
|
73
189
|
action: () => {
|
|
74
190
|
workbench.drawerTab = 'problems';
|
|
191
|
+
if (typeof workbench.setPanelVisible === 'function') workbench.setPanelVisible(true);
|
|
192
|
+
if (typeof workbench._renderDrawerBody === 'function') workbench._renderDrawerBody();
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: 'open-stdin',
|
|
197
|
+
label: 'View: Open Output / Stdin Panel',
|
|
198
|
+
action: () => {
|
|
199
|
+
workbench.drawerTab = 'stdin';
|
|
200
|
+
if (typeof workbench.setPanelVisible === 'function') workbench.setPanelVisible(true);
|
|
75
201
|
if (typeof workbench._renderDrawerBody === 'function') workbench._renderDrawerBody();
|
|
76
|
-
const drawer = workbench.container?.querySelector('#cl-drawer');
|
|
77
|
-
if (drawer) drawer.classList.remove('is-minimized');
|
|
78
202
|
}
|
|
79
203
|
},
|
|
80
204
|
{
|
|
@@ -91,50 +215,167 @@ export function getStandardWorkbenchCommands(workbench: any): CommandPaletteItem
|
|
|
91
215
|
id: 'rename-active',
|
|
92
216
|
label: 'File: Rename Active File...',
|
|
93
217
|
shortcut: 'F2',
|
|
94
|
-
action: () => {
|
|
218
|
+
action: () => {
|
|
219
|
+
if (workbench.activeFile && workbench.activeFile !== '__welcome__') {
|
|
220
|
+
workbench.startInlineRename('file', workbench.activeFile);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
95
223
|
},
|
|
96
224
|
{
|
|
97
225
|
id: 'delete-active',
|
|
98
226
|
label: 'File: Delete Active File',
|
|
99
|
-
action: () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
action: () => workbench.exportProjectZip({ download: true })
|
|
227
|
+
action: () => {
|
|
228
|
+
if (workbench.activeFile && workbench.activeFile !== '__welcome__') {
|
|
229
|
+
workbench.deleteFile(workbench.activeFile);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
105
232
|
},
|
|
106
233
|
{
|
|
107
|
-
id: '
|
|
108
|
-
label: '
|
|
109
|
-
action: () =>
|
|
234
|
+
id: 'open-welcome',
|
|
235
|
+
label: 'Help: Welcome',
|
|
236
|
+
action: () => {
|
|
237
|
+
if (typeof workbench.openWelcomeTab === 'function') workbench.openWelcomeTab();
|
|
238
|
+
}
|
|
110
239
|
},
|
|
111
240
|
{
|
|
112
|
-
id: '
|
|
113
|
-
label: '
|
|
241
|
+
id: 'open-settings',
|
|
242
|
+
label: 'Preferences: Open Settings (UI)',
|
|
243
|
+
shortcut: '⌘,',
|
|
114
244
|
action: () => {
|
|
115
|
-
|
|
116
|
-
if (workbench.
|
|
117
|
-
if (workbench.enabledLanguages?.has('cpp')) order.push('cpp');
|
|
118
|
-
if (workbench.enabledLanguages?.has('py')) order.push('py');
|
|
119
|
-
const next = order[(order.indexOf(workbench.lang) + 1) % order.length] || 'js';
|
|
120
|
-
workbench.setLanguage(next);
|
|
245
|
+
if (typeof workbench.openSettingsView === 'function') workbench.openSettingsView();
|
|
246
|
+
else if (typeof workbench.showSettingsModal === 'function') workbench.showSettingsModal();
|
|
121
247
|
}
|
|
122
248
|
},
|
|
123
249
|
{
|
|
124
|
-
id: 'toggle-
|
|
125
|
-
label: '
|
|
126
|
-
action: () =>
|
|
250
|
+
id: 'toggle-theme',
|
|
251
|
+
label: 'Preferences: Cycle Color Theme (Dark Modern / Light Modern / High Contrast)',
|
|
252
|
+
action: () => {
|
|
253
|
+
const order = ['dark', 'light', 'high-contrast'];
|
|
254
|
+
const cur = typeof workbench._resolvedTheme === 'function' ? workbench._resolvedTheme() : workbench.theme;
|
|
255
|
+
const next = order[(order.indexOf(cur) + 1) % order.length] || 'dark';
|
|
256
|
+
if (typeof workbench.setTheme === 'function') workbench.setTheme(next);
|
|
257
|
+
}
|
|
127
258
|
},
|
|
128
259
|
{
|
|
129
260
|
id: 'search-workspace',
|
|
130
|
-
label: 'Search: Find
|
|
261
|
+
label: 'Search: Find in Files',
|
|
131
262
|
shortcut: '⇧⌘F',
|
|
132
263
|
action: () => workbench.showSearchModal()
|
|
133
264
|
},
|
|
134
265
|
{
|
|
135
266
|
id: 'open-scm',
|
|
136
|
-
label: '
|
|
267
|
+
label: 'Source Control: Focus on Source Control View',
|
|
268
|
+
shortcut: '⌃⇧G',
|
|
137
269
|
action: () => workbench.showScmModal()
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
id: 'git-clone',
|
|
273
|
+
label: 'Git: Clone Repository...',
|
|
274
|
+
action: () => {
|
|
275
|
+
if (typeof workbench.showCloneModal === 'function') workbench.showCloneModal();
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
id: 'git-stash',
|
|
280
|
+
label: 'Git: Stash Changes',
|
|
281
|
+
action: () => {
|
|
282
|
+
if (workbench.shell && typeof workbench.shell.execute === 'function') {
|
|
283
|
+
void workbench.shell.execute('git stash push').then(() => {
|
|
284
|
+
if (typeof workbench._refreshGitDecorations === 'function') workbench._refreshGitDecorations();
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: 'git-stash-pop',
|
|
291
|
+
label: 'Git: Pop Latest Stash',
|
|
292
|
+
action: () => {
|
|
293
|
+
if (workbench.shell && typeof workbench.shell.execute === 'function') {
|
|
294
|
+
void workbench.shell.execute('git stash pop').then(() => {
|
|
295
|
+
if (typeof workbench._syncFilesFromVfs === 'function') workbench._syncFilesFromVfs();
|
|
296
|
+
if (typeof workbench._refreshGitDecorations === 'function') workbench._refreshGitDecorations();
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: 'share-snapshot',
|
|
303
|
+
label: 'Share: Copy URL Snapshot to Clipboard (#codelab=...)',
|
|
304
|
+
action: () => workbench.shareSnapshot()
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: 'export-workspace-zip',
|
|
308
|
+
label: 'File: Download Workspace as ZIP Archive',
|
|
309
|
+
action: () => workbench.exportProjectZip({ download: true })
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
id: 'export-workspace-json',
|
|
313
|
+
label: 'File: Export Workspace as JSON',
|
|
314
|
+
action: () => workbench.exportWorkspace({ download: true })
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
id: 'toggle-fullscreen',
|
|
318
|
+
label: 'View: Toggle Full Screen',
|
|
319
|
+
action: () => workbench.toggleFullscreen()
|
|
138
320
|
}
|
|
139
321
|
];
|
|
322
|
+
|
|
323
|
+
if (workbench.hasGuidedLab) {
|
|
324
|
+
commands.push(
|
|
325
|
+
{
|
|
326
|
+
id: 'compare-solution',
|
|
327
|
+
label: 'Diff: Compare Active File with Reference Solution',
|
|
328
|
+
action: () => workbench.showDiffModal(workbench.activeFile || workbench._pickDefaultFile(), 'solution')
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: 'compare-starter',
|
|
332
|
+
label: 'Diff: Compare Active File with Starter Template',
|
|
333
|
+
action: () => workbench.showDiffModal(workbench.activeFile || workbench._pickDefaultFile(), 'starter')
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
id: 'switch-lang',
|
|
337
|
+
label: 'Language: Cycle Active Lab Language (JS / TS / C++ / PY)',
|
|
338
|
+
action: () => {
|
|
339
|
+
const order = ['js'];
|
|
340
|
+
if (workbench.enabledLanguages?.has('ts')) order.push('ts');
|
|
341
|
+
if (workbench.enabledLanguages?.has('cpp')) order.push('cpp');
|
|
342
|
+
if (workbench.enabledLanguages?.has('py')) order.push('py');
|
|
343
|
+
const next = order[(order.indexOf(workbench.lang) + 1) % order.length] || 'js';
|
|
344
|
+
workbench.setLanguage(next);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Merge live Monaco editor actions (`Rename Symbol`, `Go to References`, `Change All Occurrences`, `Fold All`, etc.)
|
|
351
|
+
const editor = workbench.editor;
|
|
352
|
+
if (editor && typeof editor.getSupportedActions === 'function') {
|
|
353
|
+
try {
|
|
354
|
+
const existingLabels = new Set(commands.map((c) => c.label.toLowerCase()));
|
|
355
|
+
const actions = editor.getSupportedActions() || [];
|
|
356
|
+
for (const act of actions) {
|
|
357
|
+
if (!act || !act.id || !act.label) continue;
|
|
358
|
+
if (typeof act.isSupported === 'function' && !act.isSupported()) continue;
|
|
359
|
+
const label = `Editor: ${act.label}`;
|
|
360
|
+
if (existingLabels.has(label.toLowerCase()) || existingLabels.has(String(act.label).toLowerCase())) continue;
|
|
361
|
+
existingLabels.add(label.toLowerCase());
|
|
362
|
+
commands.push({
|
|
363
|
+
id: `monaco:${act.id}`,
|
|
364
|
+
label,
|
|
365
|
+
action: () => {
|
|
366
|
+
try {
|
|
367
|
+
editor.focus?.();
|
|
368
|
+
void act.run();
|
|
369
|
+
} catch (_err) {
|
|
370
|
+
void _err;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
} catch (_err) {
|
|
376
|
+
void _err;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return commands;
|
|
140
381
|
}
|