@codingame/monaco-vscode-quickaccess-service-override 11.1.1 → 12.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/index.d.ts +8 -1
- package/index.js +117 -1
- package/package.json +22 -7
- package/vscode/src/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.d.ts +12 -0
- package/vscode/src/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +1 -0
- package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.d.ts +67 -0
- package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +37 -36
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.d.ts +21 -0
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +19 -20
- package/vscode/src/vs/workbench/browser/actions/quickAccessActions.d.ts +1 -0
- package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +33 -31
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +17 -14
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +53 -52
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +24 -25
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.d.ts +50 -0
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +35 -31
- package/vscode/src/vs/workbench/contrib/url/browser/externalUriResolver.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/url/browser/externalUriResolver.js +2 -1
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsFileSystemProvider.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsFileSystemProvider.js +9 -7
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsValidator.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsValidator.js +26 -25
- package/vscode/src/vs/workbench/contrib/url/browser/url.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/url/browser/url.contribution.js +18 -13
- package/vscode/src/vs/workbench/services/quickinput/browser/quickInputService.d.ts +15 -0
- package/vscode/src/vs/workbench/services/quickinput/browser/quickInputService.js +4 -2
- package/quickaccess.js +0 -115
package/index.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
import type { ICodeEditor } from "vscode/vscode/vs/editor/browser/editorBrowser";
|
|
3
|
+
interface QuickAccessProps {
|
|
4
|
+
isKeybindingConfigurationVisible?: () => boolean;
|
|
5
|
+
shouldUseGlobalPicker?: (activeCodeEditor: ICodeEditor | null, activeCodeEditorStandalone: boolean) => boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function getServiceOverride({ isKeybindingConfigurationVisible: _isKeybindingConfigurationVisible, shouldUseGlobalPicker: _shouldUseGlobalPicker }?: QuickAccessProps): IEditorOverrideServices;
|
|
8
|
+
export {};
|
package/index.js
CHANGED
|
@@ -1 +1,117 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
3
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
4
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
5
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
6
|
+
import { StandaloneQuickInputService } from 'vscode/vscode/vs/editor/standalone/browser/quickInput/standaloneQuickInputService';
|
|
7
|
+
import { StandaloneServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
8
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
|
+
import 'vscode/vscode/vs/platform/quickinput/browser/quickInputController';
|
|
10
|
+
import { QuickInputService } from './vscode/src/vs/workbench/services/quickinput/browser/quickInputService.js';
|
|
11
|
+
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
12
|
+
import { StandaloneCodeEditor } from 'vscode/vscode/vs/editor/standalone/browser/standaloneCodeEditor';
|
|
13
|
+
import { CommandsQuickAccessProvider } from './vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js';
|
|
14
|
+
import './vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js';
|
|
15
|
+
import '@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess';
|
|
16
|
+
import './vscode/src/vs/workbench/browser/actions/quickAccessActions.js';
|
|
17
|
+
import './vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js';
|
|
18
|
+
import './vscode/src/vs/workbench/contrib/url/browser/url.contribution.js';
|
|
19
|
+
import '@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common/vscode/vs/workbench/browser/workbench.contribution';
|
|
20
|
+
|
|
21
|
+
let isKeybindingConfigurationVisible = () => {
|
|
22
|
+
return false;
|
|
23
|
+
};
|
|
24
|
+
let shouldUseGlobalPicker = () => {
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
27
|
+
const original = CommandsQuickAccessProvider.prototype['getCommandPicks'];
|
|
28
|
+
CommandsQuickAccessProvider.prototype['getCommandPicks'] = async function (token) {
|
|
29
|
+
let result = await original.call(this, token);
|
|
30
|
+
if (!isKeybindingConfigurationVisible()) {
|
|
31
|
+
result = result.map((picks) => ({
|
|
32
|
+
...picks,
|
|
33
|
+
buttons: undefined
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
let DelegateQuickInputService = class DelegateQuickInputService {
|
|
39
|
+
constructor(instantiationService) {
|
|
40
|
+
this.instantiationService = instantiationService;
|
|
41
|
+
this.workbenchQuickInputService = instantiationService.createInstance(QuickInputService);
|
|
42
|
+
}
|
|
43
|
+
get activeService() {
|
|
44
|
+
const activeCodeEditor = StandaloneServices.get(ICodeEditorService).getFocusedCodeEditor();
|
|
45
|
+
if (activeCodeEditor == null ||
|
|
46
|
+
shouldUseGlobalPicker(activeCodeEditor, activeCodeEditor instanceof StandaloneCodeEditor)) {
|
|
47
|
+
return this.workbenchQuickInputService;
|
|
48
|
+
}
|
|
49
|
+
this.standaloneQuickInputService ?? (this.standaloneQuickInputService = this.instantiationService.createInstance(StandaloneQuickInputService));
|
|
50
|
+
return this.standaloneQuickInputService;
|
|
51
|
+
}
|
|
52
|
+
get currentQuickInput() {
|
|
53
|
+
return this.activeService.currentQuickInput;
|
|
54
|
+
}
|
|
55
|
+
get quickAccess() {
|
|
56
|
+
return this.activeService.quickAccess;
|
|
57
|
+
}
|
|
58
|
+
get backButton() {
|
|
59
|
+
return this.activeService.backButton;
|
|
60
|
+
}
|
|
61
|
+
get onShow() {
|
|
62
|
+
return this.activeService.onShow;
|
|
63
|
+
}
|
|
64
|
+
get onHide() {
|
|
65
|
+
return this.activeService.onHide;
|
|
66
|
+
}
|
|
67
|
+
createQuickWidget() {
|
|
68
|
+
return this.activeService.createQuickWidget();
|
|
69
|
+
}
|
|
70
|
+
pick(picks, options = {}, token = CancellationToken.None) {
|
|
71
|
+
return this.activeService
|
|
72
|
+
.pick(picks, options, token);
|
|
73
|
+
}
|
|
74
|
+
input(options, token) {
|
|
75
|
+
return this.activeService.input(options, token);
|
|
76
|
+
}
|
|
77
|
+
createQuickPick(options = { useSeparators: false }) {
|
|
78
|
+
return this.activeService.createQuickPick(options);
|
|
79
|
+
}
|
|
80
|
+
createInputBox() {
|
|
81
|
+
return this.activeService.createInputBox();
|
|
82
|
+
}
|
|
83
|
+
focus() {
|
|
84
|
+
return this.activeService.focus();
|
|
85
|
+
}
|
|
86
|
+
toggle() {
|
|
87
|
+
return this.activeService.toggle();
|
|
88
|
+
}
|
|
89
|
+
navigate(next, quickNavigate) {
|
|
90
|
+
return this.activeService.navigate(next, quickNavigate);
|
|
91
|
+
}
|
|
92
|
+
accept() {
|
|
93
|
+
return this.activeService.accept();
|
|
94
|
+
}
|
|
95
|
+
back() {
|
|
96
|
+
return this.activeService.back();
|
|
97
|
+
}
|
|
98
|
+
cancel() {
|
|
99
|
+
return this.activeService.cancel();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
DelegateQuickInputService = __decorate([
|
|
103
|
+
__param(0, IInstantiationService)
|
|
104
|
+
], DelegateQuickInputService);
|
|
105
|
+
function getServiceOverride({ isKeybindingConfigurationVisible: _isKeybindingConfigurationVisible, shouldUseGlobalPicker: _shouldUseGlobalPicker } = {}) {
|
|
106
|
+
if (_isKeybindingConfigurationVisible != null) {
|
|
107
|
+
isKeybindingConfigurationVisible = _isKeybindingConfigurationVisible;
|
|
108
|
+
}
|
|
109
|
+
if (_shouldUseGlobalPicker != null) {
|
|
110
|
+
shouldUseGlobalPicker = _shouldUseGlobalPicker;
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
[IQuickInputService.toString()]: new SyncDescriptor(DelegateQuickInputService, [], true)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-quickaccess-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - quickaccess service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,19 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-219d9a5f-b446-507b-a188-1178a0867c75-common": "12.0.0",
|
|
19
|
+
"@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common": "12.0.0",
|
|
20
|
+
"@codingame/monaco-vscode-4ead9d5f-54da-5c5a-b093-32be4a84d711-common": "12.0.0",
|
|
21
|
+
"@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common": "12.0.0",
|
|
22
|
+
"@codingame/monaco-vscode-9a1a5840-af83-5d07-a156-ba32a36c5c4b-common": "12.0.0",
|
|
23
|
+
"@codingame/monaco-vscode-d609a7d3-bf87-551a-884f-550a8b327ec5-common": "12.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-ea14e352-8f1c-5569-b79a-8a96a53e8abe-common": "12.0.0",
|
|
25
|
+
"@codingame/monaco-vscode-fc985c90-0334-5b62-88bc-73e2efa0b80b-common": "12.0.0",
|
|
26
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.0"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {},
|
|
29
|
+
"peerDependenciesMeta": {},
|
|
17
30
|
"main": "index.js",
|
|
18
31
|
"module": "index.js",
|
|
19
32
|
"types": "index.d.ts",
|
|
@@ -22,10 +35,12 @@
|
|
|
22
35
|
"default": "./index.js"
|
|
23
36
|
},
|
|
24
37
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
38
|
+
"default": "./vscode/src/*.js",
|
|
39
|
+
"types": "./vscode/src/*.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./*": {
|
|
42
|
+
"default": "./*.js",
|
|
43
|
+
"types": "./*.d.ts"
|
|
26
44
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.1"
|
|
30
45
|
}
|
|
31
46
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IEditor } from "vscode/vscode/vs/editor/common/editorCommon";
|
|
2
|
+
import { ICommandService } from "vscode/vscode/vs/platform/commands/common/commands.service";
|
|
3
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
4
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
5
|
+
import { IKeybindingService } from "vscode/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
6
|
+
import { AbstractCommandsQuickAccessProvider, ICommandQuickPick, ICommandsQuickAccessOptions } from "../../../../platform/quickinput/browser/commandsQuickAccess.js";
|
|
7
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
8
|
+
export declare abstract class AbstractEditorCommandsQuickAccessProvider extends AbstractCommandsQuickAccessProvider {
|
|
9
|
+
constructor(options: ICommandsQuickAccessOptions, instantiationService: IInstantiationService, keybindingService: IKeybindingService, commandService: ICommandService, telemetryService: ITelemetryService, dialogService: IDialogService);
|
|
10
|
+
protected abstract activeTextEditorControl: IEditor | undefined;
|
|
11
|
+
protected getCodeEditorCommandPicks(): ICommandQuickPick[];
|
|
12
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
|
|
2
3
|
import { isLocalizedString } from 'vscode/vscode/vs/platform/action/common/action';
|
|
3
4
|
import { AbstractCommandsQuickAccessProvider } from '../../../../platform/quickinput/browser/commandsQuickAccess.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Disposable, DisposableStore, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { ILocalizedString } from "vscode/vscode/vs/platform/action/common/action";
|
|
4
|
+
import { ICommandService } from "vscode/vscode/vs/platform/commands/common/commands.service";
|
|
5
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
6
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
7
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
8
|
+
import { IKeybindingService } from "vscode/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
9
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
10
|
+
import { FastAndSlowPicks, IPickerQuickAccessItem, IPickerQuickAccessProviderOptions, PickerQuickAccessProvider, Picks } from "@codingame/monaco-vscode-219d9a5f-b446-507b-a188-1178a0867c75-common/vscode/vs/platform/quickinput/browser/pickerQuickAccess";
|
|
11
|
+
import { IQuickAccessProviderRunOptions } from "vscode/vscode/vs/platform/quickinput/common/quickAccess";
|
|
12
|
+
import { IQuickPickSeparator } from "vscode/vscode/vs/platform/quickinput/common/quickInput";
|
|
13
|
+
import { IStorageService } from "vscode/vscode/vs/platform/storage/common/storage.service";
|
|
14
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
15
|
+
export interface ICommandQuickPick extends IPickerQuickAccessItem {
|
|
16
|
+
readonly commandId: string;
|
|
17
|
+
readonly commandWhen?: string;
|
|
18
|
+
readonly commandAlias?: string;
|
|
19
|
+
readonly commandDescription?: ILocalizedString;
|
|
20
|
+
tfIdfScore?: number;
|
|
21
|
+
readonly args?: any[];
|
|
22
|
+
}
|
|
23
|
+
export interface ICommandsQuickAccessOptions extends IPickerQuickAccessProviderOptions<ICommandQuickPick> {
|
|
24
|
+
readonly showAlias: boolean;
|
|
25
|
+
suggestedCommandIds?: Set<string>;
|
|
26
|
+
}
|
|
27
|
+
export declare abstract class AbstractCommandsQuickAccessProvider extends PickerQuickAccessProvider<ICommandQuickPick> implements IDisposable {
|
|
28
|
+
private readonly instantiationService;
|
|
29
|
+
protected readonly keybindingService: IKeybindingService;
|
|
30
|
+
private readonly commandService;
|
|
31
|
+
private readonly telemetryService;
|
|
32
|
+
private readonly dialogService;
|
|
33
|
+
static PREFIX: string;
|
|
34
|
+
private static readonly TFIDF_THRESHOLD;
|
|
35
|
+
private static readonly TFIDF_MAX_RESULTS;
|
|
36
|
+
private static WORD_FILTER;
|
|
37
|
+
private readonly commandsHistory;
|
|
38
|
+
protected readonly options: ICommandsQuickAccessOptions;
|
|
39
|
+
constructor(options: ICommandsQuickAccessOptions, instantiationService: IInstantiationService, keybindingService: IKeybindingService, commandService: ICommandService, telemetryService: ITelemetryService, dialogService: IDialogService);
|
|
40
|
+
protected _getPicks(filter: string, _disposables: DisposableStore, token: CancellationToken, runOptions?: IQuickAccessProviderRunOptions): Promise<Picks<ICommandQuickPick> | FastAndSlowPicks<ICommandQuickPick>>;
|
|
41
|
+
private toCommandPick;
|
|
42
|
+
private getTfIdfChunk;
|
|
43
|
+
protected abstract getCommandPicks(token: CancellationToken): Promise<Array<ICommandQuickPick>>;
|
|
44
|
+
protected abstract hasAdditionalCommandPicks(filter: string, token: CancellationToken): boolean;
|
|
45
|
+
protected abstract getAdditionalCommandPicks(allPicks: ICommandQuickPick[], picksSoFar: ICommandQuickPick[], filter: string, token: CancellationToken): Promise<Array<ICommandQuickPick | IQuickPickSeparator>>;
|
|
46
|
+
}
|
|
47
|
+
export declare class CommandsHistory extends Disposable {
|
|
48
|
+
private readonly storageService;
|
|
49
|
+
private readonly configurationService;
|
|
50
|
+
private readonly logService;
|
|
51
|
+
static readonly DEFAULT_COMMANDS_HISTORY_LENGTH = 50;
|
|
52
|
+
private static readonly PREF_KEY_CACHE;
|
|
53
|
+
private static readonly PREF_KEY_COUNTER;
|
|
54
|
+
private static cache;
|
|
55
|
+
private static counter;
|
|
56
|
+
private static hasChanges;
|
|
57
|
+
private configuredCommandsHistoryLength;
|
|
58
|
+
constructor(storageService: IStorageService, configurationService: IConfigurationService, logService: ILogService);
|
|
59
|
+
private registerListeners;
|
|
60
|
+
private updateConfiguration;
|
|
61
|
+
private load;
|
|
62
|
+
push(commandId: string): void;
|
|
63
|
+
peek(commandId: string): number | undefined;
|
|
64
|
+
private saveState;
|
|
65
|
+
static getConfiguredCommandHistoryLength(configurationService: IConfigurationService): number;
|
|
66
|
+
static clearHistory(configurationService: IConfigurationService, storageService: IStorageService): void;
|
|
67
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
3
4
|
import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
4
5
|
import { or, matchesPrefix, matchesWords, matchesContiguousSubString } from 'vscode/vscode/vs/base/common/filters';
|
|
5
6
|
import { createSingleCallFunction } from 'vscode/vscode/vs/base/common/functional';
|
|
6
7
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
8
|
import { LRUCache } from 'vscode/vscode/vs/base/common/map';
|
|
8
|
-
import { TfIdfCalculator, normalizeTfIdfScores } from 'vscode/vscode/vs/base/common/tfIdf';
|
|
9
|
+
import { TfIdfCalculator, normalizeTfIdfScores } from '@codingame/monaco-vscode-fc985c90-0334-5b62-88bc-73e2efa0b80b-common/vscode/vs/base/common/tfIdf';
|
|
9
10
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
10
11
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
11
12
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
@@ -13,8 +14,8 @@ import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs
|
|
|
13
14
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
15
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
15
16
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
16
|
-
import { PickerQuickAccessProvider } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
|
|
17
|
-
import { WillSaveStateReason } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
17
|
+
import { PickerQuickAccessProvider } from '@codingame/monaco-vscode-219d9a5f-b446-507b-a188-1178a0867c75-common/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
|
|
18
|
+
import { WillSaveStateReason, StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
18
19
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
19
20
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
20
21
|
|
|
@@ -41,11 +42,11 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
41
42
|
return [];
|
|
42
43
|
}
|
|
43
44
|
const runTfidf = createSingleCallFunction(() => {
|
|
44
|
-
const tfidf = (
|
|
45
|
-
tfidf.updateDocuments((
|
|
45
|
+
const tfidf = ( new TfIdfCalculator());
|
|
46
|
+
tfidf.updateDocuments(( allCommandPicks.map(commandPick => ({
|
|
46
47
|
key: commandPick.commandId,
|
|
47
48
|
textChunks: [this.getTfIdfChunk(commandPick)]
|
|
48
|
-
}))))
|
|
49
|
+
}))));
|
|
49
50
|
const result = tfidf.calculateScores(filter, token);
|
|
50
51
|
return normalizeTfIdfScores(result)
|
|
51
52
|
.filter(score => score.score > AbstractCommandsQuickAccessProvider_1.TFIDF_THRESHOLD)
|
|
@@ -77,7 +78,7 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
const mapLabelToCommand = (
|
|
81
|
+
const mapLabelToCommand = ( new Map());
|
|
81
82
|
for (const commandPick of filteredCommandPicks) {
|
|
82
83
|
const existingCommandForLabel = mapLabelToCommand.get(commandPick.label);
|
|
83
84
|
if (existingCommandForLabel) {
|
|
@@ -113,8 +114,8 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
113
114
|
return 1;
|
|
114
115
|
}
|
|
115
116
|
if (this.options.suggestedCommandIds) {
|
|
116
|
-
const commandASuggestion = (
|
|
117
|
-
const commandBSuggestion = (
|
|
117
|
+
const commandASuggestion = ( this.options.suggestedCommandIds.has(commandPickA.commandId));
|
|
118
|
+
const commandBSuggestion = ( this.options.suggestedCommandIds.has(commandPickB.commandId));
|
|
118
119
|
if (commandASuggestion && commandBSuggestion) {
|
|
119
120
|
return 0;
|
|
120
121
|
}
|
|
@@ -134,20 +135,20 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
134
135
|
for (let i = 0; i < filteredCommandPicks.length; i++) {
|
|
135
136
|
const commandPick = filteredCommandPicks[i];
|
|
136
137
|
if (i === 0 && this.commandsHistory.peek(commandPick.commandId)) {
|
|
137
|
-
commandPicks.push({ type: 'separator', label: ( localize(
|
|
138
|
+
commandPicks.push({ type: 'separator', label: ( localize(1827, "recently used")) });
|
|
138
139
|
addOtherSeparator = true;
|
|
139
140
|
}
|
|
140
141
|
if (addSuggestedSeparator && commandPick.tfIdfScore !== undefined) {
|
|
141
|
-
commandPicks.push({ type: 'separator', label: ( localize(
|
|
142
|
+
commandPicks.push({ type: 'separator', label: ( localize(1828, "similar commands")) });
|
|
142
143
|
addSuggestedSeparator = false;
|
|
143
144
|
}
|
|
144
145
|
if (addCommonlyUsedSeparator && commandPick.tfIdfScore === undefined && !this.commandsHistory.peek(commandPick.commandId) && this.options.suggestedCommandIds?.has(commandPick.commandId)) {
|
|
145
|
-
commandPicks.push({ type: 'separator', label: ( localize(
|
|
146
|
+
commandPicks.push({ type: 'separator', label: ( localize(1829, "commonly used")) });
|
|
146
147
|
addOtherSeparator = true;
|
|
147
148
|
addCommonlyUsedSeparator = false;
|
|
148
149
|
}
|
|
149
150
|
if (addOtherSeparator && commandPick.tfIdfScore === undefined && !this.commandsHistory.peek(commandPick.commandId) && !this.options.suggestedCommandIds?.has(commandPick.commandId)) {
|
|
150
|
-
commandPicks.push({ type: 'separator', label: ( localize(
|
|
151
|
+
commandPicks.push({ type: 'separator', label: ( localize(1830, "other commands")) });
|
|
151
152
|
addOtherSeparator = false;
|
|
152
153
|
}
|
|
153
154
|
commandPicks.push(this.toCommandPick(commandPick, runOptions));
|
|
@@ -162,9 +163,9 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
162
163
|
if (token.isCancellationRequested) {
|
|
163
164
|
return [];
|
|
164
165
|
}
|
|
165
|
-
const commandPicks = (
|
|
166
|
+
const commandPicks = ( additionalCommandPicks.map(commandPick => this.toCommandPick(commandPick, runOptions)));
|
|
166
167
|
if (addSuggestedSeparator && commandPicks[0]?.type !== 'separator') {
|
|
167
|
-
commandPicks.unshift({ type: 'separator', label: ( localize(
|
|
168
|
+
commandPicks.unshift({ type: 'separator', label: ( localize(1828, "similar commands")) });
|
|
168
169
|
}
|
|
169
170
|
return commandPicks;
|
|
170
171
|
})()
|
|
@@ -176,7 +177,7 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
176
177
|
}
|
|
177
178
|
const keybinding = this.keybindingService.lookupKeybinding(commandPick.commandId);
|
|
178
179
|
const ariaLabel = keybinding ?
|
|
179
|
-
( localize(
|
|
180
|
+
( localize(1831, "{0}, {1}", commandPick.label, keybinding.getAriaLabel())) :
|
|
180
181
|
commandPick.label;
|
|
181
182
|
return {
|
|
182
183
|
...commandPick,
|
|
@@ -196,7 +197,7 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
196
197
|
}
|
|
197
198
|
catch (error) {
|
|
198
199
|
if (!isCancellationError(error)) {
|
|
199
|
-
this.dialogService.error(( localize(
|
|
200
|
+
this.dialogService.error(( localize(1832, "Command '{0}' resulted in an error", commandPick.label)), toErrorMessage(error));
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
}
|
|
@@ -213,13 +214,13 @@ let AbstractCommandsQuickAccessProvider = class AbstractCommandsQuickAccessProvi
|
|
|
213
214
|
return chunk;
|
|
214
215
|
}
|
|
215
216
|
};
|
|
216
|
-
AbstractCommandsQuickAccessProvider = AbstractCommandsQuickAccessProvider_1 = (
|
|
217
|
-
(
|
|
218
|
-
(
|
|
219
|
-
(
|
|
220
|
-
(
|
|
221
|
-
(
|
|
222
|
-
], AbstractCommandsQuickAccessProvider))
|
|
217
|
+
AbstractCommandsQuickAccessProvider = AbstractCommandsQuickAccessProvider_1 = ( __decorate([
|
|
218
|
+
( __param(1, IInstantiationService)),
|
|
219
|
+
( __param(2, IKeybindingService)),
|
|
220
|
+
( __param(3, ICommandService)),
|
|
221
|
+
( __param(4, ITelemetryService)),
|
|
222
|
+
( __param(5, IDialogService))
|
|
223
|
+
], AbstractCommandsQuickAccessProvider));
|
|
223
224
|
let CommandsHistory = class CommandsHistory extends Disposable {
|
|
224
225
|
static { CommandsHistory_1 = this; }
|
|
225
226
|
static { this.DEFAULT_COMMANDS_HISTORY_LENGTH = 50; }
|
|
@@ -256,7 +257,7 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
load() {
|
|
259
|
-
const raw = this.storageService.get(CommandsHistory_1.PREF_KEY_CACHE,
|
|
260
|
+
const raw = this.storageService.get(CommandsHistory_1.PREF_KEY_CACHE, StorageScope.PROFILE);
|
|
260
261
|
let serializedCache;
|
|
261
262
|
if (raw) {
|
|
262
263
|
try {
|
|
@@ -266,7 +267,7 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
266
267
|
this.logService.error(`[CommandsHistory] invalid data: ${error}`);
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
|
-
const cache = CommandsHistory_1.cache = (
|
|
270
|
+
const cache = CommandsHistory_1.cache = ( new LRUCache(this.configuredCommandsHistoryLength, 1));
|
|
270
271
|
if (serializedCache) {
|
|
271
272
|
let entries;
|
|
272
273
|
if (serializedCache.usesLRU) {
|
|
@@ -277,7 +278,7 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
277
278
|
}
|
|
278
279
|
entries.forEach(entry => cache.set(entry.key, entry.value));
|
|
279
280
|
}
|
|
280
|
-
CommandsHistory_1.counter = this.storageService.getNumber(CommandsHistory_1.PREF_KEY_COUNTER,
|
|
281
|
+
CommandsHistory_1.counter = this.storageService.getNumber(CommandsHistory_1.PREF_KEY_COUNTER, StorageScope.PROFILE, CommandsHistory_1.counter);
|
|
281
282
|
}
|
|
282
283
|
push(commandId) {
|
|
283
284
|
if (!CommandsHistory_1.cache) {
|
|
@@ -298,8 +299,8 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
298
299
|
}
|
|
299
300
|
const serializedCache = { usesLRU: true, entries: [] };
|
|
300
301
|
CommandsHistory_1.cache.forEach((value, key) => serializedCache.entries.push({ key, value }));
|
|
301
|
-
this.storageService.store(CommandsHistory_1.PREF_KEY_CACHE, JSON.stringify(serializedCache),
|
|
302
|
-
this.storageService.store(CommandsHistory_1.PREF_KEY_COUNTER, CommandsHistory_1.counter,
|
|
302
|
+
this.storageService.store(CommandsHistory_1.PREF_KEY_CACHE, JSON.stringify(serializedCache), StorageScope.PROFILE, StorageTarget.USER);
|
|
303
|
+
this.storageService.store(CommandsHistory_1.PREF_KEY_COUNTER, CommandsHistory_1.counter, StorageScope.PROFILE, StorageTarget.USER);
|
|
303
304
|
CommandsHistory_1.hasChanges = false;
|
|
304
305
|
}
|
|
305
306
|
static getConfiguredCommandHistoryLength(configurationService) {
|
|
@@ -312,15 +313,15 @@ let CommandsHistory = class CommandsHistory extends Disposable {
|
|
|
312
313
|
}
|
|
313
314
|
static clearHistory(configurationService, storageService) {
|
|
314
315
|
const commandHistoryLength = CommandsHistory_1.getConfiguredCommandHistoryLength(configurationService);
|
|
315
|
-
CommandsHistory_1.cache = (
|
|
316
|
+
CommandsHistory_1.cache = ( new LRUCache(commandHistoryLength));
|
|
316
317
|
CommandsHistory_1.counter = 1;
|
|
317
318
|
CommandsHistory_1.hasChanges = true;
|
|
318
319
|
}
|
|
319
320
|
};
|
|
320
|
-
CommandsHistory = CommandsHistory_1 = (
|
|
321
|
-
(
|
|
322
|
-
(
|
|
323
|
-
(
|
|
324
|
-
], CommandsHistory))
|
|
321
|
+
CommandsHistory = CommandsHistory_1 = ( __decorate([
|
|
322
|
+
( __param(0, IStorageService)),
|
|
323
|
+
( __param(1, IConfigurationService)),
|
|
324
|
+
( __param(2, ILogService))
|
|
325
|
+
], CommandsHistory));
|
|
325
326
|
|
|
326
327
|
export { AbstractCommandsQuickAccessProvider, CommandsHistory };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
2
|
+
import { IKeybindingService } from "vscode/vscode/vs/platform/keybinding/common/keybinding.service";
|
|
3
|
+
import { IQuickAccessProvider } from "vscode/vscode/vs/platform/quickinput/common/quickAccess";
|
|
4
|
+
import { IQuickPick, IQuickPickItem } from "vscode/vscode/vs/platform/quickinput/common/quickInput";
|
|
5
|
+
import { IQuickInputService } from "vscode/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
6
|
+
interface IHelpQuickAccessPickItem extends IQuickPickItem {
|
|
7
|
+
readonly prefix: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class HelpQuickAccessProvider implements IQuickAccessProvider {
|
|
10
|
+
private readonly quickInputService;
|
|
11
|
+
private readonly keybindingService;
|
|
12
|
+
static PREFIX: string;
|
|
13
|
+
private readonly registry;
|
|
14
|
+
constructor(quickInputService: IQuickInputService, keybindingService: IKeybindingService);
|
|
15
|
+
provide(picker: IQuickPick<IHelpQuickAccessPickItem, {
|
|
16
|
+
useSeparators: true;
|
|
17
|
+
}>): IDisposable;
|
|
18
|
+
getQuickAccessProviders(): IHelpQuickAccessPickItem[];
|
|
19
|
+
private createPicks;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
4
5
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
@@ -13,10 +14,10 @@ let HelpQuickAccessProvider = class HelpQuickAccessProvider {
|
|
|
13
14
|
constructor(quickInputService, keybindingService) {
|
|
14
15
|
this.quickInputService = quickInputService;
|
|
15
16
|
this.keybindingService = keybindingService;
|
|
16
|
-
this.registry = (
|
|
17
|
+
this.registry = ( Registry.as(Extensions.Quickaccess));
|
|
17
18
|
}
|
|
18
19
|
provide(picker) {
|
|
19
|
-
const disposables = (
|
|
20
|
+
const disposables = ( new DisposableStore());
|
|
20
21
|
disposables.add(picker.onDidAccept(() => {
|
|
21
22
|
const [item] = picker.selectedItems;
|
|
22
23
|
if (item) {
|
|
@@ -40,24 +41,22 @@ let HelpQuickAccessProvider = class HelpQuickAccessProvider {
|
|
|
40
41
|
return providers;
|
|
41
42
|
}
|
|
42
43
|
createPicks(provider) {
|
|
43
|
-
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}))
|
|
55
|
-
);
|
|
44
|
+
return (provider.helpEntries.map(helpEntry => {
|
|
45
|
+
const prefix = helpEntry.prefix || provider.prefix;
|
|
46
|
+
const label = prefix || '\u2026' ;
|
|
47
|
+
return {
|
|
48
|
+
prefix,
|
|
49
|
+
label,
|
|
50
|
+
keybinding: helpEntry.commandId ? this.keybindingService.lookupKeybinding(helpEntry.commandId) : undefined,
|
|
51
|
+
ariaLabel: ( localize(1833, "{0}, {1}", label, helpEntry.description)),
|
|
52
|
+
description: helpEntry.description
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
|
-
HelpQuickAccessProvider = HelpQuickAccessProvider_1 = (
|
|
59
|
-
(
|
|
60
|
-
(
|
|
61
|
-
], HelpQuickAccessProvider))
|
|
57
|
+
HelpQuickAccessProvider = HelpQuickAccessProvider_1 = ( __decorate([
|
|
58
|
+
( __param(0, IQuickInputService)),
|
|
59
|
+
( __param(1, IKeybindingService))
|
|
60
|
+
], HelpQuickAccessProvider));
|
|
62
61
|
|
|
63
62
|
export { HelpQuickAccessProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|