@codingame/monaco-vscode-search-service-override 3.2.3 → 4.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 +2 -2
- package/search.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/override/vs/platform/dialogs/common/dialogs.js +0 -8
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +0 -776
- package/vscode/src/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/search/browser/media/searchview.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +0 -231
- package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +0 -342
- package/vscode/src/vs/workbench/contrib/search/browser/replaceContributions.js +0 -8
- package/vscode/src/vs/workbench/contrib/search/browser/replaceService.js +0 -232
- package/vscode/src/vs/workbench/contrib/search/browser/search.contribution.js +0 -621
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +0 -209
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +0 -511
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +0 -374
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsSymbol.js +0 -43
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +0 -44
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +0 -323
- package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +0 -47
- package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +0 -96
- package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +0 -66
- package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +0 -434
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +0 -2096
- package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +0 -667
- package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +0 -234
- package/vscode/src/vs/workbench/contrib/search/common/cacheState.js +0 -87
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +0 -586
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.js +0 -736
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +0 -189
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +0 -320
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +0 -138
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +0 -293
- package/vscode/src/vs/workbench/services/search/common/searchService.js +0 -372
|
@@ -1,776 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './media/anythingQuickAccess.css.js';
|
|
3
|
-
import { QuickPickItemScorerAccessor, QuickInputHideReason, quickPickItemScorerAccessor, IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
4
|
-
import { PickerQuickAccessProvider, TriggerAction } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
|
|
5
|
-
import { prepareQuery, compareItemsByFuzzyScore, scoreItemFuzzy } from 'vscode/vscode/vs/base/common/fuzzyScorer';
|
|
6
|
-
import { QueryBuilder } from 'vscode/vscode/vs/workbench/services/search/common/queryBuilder';
|
|
7
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
-
import { extractRangeFromFilter, getOutOfWorkspaceEditorResources } from 'vscode/vscode/vs/workbench/contrib/search/common/search';
|
|
9
|
-
import { ISearchService } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
10
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
11
|
-
import { untildify } from 'vscode/vscode/vs/base/common/labels';
|
|
12
|
-
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
13
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
14
|
-
import { toLocalResource, basenameOrAuthority, dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
15
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
16
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
17
|
-
import { DisposableStore, MutableDisposable, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
18
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
19
|
-
import { getIconClasses } from 'vscode/vscode/vs/editor/common/services/getIconClasses';
|
|
20
|
-
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
21
|
-
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
22
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
23
|
-
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService';
|
|
24
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
25
|
-
import { isEditorInput, EditorResourceAccessor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
26
|
-
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
27
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
28
|
-
import { ThrottledDelayer } from 'vscode/vscode/vs/base/common/async';
|
|
29
|
-
import { top } from 'vscode/vscode/vs/base/common/arrays';
|
|
30
|
-
import { FileQueryCacheState } from '../common/cacheState.js';
|
|
31
|
-
import { IHistoryService } from 'vscode/vscode/vs/workbench/services/history/common/history';
|
|
32
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
33
|
-
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
34
|
-
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
35
|
-
import { SymbolsQuickAccessProvider } from './symbolsQuickAccess.js';
|
|
36
|
-
import { DefaultQuickAccessFilterValue, Extensions } from 'vscode/vscode/vs/platform/quickinput/common/quickAccess';
|
|
37
|
-
import { EditorViewState } from 'vscode/vscode/vs/workbench/browser/quickaccess';
|
|
38
|
-
import { GotoSymbolQuickAccessProvider } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess';
|
|
39
|
-
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
40
|
-
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
41
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
42
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
43
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
44
|
-
import { stripIcons } from 'vscode/vscode/vs/base/common/iconLabels';
|
|
45
|
-
import { Lazy } from 'vscode/vscode/vs/base/common/lazy';
|
|
46
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
47
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
48
|
-
import { ASK_QUICK_QUESTION_ACTION_ID } from 'vscode/vscode/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions';
|
|
49
|
-
import { IQuickChatService } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chat';
|
|
50
|
-
|
|
51
|
-
var AnythingQuickAccessProvider_1;
|
|
52
|
-
function isEditorSymbolQuickPickItem(pick) {
|
|
53
|
-
const candidate = pick;
|
|
54
|
-
return !!candidate?.range && !!candidate.resource;
|
|
55
|
-
}
|
|
56
|
-
let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends PickerQuickAccessProvider {
|
|
57
|
-
static { AnythingQuickAccessProvider_1 = this; }
|
|
58
|
-
static { this.PREFIX = ''; }
|
|
59
|
-
static { this.NO_RESULTS_PICK = {
|
|
60
|
-
label: ( localizeWithPath(
|
|
61
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
62
|
-
'noAnythingResults',
|
|
63
|
-
"No matching results"
|
|
64
|
-
))
|
|
65
|
-
}; }
|
|
66
|
-
static { this.MAX_RESULTS = 512; }
|
|
67
|
-
static { this.TYPING_SEARCH_DELAY = 200; }
|
|
68
|
-
static { this.SYMBOL_PICKS_MERGE_DELAY = 200; }
|
|
69
|
-
get defaultFilterValue() {
|
|
70
|
-
if (this.configuration.preserveInput) {
|
|
71
|
-
return DefaultQuickAccessFilterValue.LAST;
|
|
72
|
-
}
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
constructor(instantiationService, searchService, contextService, pathService, environmentService, fileService, labelService, modelService, languageService, workingCopyService, configurationService, editorService, historyService, filesConfigurationService, textModelService, uriIdentityService, quickInputService, keybindingService, quickChatService) {
|
|
76
|
-
super(AnythingQuickAccessProvider_1.PREFIX, {
|
|
77
|
-
canAcceptInBackground: true,
|
|
78
|
-
noResultsPick: AnythingQuickAccessProvider_1.NO_RESULTS_PICK
|
|
79
|
-
});
|
|
80
|
-
this.instantiationService = instantiationService;
|
|
81
|
-
this.searchService = searchService;
|
|
82
|
-
this.contextService = contextService;
|
|
83
|
-
this.pathService = pathService;
|
|
84
|
-
this.environmentService = environmentService;
|
|
85
|
-
this.fileService = fileService;
|
|
86
|
-
this.labelService = labelService;
|
|
87
|
-
this.modelService = modelService;
|
|
88
|
-
this.languageService = languageService;
|
|
89
|
-
this.workingCopyService = workingCopyService;
|
|
90
|
-
this.configurationService = configurationService;
|
|
91
|
-
this.editorService = editorService;
|
|
92
|
-
this.historyService = historyService;
|
|
93
|
-
this.filesConfigurationService = filesConfigurationService;
|
|
94
|
-
this.textModelService = textModelService;
|
|
95
|
-
this.uriIdentityService = uriIdentityService;
|
|
96
|
-
this.quickInputService = quickInputService;
|
|
97
|
-
this.keybindingService = keybindingService;
|
|
98
|
-
this.quickChatService = quickChatService;
|
|
99
|
-
this.pickState = new (class {
|
|
100
|
-
constructor(provider, editorService) {
|
|
101
|
-
this.provider = provider;
|
|
102
|
-
this.picker = undefined;
|
|
103
|
-
this.scorerCache = Object.create(null);
|
|
104
|
-
this.fileQueryCache = undefined;
|
|
105
|
-
this.lastOriginalFilter = undefined;
|
|
106
|
-
this.lastFilter = undefined;
|
|
107
|
-
this.lastRange = undefined;
|
|
108
|
-
this.lastGlobalPicks = undefined;
|
|
109
|
-
this.isQuickNavigating = undefined;
|
|
110
|
-
this.editorViewState = ( new EditorViewState(editorService));
|
|
111
|
-
}
|
|
112
|
-
set(picker) {
|
|
113
|
-
this.picker = picker;
|
|
114
|
-
Event.once(picker.onDispose)(() => {
|
|
115
|
-
if (picker === this.picker) {
|
|
116
|
-
this.picker = undefined;
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const isQuickNavigating = !!picker.quickNavigate;
|
|
120
|
-
if (!isQuickNavigating) {
|
|
121
|
-
this.fileQueryCache = this.provider.createFileQueryCache();
|
|
122
|
-
this.scorerCache = Object.create(null);
|
|
123
|
-
}
|
|
124
|
-
this.isQuickNavigating = isQuickNavigating;
|
|
125
|
-
this.lastOriginalFilter = undefined;
|
|
126
|
-
this.lastFilter = undefined;
|
|
127
|
-
this.lastRange = undefined;
|
|
128
|
-
this.lastGlobalPicks = undefined;
|
|
129
|
-
this.editorViewState.reset();
|
|
130
|
-
}
|
|
131
|
-
})(this, this.editorService);
|
|
132
|
-
this.labelOnlyEditorHistoryPickAccessor = ( new QuickPickItemScorerAccessor({ skipDescription: true }));
|
|
133
|
-
this.fileQueryDelayer = this._register(( new ThrottledDelayer(AnythingQuickAccessProvider_1.TYPING_SEARCH_DELAY)));
|
|
134
|
-
this.fileQueryBuilder = this.instantiationService.createInstance(QueryBuilder);
|
|
135
|
-
this.lazyRegistry = ( new Lazy(() => ( Registry.as(Extensions.Quickaccess))));
|
|
136
|
-
this.workspaceSymbolsQuickAccess = this._register(this.instantiationService.createInstance(SymbolsQuickAccessProvider));
|
|
137
|
-
this.editorSymbolsQuickAccess = this.instantiationService.createInstance(GotoSymbolQuickAccessProvider);
|
|
138
|
-
}
|
|
139
|
-
get configuration() {
|
|
140
|
-
const editorConfig = this.configurationService.getValue().workbench?.editor;
|
|
141
|
-
const searchConfig = this.configurationService.getValue().search;
|
|
142
|
-
const quickAccessConfig = this.configurationService.getValue().workbench.quickOpen;
|
|
143
|
-
return {
|
|
144
|
-
openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
|
|
145
|
-
openSideBySideDirection: editorConfig?.openSideBySideDirection,
|
|
146
|
-
includeSymbols: searchConfig?.quickOpen.includeSymbols,
|
|
147
|
-
includeHistory: searchConfig?.quickOpen.includeHistory,
|
|
148
|
-
historyFilterSortOrder: searchConfig?.quickOpen.history.filterSortOrder,
|
|
149
|
-
preserveInput: quickAccessConfig.preserveInput
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
provide(picker, token, runOptions) {
|
|
153
|
-
const disposables = ( new DisposableStore());
|
|
154
|
-
this.pickState.set(picker);
|
|
155
|
-
const editorDecorationsDisposable = disposables.add(( new MutableDisposable()));
|
|
156
|
-
disposables.add(picker.onDidChangeActive(() => {
|
|
157
|
-
editorDecorationsDisposable.value = undefined;
|
|
158
|
-
const [item] = picker.activeItems;
|
|
159
|
-
if (isEditorSymbolQuickPickItem(item)) {
|
|
160
|
-
editorDecorationsDisposable.value = this.decorateAndRevealSymbolRange(item);
|
|
161
|
-
}
|
|
162
|
-
}));
|
|
163
|
-
disposables.add(Event.once(picker.onDidHide)(({ reason }) => {
|
|
164
|
-
if (reason === QuickInputHideReason.Gesture) {
|
|
165
|
-
this.pickState.editorViewState.restore();
|
|
166
|
-
}
|
|
167
|
-
}));
|
|
168
|
-
disposables.add(super.provide(picker, token, runOptions));
|
|
169
|
-
return disposables;
|
|
170
|
-
}
|
|
171
|
-
decorateAndRevealSymbolRange(pick) {
|
|
172
|
-
const activeEditor = this.editorService.activeEditor;
|
|
173
|
-
if (!this.uriIdentityService.extUri.isEqual(pick.resource, activeEditor?.resource)) {
|
|
174
|
-
return Disposable.None;
|
|
175
|
-
}
|
|
176
|
-
const activeEditorControl = this.editorService.activeTextEditorControl;
|
|
177
|
-
if (!activeEditorControl) {
|
|
178
|
-
return Disposable.None;
|
|
179
|
-
}
|
|
180
|
-
this.pickState.editorViewState.set();
|
|
181
|
-
activeEditorControl.revealRangeInCenter(pick.range.selection, 0 );
|
|
182
|
-
this.addDecorations(activeEditorControl, pick.range.decoration);
|
|
183
|
-
return toDisposable(() => this.clearDecorations(activeEditorControl));
|
|
184
|
-
}
|
|
185
|
-
_getPicks(originalFilter, disposables, token, runOptions) {
|
|
186
|
-
const filterWithRange = extractRangeFromFilter(originalFilter, [GotoSymbolQuickAccessProvider.PREFIX]);
|
|
187
|
-
let filter;
|
|
188
|
-
if (filterWithRange) {
|
|
189
|
-
filter = filterWithRange.filter;
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
filter = originalFilter;
|
|
193
|
-
}
|
|
194
|
-
this.pickState.lastRange = filterWithRange?.range;
|
|
195
|
-
if (originalFilter !== this.pickState.lastOriginalFilter && filter === this.pickState.lastFilter) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
const lastWasFiltering = !!this.pickState.lastOriginalFilter;
|
|
199
|
-
this.pickState.lastOriginalFilter = originalFilter;
|
|
200
|
-
this.pickState.lastFilter = filter;
|
|
201
|
-
const picks = this.pickState.picker?.items;
|
|
202
|
-
const activePick = this.pickState.picker?.activeItems[0];
|
|
203
|
-
if (picks && activePick) {
|
|
204
|
-
const activePickIsEditorSymbol = isEditorSymbolQuickPickItem(activePick);
|
|
205
|
-
const activePickIsNoResultsInEditorSymbols = activePick === AnythingQuickAccessProvider_1.NO_RESULTS_PICK && filter.indexOf(GotoSymbolQuickAccessProvider.PREFIX) >= 0;
|
|
206
|
-
if (!activePickIsEditorSymbol && !activePickIsNoResultsInEditorSymbols) {
|
|
207
|
-
this.pickState.lastGlobalPicks = {
|
|
208
|
-
items: picks,
|
|
209
|
-
active: activePick
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return this.doGetPicks(filter, { enableEditorSymbolSearch: lastWasFiltering, includeHelp: runOptions?.includeHelp, from: runOptions?.from }, disposables, token);
|
|
214
|
-
}
|
|
215
|
-
doGetPicks(filter, options, disposables, token) {
|
|
216
|
-
const query = prepareQuery(filter);
|
|
217
|
-
if (options.enableEditorSymbolSearch) {
|
|
218
|
-
const editorSymbolPicks = this.getEditorSymbolPicks(query, disposables, token);
|
|
219
|
-
if (editorSymbolPicks) {
|
|
220
|
-
return editorSymbolPicks;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
const activePick = this.pickState.picker?.activeItems[0];
|
|
224
|
-
if (isEditorSymbolQuickPickItem(activePick) && this.pickState.lastGlobalPicks) {
|
|
225
|
-
return this.pickState.lastGlobalPicks;
|
|
226
|
-
}
|
|
227
|
-
const historyEditorPicks = this.getEditorHistoryPicks(query);
|
|
228
|
-
let picks;
|
|
229
|
-
if (this.pickState.isQuickNavigating) {
|
|
230
|
-
picks = historyEditorPicks;
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
picks = [];
|
|
234
|
-
if (options.includeHelp) {
|
|
235
|
-
picks.push(...this.getHelpPicks(query, token, options));
|
|
236
|
-
}
|
|
237
|
-
if (historyEditorPicks.length !== 0) {
|
|
238
|
-
picks.push({ type: 'separator', label: ( localizeWithPath(
|
|
239
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
240
|
-
'recentlyOpenedSeparator',
|
|
241
|
-
"recently opened"
|
|
242
|
-
)) });
|
|
243
|
-
picks.push(...historyEditorPicks);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return {
|
|
247
|
-
picks,
|
|
248
|
-
additionalPicks: (async () => {
|
|
249
|
-
const additionalPicksExcludes = ( new ResourceMap());
|
|
250
|
-
for (const historyEditorPick of historyEditorPicks) {
|
|
251
|
-
if (historyEditorPick.resource) {
|
|
252
|
-
additionalPicksExcludes.set(historyEditorPick.resource, true);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
const additionalPicks = await this.getAdditionalPicks(query, additionalPicksExcludes, token);
|
|
256
|
-
if (token.isCancellationRequested) {
|
|
257
|
-
return [];
|
|
258
|
-
}
|
|
259
|
-
return additionalPicks.length > 0 ? [
|
|
260
|
-
{ type: 'separator', label: this.configuration.includeSymbols ? ( localizeWithPath(
|
|
261
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
262
|
-
'fileAndSymbolResultsSeparator',
|
|
263
|
-
"file and symbol results"
|
|
264
|
-
)) : ( localizeWithPath(
|
|
265
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
266
|
-
'fileResultsSeparator',
|
|
267
|
-
"file results"
|
|
268
|
-
)) },
|
|
269
|
-
...additionalPicks
|
|
270
|
-
] : [];
|
|
271
|
-
})(),
|
|
272
|
-
mergeDelay: AnythingQuickAccessProvider_1.SYMBOL_PICKS_MERGE_DELAY
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
async getAdditionalPicks(query, excludes, token) {
|
|
276
|
-
const [filePicks, symbolPicks] = await Promise.all([
|
|
277
|
-
this.getFilePicks(query, excludes, token),
|
|
278
|
-
this.getWorkspaceSymbolPicks(query, token)
|
|
279
|
-
]);
|
|
280
|
-
if (token.isCancellationRequested) {
|
|
281
|
-
return [];
|
|
282
|
-
}
|
|
283
|
-
const sortedAnythingPicks = top([...filePicks, ...symbolPicks], (anyPickA, anyPickB) => compareItemsByFuzzyScore(anyPickA, anyPickB, query, true, quickPickItemScorerAccessor, this.pickState.scorerCache), AnythingQuickAccessProvider_1.MAX_RESULTS);
|
|
284
|
-
const filteredAnythingPicks = [];
|
|
285
|
-
for (const anythingPick of sortedAnythingPicks) {
|
|
286
|
-
if (anythingPick.highlights) {
|
|
287
|
-
filteredAnythingPicks.push(anythingPick);
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
const { score, labelMatch, descriptionMatch } = scoreItemFuzzy(anythingPick, query, true, quickPickItemScorerAccessor, this.pickState.scorerCache);
|
|
291
|
-
if (!score) {
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
anythingPick.highlights = {
|
|
295
|
-
label: labelMatch,
|
|
296
|
-
description: descriptionMatch
|
|
297
|
-
};
|
|
298
|
-
filteredAnythingPicks.push(anythingPick);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return filteredAnythingPicks;
|
|
302
|
-
}
|
|
303
|
-
getEditorHistoryPicks(query) {
|
|
304
|
-
const configuration = this.configuration;
|
|
305
|
-
if (!query.normalized) {
|
|
306
|
-
return ( this.historyService.getHistory().map(editor => this.createAnythingPick(editor, configuration)));
|
|
307
|
-
}
|
|
308
|
-
if (!this.configuration.includeHistory) {
|
|
309
|
-
return [];
|
|
310
|
-
}
|
|
311
|
-
const editorHistoryScorerAccessor = query.containsPathSeparator ? quickPickItemScorerAccessor : this.labelOnlyEditorHistoryPickAccessor;
|
|
312
|
-
const editorHistoryPicks = [];
|
|
313
|
-
for (const editor of this.historyService.getHistory()) {
|
|
314
|
-
const resource = editor.resource;
|
|
315
|
-
if (!resource || (!this.fileService.hasProvider(resource) && resource.scheme !== Schemas.untitled && resource.scheme !== Schemas.vscodeTerminal)) {
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
const editorHistoryPick = this.createAnythingPick(editor, configuration);
|
|
319
|
-
const { score, labelMatch, descriptionMatch } = scoreItemFuzzy(editorHistoryPick, query, false, editorHistoryScorerAccessor, this.pickState.scorerCache);
|
|
320
|
-
if (!score) {
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
editorHistoryPick.highlights = {
|
|
324
|
-
label: labelMatch,
|
|
325
|
-
description: descriptionMatch
|
|
326
|
-
};
|
|
327
|
-
editorHistoryPicks.push(editorHistoryPick);
|
|
328
|
-
}
|
|
329
|
-
if (this.configuration.historyFilterSortOrder === 'recency') {
|
|
330
|
-
return editorHistoryPicks;
|
|
331
|
-
}
|
|
332
|
-
return editorHistoryPicks.sort((editorA, editorB) => compareItemsByFuzzyScore(editorA, editorB, query, false, editorHistoryScorerAccessor, this.pickState.scorerCache));
|
|
333
|
-
}
|
|
334
|
-
createFileQueryCache() {
|
|
335
|
-
return ( new FileQueryCacheState(
|
|
336
|
-
cacheKey => this.fileQueryBuilder.file(this.contextService.getWorkspace().folders, this.getFileQueryOptions({ cacheKey })),
|
|
337
|
-
query => this.searchService.fileSearch(query),
|
|
338
|
-
cacheKey => this.searchService.clearCache(cacheKey),
|
|
339
|
-
this.pickState.fileQueryCache
|
|
340
|
-
)).load();
|
|
341
|
-
}
|
|
342
|
-
async getFilePicks(query, excludes, token) {
|
|
343
|
-
if (!query.normalized) {
|
|
344
|
-
return [];
|
|
345
|
-
}
|
|
346
|
-
const absolutePathResult = await this.getAbsolutePathFileResult(query, token);
|
|
347
|
-
if (token.isCancellationRequested) {
|
|
348
|
-
return [];
|
|
349
|
-
}
|
|
350
|
-
let fileMatches;
|
|
351
|
-
if (absolutePathResult) {
|
|
352
|
-
if (( excludes.has(absolutePathResult))) {
|
|
353
|
-
return [];
|
|
354
|
-
}
|
|
355
|
-
const absolutePathPick = this.createAnythingPick(absolutePathResult, this.configuration);
|
|
356
|
-
absolutePathPick.highlights = {
|
|
357
|
-
label: [{ start: 0, end: absolutePathPick.label.length }],
|
|
358
|
-
description: absolutePathPick.description ? [{ start: 0, end: absolutePathPick.description.length }] : undefined
|
|
359
|
-
};
|
|
360
|
-
return [absolutePathPick];
|
|
361
|
-
}
|
|
362
|
-
if (this.pickState.fileQueryCache?.isLoaded) {
|
|
363
|
-
fileMatches = await this.doFileSearch(query, token);
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
fileMatches = await this.fileQueryDelayer.trigger(async () => {
|
|
367
|
-
if (token.isCancellationRequested) {
|
|
368
|
-
return [];
|
|
369
|
-
}
|
|
370
|
-
return this.doFileSearch(query, token);
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
if (token.isCancellationRequested) {
|
|
374
|
-
return [];
|
|
375
|
-
}
|
|
376
|
-
const configuration = this.configuration;
|
|
377
|
-
return ( fileMatches
|
|
378
|
-
.filter(resource => !( excludes.has(resource)))
|
|
379
|
-
.map(resource => this.createAnythingPick(resource, configuration)));
|
|
380
|
-
}
|
|
381
|
-
async doFileSearch(query, token) {
|
|
382
|
-
const [fileSearchResults, relativePathFileResults] = await Promise.all([
|
|
383
|
-
this.getFileSearchResults(query, token),
|
|
384
|
-
this.getRelativePathFileResults(query, token)
|
|
385
|
-
]);
|
|
386
|
-
if (token.isCancellationRequested) {
|
|
387
|
-
return [];
|
|
388
|
-
}
|
|
389
|
-
if (!relativePathFileResults) {
|
|
390
|
-
return fileSearchResults;
|
|
391
|
-
}
|
|
392
|
-
const relativePathFileResultsMap = ( new ResourceMap());
|
|
393
|
-
for (const relativePathFileResult of relativePathFileResults) {
|
|
394
|
-
relativePathFileResultsMap.set(relativePathFileResult, true);
|
|
395
|
-
}
|
|
396
|
-
return [
|
|
397
|
-
...fileSearchResults.filter(result => !( relativePathFileResultsMap.has(result))),
|
|
398
|
-
...relativePathFileResults
|
|
399
|
-
];
|
|
400
|
-
}
|
|
401
|
-
async getFileSearchResults(query, token) {
|
|
402
|
-
let filePattern = '';
|
|
403
|
-
if (query.values && query.values.length > 1) {
|
|
404
|
-
filePattern = query.values[0].original;
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
filePattern = query.original;
|
|
408
|
-
}
|
|
409
|
-
const fileSearchResults = await this.doGetFileSearchResults(filePattern, token);
|
|
410
|
-
if (token.isCancellationRequested) {
|
|
411
|
-
return [];
|
|
412
|
-
}
|
|
413
|
-
if (fileSearchResults.limitHit && query.values && query.values.length > 1) {
|
|
414
|
-
const additionalFileSearchResults = await this.doGetFileSearchResults(query.original, token);
|
|
415
|
-
if (token.isCancellationRequested) {
|
|
416
|
-
return [];
|
|
417
|
-
}
|
|
418
|
-
const existingFileSearchResultsMap = ( new ResourceMap());
|
|
419
|
-
for (const fileSearchResult of fileSearchResults.results) {
|
|
420
|
-
existingFileSearchResultsMap.set(fileSearchResult.resource, true);
|
|
421
|
-
}
|
|
422
|
-
for (const additionalFileSearchResult of additionalFileSearchResults.results) {
|
|
423
|
-
if (!( existingFileSearchResultsMap.has(additionalFileSearchResult.resource))) {
|
|
424
|
-
fileSearchResults.results.push(additionalFileSearchResult);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
return ( fileSearchResults.results.map(result => result.resource));
|
|
429
|
-
}
|
|
430
|
-
doGetFileSearchResults(filePattern, token) {
|
|
431
|
-
return this.searchService.fileSearch(this.fileQueryBuilder.file(this.contextService.getWorkspace().folders, this.getFileQueryOptions({
|
|
432
|
-
filePattern,
|
|
433
|
-
cacheKey: this.pickState.fileQueryCache?.cacheKey,
|
|
434
|
-
maxResults: AnythingQuickAccessProvider_1.MAX_RESULTS
|
|
435
|
-
})), token);
|
|
436
|
-
}
|
|
437
|
-
getFileQueryOptions(input) {
|
|
438
|
-
return {
|
|
439
|
-
_reason: 'openFileHandler',
|
|
440
|
-
extraFileResources: this.instantiationService.invokeFunction(getOutOfWorkspaceEditorResources),
|
|
441
|
-
filePattern: input.filePattern || '',
|
|
442
|
-
cacheKey: input.cacheKey,
|
|
443
|
-
maxResults: input.maxResults || 0,
|
|
444
|
-
sortByScore: true
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
async getAbsolutePathFileResult(query, token) {
|
|
448
|
-
if (!query.containsPathSeparator) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
const userHome = await this.pathService.userHome();
|
|
452
|
-
const detildifiedQuery = untildify(query.original, userHome.scheme === Schemas.file ? userHome.fsPath : userHome.path);
|
|
453
|
-
if (token.isCancellationRequested) {
|
|
454
|
-
return;
|
|
455
|
-
}
|
|
456
|
-
const isAbsolutePathQuery = (await this.pathService.path).isAbsolute(detildifiedQuery);
|
|
457
|
-
if (token.isCancellationRequested) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
if (isAbsolutePathQuery) {
|
|
461
|
-
const resource = toLocalResource(await this.pathService.fileURI(detildifiedQuery), this.environmentService.remoteAuthority, this.pathService.defaultUriScheme);
|
|
462
|
-
if (token.isCancellationRequested) {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
try {
|
|
466
|
-
if ((await this.fileService.stat(resource)).isFile) {
|
|
467
|
-
return resource;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
catch (error) {
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
async getRelativePathFileResults(query, token) {
|
|
476
|
-
if (!query.containsPathSeparator) {
|
|
477
|
-
return;
|
|
478
|
-
}
|
|
479
|
-
const isAbsolutePathQuery = (await this.pathService.path).isAbsolute(query.original);
|
|
480
|
-
if (!isAbsolutePathQuery) {
|
|
481
|
-
const resources = [];
|
|
482
|
-
for (const folder of this.contextService.getWorkspace().folders) {
|
|
483
|
-
if (token.isCancellationRequested) {
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
const resource = toLocalResource(folder.toResource(query.original), this.environmentService.remoteAuthority, this.pathService.defaultUriScheme);
|
|
487
|
-
try {
|
|
488
|
-
if ((await this.fileService.stat(resource)).isFile) {
|
|
489
|
-
resources.push(resource);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
catch (error) {
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
return resources;
|
|
496
|
-
}
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
getHelpPicks(query, token, runOptions) {
|
|
500
|
-
if (query.normalized) {
|
|
501
|
-
return [];
|
|
502
|
-
}
|
|
503
|
-
const providers = this.lazyRegistry.value.getQuickAccessProviders()
|
|
504
|
-
.filter(p => ( p.helpEntries.some(h => h.commandCenterOrder !== undefined)))
|
|
505
|
-
.flatMap(provider => ( provider.helpEntries
|
|
506
|
-
.filter(h => h.commandCenterOrder !== undefined)
|
|
507
|
-
.map(helpEntry => {
|
|
508
|
-
const providerSpecificOptions = {
|
|
509
|
-
...runOptions,
|
|
510
|
-
includeHelp: provider.prefix === AnythingQuickAccessProvider_1.PREFIX ? false : runOptions?.includeHelp
|
|
511
|
-
};
|
|
512
|
-
const label = helpEntry.commandCenterLabel ?? helpEntry.description;
|
|
513
|
-
return {
|
|
514
|
-
label,
|
|
515
|
-
description: helpEntry.prefix ?? provider.prefix,
|
|
516
|
-
commandCenterOrder: helpEntry.commandCenterOrder,
|
|
517
|
-
keybinding: helpEntry.commandId ? this.keybindingService.lookupKeybinding(helpEntry.commandId) : undefined,
|
|
518
|
-
ariaLabel: ( localizeWithPath(
|
|
519
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
520
|
-
'helpPickAriaLabel',
|
|
521
|
-
"{0}, {1}",
|
|
522
|
-
label,
|
|
523
|
-
helpEntry.description
|
|
524
|
-
)),
|
|
525
|
-
accept: () => {
|
|
526
|
-
this.quickInputService.quickAccess.show(provider.prefix, {
|
|
527
|
-
preserveValue: true,
|
|
528
|
-
providerOptions: providerSpecificOptions
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
})));
|
|
533
|
-
if (this.quickChatService.enabled) {
|
|
534
|
-
providers.push({
|
|
535
|
-
label: ( localizeWithPath(
|
|
536
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
537
|
-
'chat',
|
|
538
|
-
"Open Quick Chat"
|
|
539
|
-
)),
|
|
540
|
-
commandCenterOrder: 30,
|
|
541
|
-
keybinding: this.keybindingService.lookupKeybinding(ASK_QUICK_QUESTION_ACTION_ID),
|
|
542
|
-
accept: () => this.quickChatService.toggle()
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
return providers.sort((a, b) => a.commandCenterOrder - b.commandCenterOrder);
|
|
546
|
-
}
|
|
547
|
-
async getWorkspaceSymbolPicks(query, token) {
|
|
548
|
-
const configuration = this.configuration;
|
|
549
|
-
if (!query.normalized ||
|
|
550
|
-
!configuration.includeSymbols ||
|
|
551
|
-
this.pickState.lastRange
|
|
552
|
-
) {
|
|
553
|
-
return [];
|
|
554
|
-
}
|
|
555
|
-
return this.workspaceSymbolsQuickAccess.getSymbolPicks(query.original, {
|
|
556
|
-
skipLocal: true,
|
|
557
|
-
skipSorting: true,
|
|
558
|
-
delay: AnythingQuickAccessProvider_1.TYPING_SEARCH_DELAY
|
|
559
|
-
}, token);
|
|
560
|
-
}
|
|
561
|
-
getEditorSymbolPicks(query, disposables, token) {
|
|
562
|
-
const filterSegments = query.original.split(GotoSymbolQuickAccessProvider.PREFIX);
|
|
563
|
-
const filter = filterSegments.length > 1 ? filterSegments[filterSegments.length - 1].trim() : undefined;
|
|
564
|
-
if (typeof filter !== 'string') {
|
|
565
|
-
return null;
|
|
566
|
-
}
|
|
567
|
-
const activeGlobalPick = this.pickState.lastGlobalPicks?.active;
|
|
568
|
-
if (!activeGlobalPick) {
|
|
569
|
-
return null;
|
|
570
|
-
}
|
|
571
|
-
const activeGlobalResource = activeGlobalPick.resource;
|
|
572
|
-
if (!activeGlobalResource || (!this.fileService.hasProvider(activeGlobalResource) && activeGlobalResource.scheme !== Schemas.untitled)) {
|
|
573
|
-
return null;
|
|
574
|
-
}
|
|
575
|
-
if (activeGlobalPick.label.includes(GotoSymbolQuickAccessProvider.PREFIX) || activeGlobalPick.description?.includes(GotoSymbolQuickAccessProvider.PREFIX)) {
|
|
576
|
-
if (filterSegments.length < 3) {
|
|
577
|
-
return null;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
return this.doGetEditorSymbolPicks(activeGlobalPick, activeGlobalResource, filter, disposables, token);
|
|
581
|
-
}
|
|
582
|
-
async doGetEditorSymbolPicks(activeGlobalPick, activeGlobalResource, filter, disposables, token) {
|
|
583
|
-
try {
|
|
584
|
-
this.pickState.editorViewState.set();
|
|
585
|
-
await this.editorService.openEditor({
|
|
586
|
-
resource: activeGlobalResource,
|
|
587
|
-
options: { preserveFocus: true, revealIfOpened: true, ignoreError: true }
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
catch (error) {
|
|
591
|
-
return [];
|
|
592
|
-
}
|
|
593
|
-
if (token.isCancellationRequested) {
|
|
594
|
-
return [];
|
|
595
|
-
}
|
|
596
|
-
let model = this.modelService.getModel(activeGlobalResource);
|
|
597
|
-
if (!model) {
|
|
598
|
-
try {
|
|
599
|
-
const modelReference = disposables.add(await this.textModelService.createModelReference(activeGlobalResource));
|
|
600
|
-
if (token.isCancellationRequested) {
|
|
601
|
-
return [];
|
|
602
|
-
}
|
|
603
|
-
model = modelReference.object.textEditorModel;
|
|
604
|
-
}
|
|
605
|
-
catch (error) {
|
|
606
|
-
return [];
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
const editorSymbolPicks = (await this.editorSymbolsQuickAccess.getSymbolPicks(model, filter, { extraContainerLabel: stripIcons(activeGlobalPick.label) }, disposables, token));
|
|
610
|
-
if (token.isCancellationRequested) {
|
|
611
|
-
return [];
|
|
612
|
-
}
|
|
613
|
-
return ( editorSymbolPicks.map(editorSymbolPick => {
|
|
614
|
-
if (editorSymbolPick.type === 'separator') {
|
|
615
|
-
return editorSymbolPick;
|
|
616
|
-
}
|
|
617
|
-
return {
|
|
618
|
-
...editorSymbolPick,
|
|
619
|
-
resource: activeGlobalResource,
|
|
620
|
-
description: editorSymbolPick.description,
|
|
621
|
-
trigger: (buttonIndex, keyMods) => {
|
|
622
|
-
this.openAnything(activeGlobalResource, { keyMods, range: editorSymbolPick.range?.selection, forceOpenSideBySide: true });
|
|
623
|
-
return TriggerAction.CLOSE_PICKER;
|
|
624
|
-
},
|
|
625
|
-
accept: (keyMods, event) => this.openAnything(activeGlobalResource, { keyMods, range: editorSymbolPick.range?.selection, preserveFocus: event.inBackground, forcePinned: event.inBackground })
|
|
626
|
-
};
|
|
627
|
-
}));
|
|
628
|
-
}
|
|
629
|
-
addDecorations(editor, range) {
|
|
630
|
-
this.editorSymbolsQuickAccess.addDecorations(editor, range);
|
|
631
|
-
}
|
|
632
|
-
clearDecorations(editor) {
|
|
633
|
-
this.editorSymbolsQuickAccess.clearDecorations(editor);
|
|
634
|
-
}
|
|
635
|
-
createAnythingPick(resourceOrEditor, configuration) {
|
|
636
|
-
const isEditorHistoryEntry = !URI.isUri(resourceOrEditor);
|
|
637
|
-
let resource;
|
|
638
|
-
let label;
|
|
639
|
-
let description = undefined;
|
|
640
|
-
let isDirty = undefined;
|
|
641
|
-
let extraClasses;
|
|
642
|
-
let icon = undefined;
|
|
643
|
-
if (isEditorInput(resourceOrEditor)) {
|
|
644
|
-
resource = EditorResourceAccessor.getOriginalUri(resourceOrEditor);
|
|
645
|
-
label = resourceOrEditor.getName();
|
|
646
|
-
description = resourceOrEditor.getDescription();
|
|
647
|
-
isDirty = resourceOrEditor.isDirty() && !resourceOrEditor.isSaving();
|
|
648
|
-
extraClasses = resourceOrEditor.getLabelExtraClasses();
|
|
649
|
-
icon = resourceOrEditor.getIcon();
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
resource = URI.isUri(resourceOrEditor) ? resourceOrEditor : resourceOrEditor.resource;
|
|
653
|
-
label = basenameOrAuthority(resource);
|
|
654
|
-
description = this.labelService.getUriLabel(dirname(resource), { relative: true });
|
|
655
|
-
isDirty = this.workingCopyService.isDirty(resource) && !this.filesConfigurationService.hasShortAutoSaveDelay(resource);
|
|
656
|
-
extraClasses = [];
|
|
657
|
-
}
|
|
658
|
-
const labelAndDescription = description ? `${label} ${description}` : label;
|
|
659
|
-
const iconClassesValue = ( new Lazy(
|
|
660
|
-
() => getIconClasses(this.modelService, this.languageService, resource, undefined, icon).concat(extraClasses)
|
|
661
|
-
));
|
|
662
|
-
const buttonsValue = ( new Lazy(() => {
|
|
663
|
-
const openSideBySideDirection = configuration.openSideBySideDirection;
|
|
664
|
-
const buttons = [];
|
|
665
|
-
buttons.push({
|
|
666
|
-
iconClass: openSideBySideDirection === 'right' ? ThemeIcon.asClassName(Codicon.splitHorizontal) : ThemeIcon.asClassName(Codicon.splitVertical),
|
|
667
|
-
tooltip: openSideBySideDirection === 'right' ?
|
|
668
|
-
( localizeWithPath(
|
|
669
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
670
|
-
{ key: 'openToSide', comment: ['Open this file in a split editor on the left/right side'] },
|
|
671
|
-
"Open to the Side"
|
|
672
|
-
)) :
|
|
673
|
-
( localizeWithPath(
|
|
674
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
675
|
-
{ key: 'openToBottom', comment: ['Open this file in a split editor on the bottom'] },
|
|
676
|
-
"Open to the Bottom"
|
|
677
|
-
))
|
|
678
|
-
});
|
|
679
|
-
if (isEditorHistoryEntry) {
|
|
680
|
-
buttons.push({
|
|
681
|
-
iconClass: isDirty ? ('dirty-anything ' + ThemeIcon.asClassName(Codicon.circleFilled)) : ThemeIcon.asClassName(Codicon.close),
|
|
682
|
-
tooltip: ( localizeWithPath(
|
|
683
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
684
|
-
'closeEditor',
|
|
685
|
-
"Remove from Recently Opened"
|
|
686
|
-
)),
|
|
687
|
-
alwaysVisible: isDirty
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
return buttons;
|
|
691
|
-
}));
|
|
692
|
-
return {
|
|
693
|
-
resource,
|
|
694
|
-
label,
|
|
695
|
-
ariaLabel: isDirty ? ( localizeWithPath(
|
|
696
|
-
'vs/workbench/contrib/search/browser/anythingQuickAccess',
|
|
697
|
-
'filePickAriaLabelDirty',
|
|
698
|
-
"{0} unsaved changes",
|
|
699
|
-
labelAndDescription
|
|
700
|
-
)) : labelAndDescription,
|
|
701
|
-
description,
|
|
702
|
-
get iconClasses() { return iconClassesValue.value; },
|
|
703
|
-
get buttons() { return buttonsValue.value; },
|
|
704
|
-
trigger: (buttonIndex, keyMods) => {
|
|
705
|
-
switch (buttonIndex) {
|
|
706
|
-
case 0:
|
|
707
|
-
this.openAnything(resourceOrEditor, { keyMods, range: this.pickState.lastRange, forceOpenSideBySide: true });
|
|
708
|
-
return TriggerAction.CLOSE_PICKER;
|
|
709
|
-
case 1:
|
|
710
|
-
if (!URI.isUri(resourceOrEditor)) {
|
|
711
|
-
this.historyService.removeFromHistory(resourceOrEditor);
|
|
712
|
-
return TriggerAction.REMOVE_ITEM;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
return TriggerAction.NO_ACTION;
|
|
716
|
-
},
|
|
717
|
-
accept: (keyMods, event) => this.openAnything(resourceOrEditor, { keyMods, range: this.pickState.lastRange, preserveFocus: event.inBackground, forcePinned: event.inBackground })
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
async openAnything(resourceOrEditor, options) {
|
|
721
|
-
const editorOptions = {
|
|
722
|
-
preserveFocus: options.preserveFocus,
|
|
723
|
-
pinned: options.keyMods?.ctrlCmd || options.forcePinned || this.configuration.openEditorPinned,
|
|
724
|
-
selection: options.range ? Range.collapseToStart(options.range) : undefined
|
|
725
|
-
};
|
|
726
|
-
const targetGroup = options.keyMods?.alt || (this.configuration.openEditorPinned && options.keyMods?.ctrlCmd) || options.forceOpenSideBySide ? SIDE_GROUP : ACTIVE_GROUP;
|
|
727
|
-
if (targetGroup === SIDE_GROUP) {
|
|
728
|
-
await this.pickState.editorViewState.restore();
|
|
729
|
-
}
|
|
730
|
-
if (isEditorInput(resourceOrEditor)) {
|
|
731
|
-
await this.editorService.openEditor(resourceOrEditor, editorOptions, targetGroup);
|
|
732
|
-
}
|
|
733
|
-
else {
|
|
734
|
-
let resourceEditorInput;
|
|
735
|
-
if (URI.isUri(resourceOrEditor)) {
|
|
736
|
-
resourceEditorInput = {
|
|
737
|
-
resource: resourceOrEditor,
|
|
738
|
-
options: editorOptions
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
else {
|
|
742
|
-
resourceEditorInput = {
|
|
743
|
-
...resourceOrEditor,
|
|
744
|
-
options: {
|
|
745
|
-
...resourceOrEditor.options,
|
|
746
|
-
...editorOptions
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
await this.editorService.openEditor(resourceEditorInput, targetGroup);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
AnythingQuickAccessProvider = AnythingQuickAccessProvider_1 = ( __decorate([
|
|
755
|
-
( __param(0, IInstantiationService)),
|
|
756
|
-
( __param(1, ISearchService)),
|
|
757
|
-
( __param(2, IWorkspaceContextService)),
|
|
758
|
-
( __param(3, IPathService)),
|
|
759
|
-
( __param(4, IWorkbenchEnvironmentService)),
|
|
760
|
-
( __param(5, IFileService)),
|
|
761
|
-
( __param(6, ILabelService)),
|
|
762
|
-
( __param(7, IModelService)),
|
|
763
|
-
( __param(8, ILanguageService)),
|
|
764
|
-
( __param(9, IWorkingCopyService)),
|
|
765
|
-
( __param(10, IConfigurationService)),
|
|
766
|
-
( __param(11, IEditorService)),
|
|
767
|
-
( __param(12, IHistoryService)),
|
|
768
|
-
( __param(13, IFilesConfigurationService)),
|
|
769
|
-
( __param(14, ITextModelService)),
|
|
770
|
-
( __param(15, IUriIdentityService)),
|
|
771
|
-
( __param(16, IQuickInputService)),
|
|
772
|
-
( __param(17, IKeybindingService)),
|
|
773
|
-
( __param(18, IQuickChatService))
|
|
774
|
-
], AnythingQuickAccessProvider));
|
|
775
|
-
|
|
776
|
-
export { AnythingQuickAccessProvider };
|