@codingame/monaco-vscode-quickaccess-service-override 25.1.2 → 26.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 +2 -2
- package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +121 -73
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.d.ts +3 -1
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +24 -17
- package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +63 -35
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +22 -15
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +82 -77
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +34 -27
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +63 -38
- package/vscode/src/vs/workbench/contrib/url/browser/externalUriResolver.js +6 -8
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsFileSystemProvider.js +27 -23
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsValidator.js +67 -56
- package/vscode/src/vs/workbench/contrib/url/browser/url.contribution.js +30 -12
- package/vscode/src/vs/workbench/services/quickinput/browser/quickInputService.js +18 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-quickaccess-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - quickaccess service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-api": "
|
|
18
|
+
"@codingame/monaco-vscode-api": "26.0.0"
|
|
19
19
|
},
|
|
20
20
|
"main": "index.js",
|
|
21
21
|
"module": "index.js",
|
|
@@ -24,12 +24,29 @@ import { Categories } from '@codingame/monaco-vscode-api/vscode/vs/platform/acti
|
|
|
24
24
|
|
|
25
25
|
var AbstractCommandsQuickAccessProvider_1, CommandsHistory_1;
|
|
26
26
|
let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvider extends PickerQuickAccessProvider {
|
|
27
|
-
static {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
static {
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
static {
|
|
28
|
+
AbstractCommandsQuickAccessProvider_1 = this;
|
|
29
|
+
}
|
|
30
|
+
static {
|
|
31
|
+
this.PREFIX = ">";
|
|
32
|
+
}
|
|
33
|
+
static {
|
|
34
|
+
this.TFIDF_THRESHOLD = 0.5;
|
|
35
|
+
}
|
|
36
|
+
static {
|
|
37
|
+
this.TFIDF_MAX_RESULTS = 5;
|
|
38
|
+
}
|
|
39
|
+
static {
|
|
40
|
+
this.WORD_FILTER = or(matchesBaseContiguousSubString, matchesWords);
|
|
41
|
+
}
|
|
42
|
+
constructor(
|
|
43
|
+
options,
|
|
44
|
+
instantiationService,
|
|
45
|
+
keybindingService,
|
|
46
|
+
commandService,
|
|
47
|
+
telemetryService,
|
|
48
|
+
dialogService
|
|
49
|
+
) {
|
|
33
50
|
super(AbstractCommandsQuickAccessProvider_1.PREFIX, options);
|
|
34
51
|
this.keybindingService = keybindingService;
|
|
35
52
|
this.commandService = commandService;
|
|
@@ -50,9 +67,9 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
50
67
|
textChunks: [this.getTfIdfChunk(commandPick)]
|
|
51
68
|
}))));
|
|
52
69
|
const result = tfidf.calculateScores(filter, token);
|
|
53
|
-
return normalizeTfIdfScores(result)
|
|
54
|
-
|
|
55
|
-
|
|
70
|
+
return normalizeTfIdfScores(result).filter(
|
|
71
|
+
score => score.score > AbstractCommandsQuickAccessProvider_1.TFIDF_THRESHOLD
|
|
72
|
+
).slice(0, AbstractCommandsQuickAccessProvider_1.TFIDF_MAX_RESULTS);
|
|
56
73
|
});
|
|
57
74
|
const filteredCommandPicks = [];
|
|
58
75
|
for (const commandPick of allCommandPicks) {
|
|
@@ -89,8 +106,7 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
89
106
|
if (existingCommandForLabel) {
|
|
90
107
|
commandPick.description = commandPick.commandId;
|
|
91
108
|
existingCommandForLabel.description = existingCommandForLabel.commandId;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
109
|
+
} else {
|
|
94
110
|
mapLabelToCommand.set(commandPick.label, commandPick);
|
|
95
111
|
}
|
|
96
112
|
}
|
|
@@ -100,11 +116,9 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
100
116
|
return commandPickA.label.localeCompare(commandPickB.label);
|
|
101
117
|
}
|
|
102
118
|
return commandPickB.tfIdfScore - commandPickA.tfIdfScore;
|
|
103
|
-
}
|
|
104
|
-
else if (commandPickA.tfIdfScore) {
|
|
119
|
+
} else if (commandPickA.tfIdfScore) {
|
|
105
120
|
return 1;
|
|
106
|
-
}
|
|
107
|
-
else if (commandPickB.tfIdfScore) {
|
|
121
|
+
} else if (commandPickB.tfIdfScore) {
|
|
108
122
|
return -1;
|
|
109
123
|
}
|
|
110
124
|
const commandACounter = this.commandsHistory.peek(commandPickA.commandId);
|
|
@@ -149,20 +163,32 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
149
163
|
const commandPick = filteredCommandPicks[i];
|
|
150
164
|
const isInHistory = !!this.commandsHistory.peek(commandPick.commandId);
|
|
151
165
|
if (i === 0 && isInHistory) {
|
|
152
|
-
commandPicks.push({
|
|
166
|
+
commandPicks.push({
|
|
167
|
+
type: "separator",
|
|
168
|
+
label: ( localize(2009, "recently used"))
|
|
169
|
+
});
|
|
153
170
|
addOtherSeparator = true;
|
|
154
171
|
}
|
|
155
172
|
if (addSuggestedSeparator && commandPick.tfIdfScore !== undefined) {
|
|
156
|
-
commandPicks.push({
|
|
173
|
+
commandPicks.push({
|
|
174
|
+
type: "separator",
|
|
175
|
+
label: ( localize(2010, "similar commands"))
|
|
176
|
+
});
|
|
157
177
|
addSuggestedSeparator = false;
|
|
158
178
|
}
|
|
159
179
|
if (addCommonlyUsedSeparator && commandPick.tfIdfScore === undefined && !isInHistory && this.options.suggestedCommandIds?.has(commandPick.commandId)) {
|
|
160
|
-
commandPicks.push({
|
|
180
|
+
commandPicks.push({
|
|
181
|
+
type: "separator",
|
|
182
|
+
label: ( localize(2011, "commonly used"))
|
|
183
|
+
});
|
|
161
184
|
addOtherSeparator = true;
|
|
162
185
|
addCommonlyUsedSeparator = false;
|
|
163
186
|
}
|
|
164
187
|
if (addOtherSeparator && commandPick.tfIdfScore === undefined && !isInHistory && !this.options.suggestedCommandIds?.has(commandPick.commandId)) {
|
|
165
|
-
commandPicks.push({
|
|
188
|
+
commandPicks.push({
|
|
189
|
+
type: "separator",
|
|
190
|
+
label: ( localize(2012, "other commands"))
|
|
191
|
+
});
|
|
166
192
|
addOtherSeparator = false;
|
|
167
193
|
}
|
|
168
194
|
commandPicks.push(this.toCommandPick(commandPick, runOptions, isInHistory));
|
|
@@ -178,31 +204,28 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
178
204
|
return [];
|
|
179
205
|
}
|
|
180
206
|
const commandPicks = ( additionalCommandPicks.map(commandPick => this.toCommandPick(commandPick, runOptions)));
|
|
181
|
-
if (addSuggestedSeparator && commandPicks[0]?.type !==
|
|
182
|
-
commandPicks.unshift({
|
|
207
|
+
if (addSuggestedSeparator && commandPicks[0]?.type !== "separator") {
|
|
208
|
+
commandPicks.unshift({
|
|
209
|
+
type: "separator",
|
|
210
|
+
label: ( localize(2010, "similar commands"))
|
|
211
|
+
});
|
|
183
212
|
}
|
|
184
213
|
return commandPicks;
|
|
185
214
|
})()
|
|
186
215
|
};
|
|
187
216
|
}
|
|
188
217
|
toCommandPick(commandPick, runOptions, isRecentlyUsed = false) {
|
|
189
|
-
if (commandPick.type ===
|
|
218
|
+
if (commandPick.type === "separator") {
|
|
190
219
|
return commandPick;
|
|
191
220
|
}
|
|
192
|
-
const tooltip = commandPick.tooltip
|
|
193
|
-
?? commandPick.commandDescription?.value;
|
|
221
|
+
const tooltip = commandPick.tooltip ?? commandPick.commandDescription?.value;
|
|
194
222
|
const keybinding = this.keybindingService.lookupKeybinding(commandPick.commandId);
|
|
195
|
-
const ariaLabel = keybinding ?
|
|
196
|
-
( localize(2011, "{0}, {1}", commandPick.label, keybinding.getAriaLabel())) :
|
|
197
|
-
commandPick.label;
|
|
223
|
+
const ariaLabel = keybinding ? ( localize(2013, "{0}, {1}", commandPick.label, keybinding.getAriaLabel())) : commandPick.label;
|
|
198
224
|
const existingButtons = commandPick.buttons || [];
|
|
199
|
-
const buttons = isRecentlyUsed ? [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
tooltip: ( localize(2012, "Remove from Recently Used"))
|
|
204
|
-
}
|
|
205
|
-
] : commandPick.buttons;
|
|
225
|
+
const buttons = isRecentlyUsed ? [...existingButtons, {
|
|
226
|
+
iconClass: ThemeIcon.asClassName(Codicon.close),
|
|
227
|
+
tooltip: ( localize(2014, "Remove from Recently Used"))
|
|
228
|
+
}] : commandPick.buttons;
|
|
206
229
|
return {
|
|
207
230
|
...commandPick,
|
|
208
231
|
tooltip,
|
|
@@ -212,18 +235,15 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
212
235
|
buttons,
|
|
213
236
|
accept: async () => {
|
|
214
237
|
this.commandsHistory.push(commandPick.commandId);
|
|
215
|
-
this.telemetryService.publicLog2(
|
|
238
|
+
this.telemetryService.publicLog2("workbenchActionExecuted", {
|
|
216
239
|
id: commandPick.commandId,
|
|
217
|
-
from: runOptions?.from ??
|
|
240
|
+
from: runOptions?.from ?? "quick open"
|
|
218
241
|
});
|
|
219
242
|
try {
|
|
220
|
-
commandPick.args?.length
|
|
221
|
-
|
|
222
|
-
: await this.commandService.executeCommand(commandPick.commandId);
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
243
|
+
commandPick.args?.length ? await this.commandService.executeCommand(commandPick.commandId, ...commandPick.args) : await this.commandService.executeCommand(commandPick.commandId);
|
|
244
|
+
} catch (error) {
|
|
225
245
|
if (!isCancellationError(error)) {
|
|
226
|
-
this.dialogService.error(( localize(
|
|
246
|
+
this.dialogService.error(( localize(2015, "Command '{0}' resulted in an error", commandPick.label)), toErrorMessage(error));
|
|
227
247
|
}
|
|
228
248
|
}
|
|
229
249
|
},
|
|
@@ -240,7 +260,13 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
240
260
|
} : commandPick.trigger
|
|
241
261
|
};
|
|
242
262
|
}
|
|
243
|
-
getTfIdfChunk(
|
|
263
|
+
getTfIdfChunk(
|
|
264
|
+
{
|
|
265
|
+
label,
|
|
266
|
+
commandAlias,
|
|
267
|
+
commandDescription
|
|
268
|
+
}
|
|
269
|
+
) {
|
|
244
270
|
let chunk = label;
|
|
245
271
|
if (commandAlias && commandAlias !== label) {
|
|
246
272
|
chunk += ` - ${commandAlias}`;
|
|
@@ -251,20 +277,26 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
251
277
|
return chunk;
|
|
252
278
|
}
|
|
253
279
|
};
|
|
254
|
-
AbstractCommandsQuickAccessProvider = AbstractCommandsQuickAccessProvider_1 = ( __decorate([
|
|
255
|
-
( __param(1, IInstantiationService)),
|
|
256
|
-
( __param(2, IKeybindingService)),
|
|
257
|
-
( __param(3, ICommandService)),
|
|
258
|
-
( __param(4, ITelemetryService)),
|
|
259
|
-
( __param(5, IDialogService))
|
|
260
|
-
], AbstractCommandsQuickAccessProvider));
|
|
280
|
+
AbstractCommandsQuickAccessProvider = AbstractCommandsQuickAccessProvider_1 = ( __decorate([( __param(1, IInstantiationService)), ( __param(2, IKeybindingService)), ( __param(3, ICommandService)), ( __param(4, ITelemetryService)), ( __param(5, IDialogService))], AbstractCommandsQuickAccessProvider));
|
|
261
281
|
let CommandsHistory = class CommandsHistory extends Disposable {
|
|
262
|
-
static {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
static {
|
|
266
|
-
|
|
267
|
-
|
|
282
|
+
static {
|
|
283
|
+
CommandsHistory_1 = this;
|
|
284
|
+
}
|
|
285
|
+
static {
|
|
286
|
+
this.DEFAULT_COMMANDS_HISTORY_LENGTH = 50;
|
|
287
|
+
}
|
|
288
|
+
static {
|
|
289
|
+
this.PREF_KEY_CACHE = "commandPalette.mru.cache";
|
|
290
|
+
}
|
|
291
|
+
static {
|
|
292
|
+
this.PREF_KEY_COUNTER = "commandPalette.mru.counter";
|
|
293
|
+
}
|
|
294
|
+
static {
|
|
295
|
+
this.counter = 1;
|
|
296
|
+
}
|
|
297
|
+
static {
|
|
298
|
+
this.hasChanges = false;
|
|
299
|
+
}
|
|
268
300
|
constructor(storageService, configurationService, logService) {
|
|
269
301
|
super();
|
|
270
302
|
this.storageService = storageService;
|
|
@@ -276,7 +308,9 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
276
308
|
this.registerListeners();
|
|
277
309
|
}
|
|
278
310
|
registerListeners() {
|
|
279
|
-
this._register(
|
|
311
|
+
this._register(
|
|
312
|
+
this.configurationService.onDidChangeConfiguration(e => this.updateConfiguration(e))
|
|
313
|
+
);
|
|
280
314
|
this._register(this.storageService.onWillSaveState(e => {
|
|
281
315
|
if (e.reason === WillSaveStateReason.SHUTDOWN) {
|
|
282
316
|
this.saveState();
|
|
@@ -284,7 +318,7 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
284
318
|
}));
|
|
285
319
|
}
|
|
286
320
|
updateConfiguration(e) {
|
|
287
|
-
if (e && !e.affectsConfiguration(
|
|
321
|
+
if (e && !e.affectsConfiguration("workbench.commandPalette.history")) {
|
|
288
322
|
return;
|
|
289
323
|
}
|
|
290
324
|
this.configuredCommandsHistoryLength = CommandsHistory_1.getConfiguredCommandHistoryLength(this.configurationService);
|
|
@@ -299,8 +333,7 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
299
333
|
if (raw) {
|
|
300
334
|
try {
|
|
301
335
|
serializedCache = JSON.parse(raw);
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
336
|
+
} catch (error) {
|
|
304
337
|
this.logService.error(`[CommandsHistory] invalid data: ${error}`);
|
|
305
338
|
}
|
|
306
339
|
}
|
|
@@ -309,13 +342,16 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
309
342
|
let entries;
|
|
310
343
|
if (serializedCache.usesLRU) {
|
|
311
344
|
entries = serializedCache.entries;
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
345
|
+
} else {
|
|
314
346
|
entries = serializedCache.entries.sort((a, b) => a.value - b.value);
|
|
315
347
|
}
|
|
316
348
|
entries.forEach(entry => cache.set(entry.key, entry.value));
|
|
317
349
|
}
|
|
318
|
-
CommandsHistory_1.counter = this.storageService.getNumber(
|
|
350
|
+
CommandsHistory_1.counter = this.storageService.getNumber(
|
|
351
|
+
CommandsHistory_1.PREF_KEY_COUNTER,
|
|
352
|
+
StorageScope.PROFILE,
|
|
353
|
+
CommandsHistory_1.counter
|
|
354
|
+
);
|
|
319
355
|
}
|
|
320
356
|
push(commandId) {
|
|
321
357
|
if (!CommandsHistory_1.cache) {
|
|
@@ -341,16 +377,32 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
341
377
|
if (!CommandsHistory_1.hasChanges) {
|
|
342
378
|
return;
|
|
343
379
|
}
|
|
344
|
-
const serializedCache = {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
380
|
+
const serializedCache = {
|
|
381
|
+
usesLRU: true,
|
|
382
|
+
entries: []
|
|
383
|
+
};
|
|
384
|
+
CommandsHistory_1.cache.forEach((value, key) => serializedCache.entries.push({
|
|
385
|
+
key,
|
|
386
|
+
value
|
|
387
|
+
}));
|
|
388
|
+
this.storageService.store(
|
|
389
|
+
CommandsHistory_1.PREF_KEY_CACHE,
|
|
390
|
+
JSON.stringify(serializedCache),
|
|
391
|
+
StorageScope.PROFILE,
|
|
392
|
+
StorageTarget.USER
|
|
393
|
+
);
|
|
394
|
+
this.storageService.store(
|
|
395
|
+
CommandsHistory_1.PREF_KEY_COUNTER,
|
|
396
|
+
CommandsHistory_1.counter,
|
|
397
|
+
StorageScope.PROFILE,
|
|
398
|
+
StorageTarget.USER
|
|
399
|
+
);
|
|
348
400
|
CommandsHistory_1.hasChanges = false;
|
|
349
401
|
}
|
|
350
402
|
static getConfiguredCommandHistoryLength(configurationService) {
|
|
351
403
|
const config = configurationService.getValue();
|
|
352
404
|
const configuredCommandHistoryLength = config.workbench?.commandPalette?.history;
|
|
353
|
-
if (typeof configuredCommandHistoryLength ===
|
|
405
|
+
if (typeof configuredCommandHistoryLength === "number") {
|
|
354
406
|
return configuredCommandHistoryLength;
|
|
355
407
|
}
|
|
356
408
|
return CommandsHistory_1.DEFAULT_COMMANDS_HISTORY_LENGTH;
|
|
@@ -362,10 +414,6 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
362
414
|
CommandsHistory_1.hasChanges = true;
|
|
363
415
|
}
|
|
364
416
|
};
|
|
365
|
-
CommandsHistory = CommandsHistory_1 = ( __decorate([
|
|
366
|
-
( __param(0, IStorageService)),
|
|
367
|
-
( __param(1, IConfigurationService)),
|
|
368
|
-
( __param(2, ILogService))
|
|
369
|
-
], CommandsHistory));
|
|
417
|
+
CommandsHistory = CommandsHistory_1 = ( __decorate([( __param(0, IStorageService)), ( __param(1, IConfigurationService)), ( __param(2, ILogService))], CommandsHistory));
|
|
370
418
|
|
|
371
419
|
export { AbstractCommandsQuickAccessProvider, CommandsHistory };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IDisposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IContextKeyService } from "@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
2
3
|
import { IKeybindingService } from "@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
3
4
|
import { IQuickAccessProvider } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickAccess";
|
|
4
5
|
import { IQuickPick, IQuickPickItem } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput";
|
|
@@ -9,9 +10,10 @@ interface IHelpQuickAccessPickItem extends IQuickPickItem {
|
|
|
9
10
|
export declare class HelpQuickAccessProvider implements IQuickAccessProvider {
|
|
10
11
|
private readonly quickInputService;
|
|
11
12
|
private readonly keybindingService;
|
|
13
|
+
private readonly contextKeyService;
|
|
12
14
|
static PREFIX: string;
|
|
13
15
|
private readonly registry;
|
|
14
|
-
constructor(quickInputService: IQuickInputService, keybindingService: IKeybindingService);
|
|
16
|
+
constructor(quickInputService: IQuickInputService, keybindingService: IKeybindingService, contextKeyService: IContextKeyService);
|
|
15
17
|
provide(picker: IQuickPick<IHelpQuickAccessPickItem, {
|
|
16
18
|
useSeparators: true;
|
|
17
19
|
}>): IDisposable;
|
|
@@ -3,17 +3,23 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
|
|
|
3
3
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
4
4
|
import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
|
|
5
5
|
import { DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
6
7
|
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
7
8
|
import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickAccess';
|
|
8
9
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
9
10
|
|
|
10
11
|
var HelpQuickAccessProvider_1;
|
|
11
12
|
let HelpQuickAccessProvider = class HelpQuickAccessProvider {
|
|
12
|
-
static {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
static {
|
|
14
|
+
HelpQuickAccessProvider_1 = this;
|
|
15
|
+
}
|
|
16
|
+
static {
|
|
17
|
+
this.PREFIX = "?";
|
|
18
|
+
}
|
|
19
|
+
constructor(quickInputService, keybindingService, contextKeyService) {
|
|
15
20
|
this.quickInputService = quickInputService;
|
|
16
21
|
this.keybindingService = keybindingService;
|
|
22
|
+
this.contextKeyService = contextKeyService;
|
|
17
23
|
this.registry = ( Registry.as(Extensions.Quickaccess));
|
|
18
24
|
}
|
|
19
25
|
provide(picker) {
|
|
@@ -21,42 +27,43 @@ let HelpQuickAccessProvider = class HelpQuickAccessProvider {
|
|
|
21
27
|
disposables.add(picker.onDidAccept(() => {
|
|
22
28
|
const [item] = picker.selectedItems;
|
|
23
29
|
if (item) {
|
|
24
|
-
this.quickInputService.quickAccess.show(item.prefix, {
|
|
30
|
+
this.quickInputService.quickAccess.show(item.prefix, {
|
|
31
|
+
preserveValue: true
|
|
32
|
+
});
|
|
25
33
|
}
|
|
26
34
|
}));
|
|
27
35
|
disposables.add(picker.onDidChangeValue(value => {
|
|
28
|
-
const providerDescriptor = this.registry.getQuickAccessProvider(
|
|
29
|
-
|
|
30
|
-
this.
|
|
36
|
+
const providerDescriptor = this.registry.getQuickAccessProvider(
|
|
37
|
+
value.substr(HelpQuickAccessProvider_1.PREFIX.length),
|
|
38
|
+
this.contextKeyService
|
|
39
|
+
);
|
|
40
|
+
if (providerDescriptor?.prefix && providerDescriptor.prefix !== HelpQuickAccessProvider_1.PREFIX) {
|
|
41
|
+
this.quickInputService.quickAccess.show(providerDescriptor.prefix, {
|
|
42
|
+
preserveValue: true
|
|
43
|
+
});
|
|
31
44
|
}
|
|
32
45
|
}));
|
|
33
46
|
picker.items = this.getQuickAccessProviders().filter(p => p.prefix !== HelpQuickAccessProvider_1.PREFIX);
|
|
34
47
|
return disposables;
|
|
35
48
|
}
|
|
36
49
|
getQuickAccessProviders() {
|
|
37
|
-
const providers = this.registry
|
|
38
|
-
.getQuickAccessProviders()
|
|
39
|
-
.sort((providerA, providerB) => providerA.prefix.localeCompare(providerB.prefix))
|
|
40
|
-
.flatMap(provider => this.createPicks(provider));
|
|
50
|
+
const providers = this.registry.getQuickAccessProviders(this.contextKeyService).sort((providerA, providerB) => providerA.prefix.localeCompare(providerB.prefix)).flatMap(provider => this.createPicks(provider));
|
|
41
51
|
return providers;
|
|
42
52
|
}
|
|
43
53
|
createPicks(provider) {
|
|
44
54
|
return (provider.helpEntries.map(helpEntry => {
|
|
45
55
|
const prefix = helpEntry.prefix || provider.prefix;
|
|
46
|
-
const label = prefix ||
|
|
56
|
+
const label = prefix || "…" ;
|
|
47
57
|
return {
|
|
48
58
|
prefix,
|
|
49
59
|
label,
|
|
50
60
|
keybinding: helpEntry.commandId ? this.keybindingService.lookupKeybinding(helpEntry.commandId) : undefined,
|
|
51
|
-
ariaLabel: ( localize(
|
|
61
|
+
ariaLabel: ( localize(2016, "{0}, {1}", label, helpEntry.description)),
|
|
52
62
|
description: helpEntry.description
|
|
53
63
|
};
|
|
54
64
|
}));
|
|
55
65
|
}
|
|
56
66
|
};
|
|
57
|
-
HelpQuickAccessProvider = HelpQuickAccessProvider_1 = ( __decorate([
|
|
58
|
-
( __param(0, IQuickInputService)),
|
|
59
|
-
( __param(1, IKeybindingService))
|
|
60
|
-
], HelpQuickAccessProvider));
|
|
67
|
+
HelpQuickAccessProvider = HelpQuickAccessProvider_1 = ( __decorate([( __param(0, IQuickInputService)), ( __param(1, IKeybindingService)), ( __param(2, IContextKeyService))], HelpQuickAccessProvider));
|
|
61
68
|
|
|
62
69
|
export { HelpQuickAccessProvider };
|