@codingame/monaco-vscode-search-service-override 5.3.0 → 6.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/search.js +37 -3
- package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +3 -2
- package/vscode/src/vs/workbench/contrib/search/browser/replaceContributions.js +3 -2
- package/vscode/src/vs/workbench/contrib/search/browser/replaceService.js +2 -1
- package/vscode/src/vs/workbench/contrib/search/browser/search.contribution.js +20 -17
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +11 -9
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +49 -47
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +18 -16
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsSymbol.js +6 -3
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +2 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +13 -11
- package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +4 -4
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +33 -28
- package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +36 -32
- package/vscode/src/vs/workbench/contrib/search/common/searchHistoryService.js +5 -4
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +26 -24
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.js +7 -4
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +2 -1
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +11 -8
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +3 -3
- package/vscode/src/vs/workbench/services/search/browser/searchService.js +4 -27
- package/vscode/src/vs/workbench/services/search/common/searchService.js +19 -19
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +0 -764
- package/vscode/src/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +0 -224
- package/vscode/src/vs/workbench/contrib/search/common/cacheState.js +0 -87
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
|
|
3
|
-
var css = ".quick-input-list .quick-input-list-entry.has-actions:hover .quick-input-list-entry-action-bar .action-label.dirty-anything:before{content:var(--vscode-icon-x-content);font-family:var(--vscode-icon-x-font-family)}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { PickerQuickAccessProvider, TriggerAction } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
|
|
4
|
-
import { ThrottledDelayer } from 'vscode/vscode/vs/base/common/async';
|
|
5
|
-
import { getWorkspaceSymbols } from 'vscode/vscode/vs/workbench/contrib/search/common/search';
|
|
6
|
-
import { SymbolKinds } from 'vscode/vscode/vs/editor/common/languages';
|
|
7
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
8
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
9
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
10
|
-
import { SIDE_GROUP, ACTIVE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
11
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
12
|
-
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
13
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
|
-
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
15
|
-
import { getSelectionSearchString } from 'vscode/vscode/vs/editor/contrib/find/browser/findController';
|
|
16
|
-
import { prepareQuery, pieceToQuery, scoreFuzzy2 } from 'vscode/vscode/vs/base/common/fuzzyScorer';
|
|
17
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
18
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
19
|
-
|
|
20
|
-
var SymbolsQuickAccessProvider_1;
|
|
21
|
-
const _moduleId = "vs/workbench/contrib/search/browser/symbolsQuickAccess";
|
|
22
|
-
let SymbolsQuickAccessProvider = class SymbolsQuickAccessProvider extends PickerQuickAccessProvider {
|
|
23
|
-
static { SymbolsQuickAccessProvider_1 = this; }
|
|
24
|
-
static { this.PREFIX = '#'; }
|
|
25
|
-
static { this.TYPING_SEARCH_DELAY = 200; }
|
|
26
|
-
static { this.TREAT_AS_GLOBAL_SYMBOL_TYPES = ( (new Set([
|
|
27
|
-
4 ,
|
|
28
|
-
9 ,
|
|
29
|
-
0 ,
|
|
30
|
-
10 ,
|
|
31
|
-
2 ,
|
|
32
|
-
3 ,
|
|
33
|
-
1
|
|
34
|
-
]))); }
|
|
35
|
-
get defaultFilterValue() {
|
|
36
|
-
const editor = this.codeEditorService.getFocusedCodeEditor();
|
|
37
|
-
if (editor) {
|
|
38
|
-
return getSelectionSearchString(editor) ?? undefined;
|
|
39
|
-
}
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
constructor(labelService, openerService, editorService, configurationService, codeEditorService) {
|
|
43
|
-
super(SymbolsQuickAccessProvider_1.PREFIX, {
|
|
44
|
-
canAcceptInBackground: true,
|
|
45
|
-
noResultsPick: {
|
|
46
|
-
label: ( localizeWithPath(_moduleId, 0, "No matching workspace symbols"))
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
this.labelService = labelService;
|
|
50
|
-
this.openerService = openerService;
|
|
51
|
-
this.editorService = editorService;
|
|
52
|
-
this.configurationService = configurationService;
|
|
53
|
-
this.codeEditorService = codeEditorService;
|
|
54
|
-
this.delayer = this._register(( (new ThrottledDelayer(SymbolsQuickAccessProvider_1.TYPING_SEARCH_DELAY))));
|
|
55
|
-
}
|
|
56
|
-
get configuration() {
|
|
57
|
-
const editorConfig = this.configurationService.getValue().workbench?.editor;
|
|
58
|
-
return {
|
|
59
|
-
openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
|
|
60
|
-
openSideBySideDirection: editorConfig?.openSideBySideDirection
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
_getPicks(filter, disposables, token) {
|
|
64
|
-
return this.getSymbolPicks(filter, undefined, token);
|
|
65
|
-
}
|
|
66
|
-
async getSymbolPicks(filter, options, token) {
|
|
67
|
-
return this.delayer.trigger(async () => {
|
|
68
|
-
if (token.isCancellationRequested) {
|
|
69
|
-
return [];
|
|
70
|
-
}
|
|
71
|
-
return this.doGetSymbolPicks(prepareQuery(filter), options, token);
|
|
72
|
-
}, options?.delay);
|
|
73
|
-
}
|
|
74
|
-
async doGetSymbolPicks(query, options, token) {
|
|
75
|
-
let symbolQuery;
|
|
76
|
-
let containerQuery;
|
|
77
|
-
if (query.values && query.values.length > 1) {
|
|
78
|
-
symbolQuery = pieceToQuery(query.values[0]);
|
|
79
|
-
containerQuery = pieceToQuery(query.values.slice(1));
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
symbolQuery = query;
|
|
83
|
-
}
|
|
84
|
-
const workspaceSymbols = await getWorkspaceSymbols(symbolQuery.original, token);
|
|
85
|
-
if (token.isCancellationRequested) {
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
const symbolPicks = [];
|
|
89
|
-
const openSideBySideDirection = this.configuration.openSideBySideDirection;
|
|
90
|
-
for (const { symbol, provider } of workspaceSymbols) {
|
|
91
|
-
if (options?.skipLocal && !( (SymbolsQuickAccessProvider_1.TREAT_AS_GLOBAL_SYMBOL_TYPES.has(symbol.kind))) && !!symbol.containerName) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const symbolLabel = symbol.name;
|
|
95
|
-
const symbolLabelWithIcon = `$(${SymbolKinds.toIcon(symbol.kind).id}) ${symbolLabel}`;
|
|
96
|
-
const symbolLabelIconOffset = symbolLabelWithIcon.length - symbolLabel.length;
|
|
97
|
-
let symbolScore = undefined;
|
|
98
|
-
let symbolMatches = undefined;
|
|
99
|
-
let skipContainerQuery = false;
|
|
100
|
-
if (symbolQuery.original.length > 0) {
|
|
101
|
-
if (symbolQuery !== query) {
|
|
102
|
-
[symbolScore, symbolMatches] = scoreFuzzy2(symbolLabelWithIcon, { ...query, values: undefined }, 0, symbolLabelIconOffset);
|
|
103
|
-
if (typeof symbolScore === 'number') {
|
|
104
|
-
skipContainerQuery = true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (typeof symbolScore !== 'number') {
|
|
108
|
-
[symbolScore, symbolMatches] = scoreFuzzy2(symbolLabelWithIcon, symbolQuery, 0, symbolLabelIconOffset);
|
|
109
|
-
if (typeof symbolScore !== 'number') {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const symbolUri = symbol.location.uri;
|
|
115
|
-
let containerLabel = undefined;
|
|
116
|
-
if (symbolUri) {
|
|
117
|
-
const containerPath = this.labelService.getUriLabel(symbolUri, { relative: true });
|
|
118
|
-
if (symbol.containerName) {
|
|
119
|
-
containerLabel = `${symbol.containerName} • ${containerPath}`;
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
containerLabel = containerPath;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
let containerScore = undefined;
|
|
126
|
-
let containerMatches = undefined;
|
|
127
|
-
if (!skipContainerQuery && containerQuery && containerQuery.original.length > 0) {
|
|
128
|
-
if (containerLabel) {
|
|
129
|
-
[containerScore, containerMatches] = scoreFuzzy2(containerLabel, containerQuery);
|
|
130
|
-
}
|
|
131
|
-
if (typeof containerScore !== 'number') {
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
if (typeof symbolScore === 'number') {
|
|
135
|
-
symbolScore += containerScore;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const deprecated = symbol.tags ? symbol.tags.indexOf(1 ) >= 0 : false;
|
|
139
|
-
symbolPicks.push({
|
|
140
|
-
symbol,
|
|
141
|
-
resource: symbolUri,
|
|
142
|
-
score: symbolScore,
|
|
143
|
-
label: symbolLabelWithIcon,
|
|
144
|
-
ariaLabel: symbolLabel,
|
|
145
|
-
highlights: deprecated ? undefined : {
|
|
146
|
-
label: symbolMatches,
|
|
147
|
-
description: containerMatches
|
|
148
|
-
},
|
|
149
|
-
description: containerLabel,
|
|
150
|
-
strikethrough: deprecated,
|
|
151
|
-
buttons: [
|
|
152
|
-
{
|
|
153
|
-
iconClass: openSideBySideDirection === 'right' ? ThemeIcon.asClassName(Codicon.splitHorizontal) : ThemeIcon.asClassName(Codicon.splitVertical),
|
|
154
|
-
tooltip: openSideBySideDirection === 'right' ? ( localizeWithPath(_moduleId, 1, "Open to the Side")) : ( localizeWithPath(_moduleId, 2, "Open to the Bottom"))
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
trigger: (buttonIndex, keyMods) => {
|
|
158
|
-
this.openSymbol(provider, symbol, token, { keyMods, forceOpenSideBySide: true });
|
|
159
|
-
return TriggerAction.CLOSE_PICKER;
|
|
160
|
-
},
|
|
161
|
-
accept: async (keyMods, event) => this.openSymbol(provider, symbol, token, { keyMods, preserveFocus: event.inBackground, forcePinned: event.inBackground }),
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
if (!options?.skipSorting) {
|
|
165
|
-
symbolPicks.sort((symbolA, symbolB) => this.compareSymbols(symbolA, symbolB));
|
|
166
|
-
}
|
|
167
|
-
return symbolPicks;
|
|
168
|
-
}
|
|
169
|
-
async openSymbol(provider, symbol, token, options) {
|
|
170
|
-
let symbolToOpen = symbol;
|
|
171
|
-
if (typeof provider.resolveWorkspaceSymbol === 'function') {
|
|
172
|
-
symbolToOpen = (await provider.resolveWorkspaceSymbol(symbol, token)) || symbol;
|
|
173
|
-
if (token.isCancellationRequested) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (symbolToOpen.location.uri.scheme === Schemas.http || symbolToOpen.location.uri.scheme === Schemas.https) {
|
|
178
|
-
await this.openerService.open(symbolToOpen.location.uri, { fromUserGesture: true, allowContributedOpeners: true });
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
await this.editorService.openEditor({
|
|
182
|
-
resource: symbolToOpen.location.uri,
|
|
183
|
-
options: {
|
|
184
|
-
preserveFocus: options?.preserveFocus,
|
|
185
|
-
pinned: options.keyMods.ctrlCmd || options.forcePinned || this.configuration.openEditorPinned,
|
|
186
|
-
selection: symbolToOpen.location.range ? Range.collapseToStart(symbolToOpen.location.range) : undefined
|
|
187
|
-
}
|
|
188
|
-
}, options.keyMods.alt || (this.configuration.openEditorPinned && options.keyMods.ctrlCmd) || options?.forceOpenSideBySide ? SIDE_GROUP : ACTIVE_GROUP);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
compareSymbols(symbolA, symbolB) {
|
|
192
|
-
if (typeof symbolA.score === 'number' && typeof symbolB.score === 'number') {
|
|
193
|
-
if (symbolA.score > symbolB.score) {
|
|
194
|
-
return -1;
|
|
195
|
-
}
|
|
196
|
-
if (symbolA.score < symbolB.score) {
|
|
197
|
-
return 1;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (symbolA.symbol && symbolB.symbol) {
|
|
201
|
-
const symbolAName = symbolA.symbol.name.toLowerCase();
|
|
202
|
-
const symbolBName = symbolB.symbol.name.toLowerCase();
|
|
203
|
-
const res = symbolAName.localeCompare(symbolBName);
|
|
204
|
-
if (res !== 0) {
|
|
205
|
-
return res;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (symbolA.symbol && symbolB.symbol) {
|
|
209
|
-
const symbolAKind = SymbolKinds.toIcon(symbolA.symbol.kind).id;
|
|
210
|
-
const symbolBKind = SymbolKinds.toIcon(symbolB.symbol.kind).id;
|
|
211
|
-
return symbolAKind.localeCompare(symbolBKind);
|
|
212
|
-
}
|
|
213
|
-
return 0;
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
SymbolsQuickAccessProvider = SymbolsQuickAccessProvider_1 = ( (__decorate([
|
|
217
|
-
( (__param(0, ILabelService))),
|
|
218
|
-
( (__param(1, IOpenerService))),
|
|
219
|
-
( (__param(2, IEditorService))),
|
|
220
|
-
( (__param(3, IConfigurationService))),
|
|
221
|
-
( (__param(4, ICodeEditorService)))
|
|
222
|
-
], SymbolsQuickAccessProvider)));
|
|
223
|
-
|
|
224
|
-
export { SymbolsQuickAccessProvider };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { defaultGenerator } from 'vscode/vscode/vs/base/common/idGenerator';
|
|
2
|
-
import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
3
|
-
|
|
4
|
-
var LoadingPhase;
|
|
5
|
-
( (function(LoadingPhase) {
|
|
6
|
-
LoadingPhase[LoadingPhase["Created"] = 1] = "Created";
|
|
7
|
-
LoadingPhase[LoadingPhase["Loading"] = 2] = "Loading";
|
|
8
|
-
LoadingPhase[LoadingPhase["Loaded"] = 3] = "Loaded";
|
|
9
|
-
LoadingPhase[LoadingPhase["Errored"] = 4] = "Errored";
|
|
10
|
-
LoadingPhase[LoadingPhase["Disposed"] = 5] = "Disposed";
|
|
11
|
-
})(LoadingPhase || (LoadingPhase = {})));
|
|
12
|
-
class FileQueryCacheState {
|
|
13
|
-
get cacheKey() {
|
|
14
|
-
if (this.loadingPhase === LoadingPhase.Loaded || !this.previousCacheState) {
|
|
15
|
-
return this._cacheKey;
|
|
16
|
-
}
|
|
17
|
-
return this.previousCacheState.cacheKey;
|
|
18
|
-
}
|
|
19
|
-
get isLoaded() {
|
|
20
|
-
const isLoaded = this.loadingPhase === LoadingPhase.Loaded;
|
|
21
|
-
return isLoaded || !this.previousCacheState ? isLoaded : this.previousCacheState.isLoaded;
|
|
22
|
-
}
|
|
23
|
-
get isUpdating() {
|
|
24
|
-
const isUpdating = this.loadingPhase === LoadingPhase.Loading;
|
|
25
|
-
return isUpdating || !this.previousCacheState ? isUpdating : this.previousCacheState.isUpdating;
|
|
26
|
-
}
|
|
27
|
-
constructor(cacheQuery, loadFn, disposeFn, previousCacheState) {
|
|
28
|
-
this.cacheQuery = cacheQuery;
|
|
29
|
-
this.loadFn = loadFn;
|
|
30
|
-
this.disposeFn = disposeFn;
|
|
31
|
-
this.previousCacheState = previousCacheState;
|
|
32
|
-
this._cacheKey = defaultGenerator.nextId();
|
|
33
|
-
this.query = this.cacheQuery(this._cacheKey);
|
|
34
|
-
this.loadingPhase = LoadingPhase.Created;
|
|
35
|
-
if (this.previousCacheState) {
|
|
36
|
-
const current = Object.assign({}, this.query, { cacheKey: null });
|
|
37
|
-
const previous = Object.assign({}, this.previousCacheState.query, { cacheKey: null });
|
|
38
|
-
if (!equals(current, previous)) {
|
|
39
|
-
this.previousCacheState.dispose();
|
|
40
|
-
this.previousCacheState = undefined;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
load() {
|
|
45
|
-
if (this.isUpdating) {
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
this.loadingPhase = LoadingPhase.Loading;
|
|
49
|
-
this.loadPromise = (async () => {
|
|
50
|
-
try {
|
|
51
|
-
await this.loadFn(this.query);
|
|
52
|
-
this.loadingPhase = LoadingPhase.Loaded;
|
|
53
|
-
if (this.previousCacheState) {
|
|
54
|
-
this.previousCacheState.dispose();
|
|
55
|
-
this.previousCacheState = undefined;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
this.loadingPhase = LoadingPhase.Errored;
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
})();
|
|
63
|
-
return this;
|
|
64
|
-
}
|
|
65
|
-
dispose() {
|
|
66
|
-
if (this.loadPromise) {
|
|
67
|
-
(async () => {
|
|
68
|
-
try {
|
|
69
|
-
await this.loadPromise;
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
}
|
|
73
|
-
this.loadingPhase = LoadingPhase.Disposed;
|
|
74
|
-
this.disposeFn(this._cacheKey);
|
|
75
|
-
})();
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.loadingPhase = LoadingPhase.Disposed;
|
|
79
|
-
}
|
|
80
|
-
if (this.previousCacheState) {
|
|
81
|
-
this.previousCacheState.dispose();
|
|
82
|
-
this.previousCacheState = undefined;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { FileQueryCacheState };
|