@codingame/monaco-vscode-search-service-override 4.1.0 → 4.1.2

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.
Files changed (35) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/override/vs/platform/dialogs/common/dialogs.js +10 -0
  4. package/package.json +2 -2
  5. package/search.js +4 -4
  6. package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +796 -0
  7. package/vscode/src/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +6 -0
  8. package/vscode/src/vs/workbench/contrib/search/browser/media/searchview.css.js +6 -0
  9. package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +234 -0
  10. package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +341 -0
  11. package/vscode/src/vs/workbench/contrib/search/browser/replaceContributions.js +9 -0
  12. package/vscode/src/vs/workbench/contrib/search/browser/replaceService.js +232 -0
  13. package/vscode/src/vs/workbench/contrib/search/browser/search.contribution.js +647 -0
  14. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +209 -0
  15. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +511 -0
  16. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +374 -0
  17. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsSymbol.js +43 -0
  18. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +44 -0
  19. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +323 -0
  20. package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +103 -0
  21. package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +106 -0
  22. package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +66 -0
  23. package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +437 -0
  24. package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +2177 -0
  25. package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +674 -0
  26. package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +234 -0
  27. package/vscode/src/vs/workbench/contrib/search/common/cacheState.js +87 -0
  28. package/vscode/src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +6 -0
  29. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +586 -0
  30. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.js +760 -0
  31. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +189 -0
  32. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +320 -0
  33. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +138 -0
  34. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +293 -0
  35. package/vscode/src/vs/workbench/services/search/common/searchService.js +416 -0
@@ -0,0 +1,234 @@
1
+ import { __decorate, __param } from '../../../../../../../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';
8
+ import { Schemas } from 'vscode/vscode/vs/base/common/network';
9
+ import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
10
+ import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
11
+ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
12
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
13
+ import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
14
+ import { getSelectionSearchString } from 'vscode/vscode/vs/editor/contrib/find/browser/findController';
15
+ import { prepareQuery, pieceToQuery, scoreFuzzy2 } from 'vscode/vscode/vs/base/common/fuzzyScorer';
16
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
17
+ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
18
+
19
+ var SymbolsQuickAccessProvider_1;
20
+ let SymbolsQuickAccessProvider = class SymbolsQuickAccessProvider extends PickerQuickAccessProvider {
21
+ static { SymbolsQuickAccessProvider_1 = this; }
22
+ static { this.PREFIX = '#'; }
23
+ static { this.TYPING_SEARCH_DELAY = 200; }
24
+ static { this.TREAT_AS_GLOBAL_SYMBOL_TYPES = ( new Set([
25
+ 4 ,
26
+ 9 ,
27
+ 0 ,
28
+ 10 ,
29
+ 2 ,
30
+ 3 ,
31
+ 1
32
+ ])); }
33
+ get defaultFilterValue() {
34
+ const editor = this.codeEditorService.getFocusedCodeEditor();
35
+ if (editor) {
36
+ return getSelectionSearchString(editor) ?? undefined;
37
+ }
38
+ return undefined;
39
+ }
40
+ constructor(labelService, openerService, editorService, configurationService, codeEditorService) {
41
+ super(SymbolsQuickAccessProvider_1.PREFIX, {
42
+ canAcceptInBackground: true,
43
+ noResultsPick: {
44
+ label: ( localizeWithPath(
45
+ 'vs/workbench/contrib/search/browser/symbolsQuickAccess',
46
+ 'noSymbolResults',
47
+ "No matching workspace symbols"
48
+ ))
49
+ }
50
+ });
51
+ this.labelService = labelService;
52
+ this.openerService = openerService;
53
+ this.editorService = editorService;
54
+ this.configurationService = configurationService;
55
+ this.codeEditorService = codeEditorService;
56
+ this.delayer = this._register(( new ThrottledDelayer(SymbolsQuickAccessProvider_1.TYPING_SEARCH_DELAY)));
57
+ }
58
+ get configuration() {
59
+ const editorConfig = this.configurationService.getValue().workbench?.editor;
60
+ return {
61
+ openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
62
+ openSideBySideDirection: editorConfig?.openSideBySideDirection
63
+ };
64
+ }
65
+ _getPicks(filter, disposables, token) {
66
+ return this.getSymbolPicks(filter, undefined, token);
67
+ }
68
+ async getSymbolPicks(filter, options, token) {
69
+ return this.delayer.trigger(async () => {
70
+ if (token.isCancellationRequested) {
71
+ return [];
72
+ }
73
+ return this.doGetSymbolPicks(prepareQuery(filter), options, token);
74
+ }, options?.delay);
75
+ }
76
+ async doGetSymbolPicks(query, options, token) {
77
+ let symbolQuery;
78
+ let containerQuery;
79
+ if (query.values && query.values.length > 1) {
80
+ symbolQuery = pieceToQuery(query.values[0]);
81
+ containerQuery = pieceToQuery(query.values.slice(1));
82
+ }
83
+ else {
84
+ symbolQuery = query;
85
+ }
86
+ const workspaceSymbols = await getWorkspaceSymbols(symbolQuery.original, token);
87
+ if (token.isCancellationRequested) {
88
+ return [];
89
+ }
90
+ const symbolPicks = [];
91
+ const openSideBySideDirection = this.configuration.openSideBySideDirection;
92
+ for (const { symbol, provider } of workspaceSymbols) {
93
+ if (options?.skipLocal && !( SymbolsQuickAccessProvider_1.TREAT_AS_GLOBAL_SYMBOL_TYPES.has(symbol.kind)) && !!symbol.containerName) {
94
+ continue;
95
+ }
96
+ const symbolLabel = symbol.name;
97
+ const symbolLabelWithIcon = `$(${SymbolKinds.toIcon(symbol.kind).id}) ${symbolLabel}`;
98
+ const symbolLabelIconOffset = symbolLabelWithIcon.length - symbolLabel.length;
99
+ let symbolScore = undefined;
100
+ let symbolMatches = undefined;
101
+ let skipContainerQuery = false;
102
+ if (symbolQuery.original.length > 0) {
103
+ if (symbolQuery !== query) {
104
+ [symbolScore, symbolMatches] = scoreFuzzy2(symbolLabelWithIcon, { ...query, values: undefined }, 0, symbolLabelIconOffset);
105
+ if (typeof symbolScore === 'number') {
106
+ skipContainerQuery = true;
107
+ }
108
+ }
109
+ if (typeof symbolScore !== 'number') {
110
+ [symbolScore, symbolMatches] = scoreFuzzy2(symbolLabelWithIcon, symbolQuery, 0, symbolLabelIconOffset);
111
+ if (typeof symbolScore !== 'number') {
112
+ continue;
113
+ }
114
+ }
115
+ }
116
+ const symbolUri = symbol.location.uri;
117
+ let containerLabel = undefined;
118
+ if (symbolUri) {
119
+ const containerPath = this.labelService.getUriLabel(symbolUri, { relative: true });
120
+ if (symbol.containerName) {
121
+ containerLabel = `${symbol.containerName} • ${containerPath}`;
122
+ }
123
+ else {
124
+ containerLabel = containerPath;
125
+ }
126
+ }
127
+ let containerScore = undefined;
128
+ let containerMatches = undefined;
129
+ if (!skipContainerQuery && containerQuery && containerQuery.original.length > 0) {
130
+ if (containerLabel) {
131
+ [containerScore, containerMatches] = scoreFuzzy2(containerLabel, containerQuery);
132
+ }
133
+ if (typeof containerScore !== 'number') {
134
+ continue;
135
+ }
136
+ if (typeof symbolScore === 'number') {
137
+ symbolScore += containerScore;
138
+ }
139
+ }
140
+ const deprecated = symbol.tags ? symbol.tags.indexOf(1 ) >= 0 : false;
141
+ symbolPicks.push({
142
+ symbol,
143
+ resource: symbolUri,
144
+ score: symbolScore,
145
+ label: symbolLabelWithIcon,
146
+ ariaLabel: symbolLabel,
147
+ highlights: deprecated ? undefined : {
148
+ label: symbolMatches,
149
+ description: containerMatches
150
+ },
151
+ description: containerLabel,
152
+ strikethrough: deprecated,
153
+ buttons: [
154
+ {
155
+ iconClass: openSideBySideDirection === 'right' ? ThemeIcon.asClassName(Codicon.splitHorizontal) : ThemeIcon.asClassName(Codicon.splitVertical),
156
+ tooltip: openSideBySideDirection === 'right' ? ( localizeWithPath(
157
+ 'vs/workbench/contrib/search/browser/symbolsQuickAccess',
158
+ 'openToSide',
159
+ "Open to the Side"
160
+ )) : ( localizeWithPath(
161
+ 'vs/workbench/contrib/search/browser/symbolsQuickAccess',
162
+ 'openToBottom',
163
+ "Open to the Bottom"
164
+ ))
165
+ }
166
+ ],
167
+ trigger: (buttonIndex, keyMods) => {
168
+ this.openSymbol(provider, symbol, token, { keyMods, forceOpenSideBySide: true });
169
+ return TriggerAction.CLOSE_PICKER;
170
+ },
171
+ accept: async (keyMods, event) => this.openSymbol(provider, symbol, token, { keyMods, preserveFocus: event.inBackground, forcePinned: event.inBackground }),
172
+ });
173
+ }
174
+ if (!options?.skipSorting) {
175
+ symbolPicks.sort((symbolA, symbolB) => this.compareSymbols(symbolA, symbolB));
176
+ }
177
+ return symbolPicks;
178
+ }
179
+ async openSymbol(provider, symbol, token, options) {
180
+ let symbolToOpen = symbol;
181
+ if (typeof provider.resolveWorkspaceSymbol === 'function') {
182
+ symbolToOpen = (await provider.resolveWorkspaceSymbol(symbol, token)) || symbol;
183
+ if (token.isCancellationRequested) {
184
+ return;
185
+ }
186
+ }
187
+ if (symbolToOpen.location.uri.scheme === Schemas.http || symbolToOpen.location.uri.scheme === Schemas.https) {
188
+ await this.openerService.open(symbolToOpen.location.uri, { fromUserGesture: true, allowContributedOpeners: true });
189
+ }
190
+ else {
191
+ await this.editorService.openEditor({
192
+ resource: symbolToOpen.location.uri,
193
+ options: {
194
+ preserveFocus: options?.preserveFocus,
195
+ pinned: options.keyMods.ctrlCmd || options.forcePinned || this.configuration.openEditorPinned,
196
+ selection: symbolToOpen.location.range ? Range.collapseToStart(symbolToOpen.location.range) : undefined
197
+ }
198
+ }, options.keyMods.alt || (this.configuration.openEditorPinned && options.keyMods.ctrlCmd) || options?.forceOpenSideBySide ? SIDE_GROUP : ACTIVE_GROUP);
199
+ }
200
+ }
201
+ compareSymbols(symbolA, symbolB) {
202
+ if (typeof symbolA.score === 'number' && typeof symbolB.score === 'number') {
203
+ if (symbolA.score > symbolB.score) {
204
+ return -1;
205
+ }
206
+ if (symbolA.score < symbolB.score) {
207
+ return 1;
208
+ }
209
+ }
210
+ if (symbolA.symbol && symbolB.symbol) {
211
+ const symbolAName = symbolA.symbol.name.toLowerCase();
212
+ const symbolBName = symbolB.symbol.name.toLowerCase();
213
+ const res = symbolAName.localeCompare(symbolBName);
214
+ if (res !== 0) {
215
+ return res;
216
+ }
217
+ }
218
+ if (symbolA.symbol && symbolB.symbol) {
219
+ const symbolAKind = SymbolKinds.toIcon(symbolA.symbol.kind).id;
220
+ const symbolBKind = SymbolKinds.toIcon(symbolB.symbol.kind).id;
221
+ return symbolAKind.localeCompare(symbolBKind);
222
+ }
223
+ return 0;
224
+ }
225
+ };
226
+ SymbolsQuickAccessProvider = SymbolsQuickAccessProvider_1 = ( __decorate([
227
+ ( __param(0, ILabelService)),
228
+ ( __param(1, IOpenerService)),
229
+ ( __param(2, IEditorService)),
230
+ ( __param(3, IConfigurationService)),
231
+ ( __param(4, ICodeEditorService))
232
+ ], SymbolsQuickAccessProvider));
233
+
234
+ export { SymbolsQuickAccessProvider };
@@ -0,0 +1,87 @@
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 };
@@ -0,0 +1,6 @@
1
+ import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
+
3
+ var css = ".search-editor{display:flex;flex-direction:column}.search-editor .search-results{flex:1}.search-editor .query-container{margin:0 12px 12px 19px;padding-top:6px}.search-editor .search-widget .toggle-replace-button{align-items:center;background-position:50%;background-repeat:no-repeat;box-sizing:border-box;cursor:pointer;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:16px}.search-editor .search-widget .replace-container,.search-editor .search-widget .search-container{align-items:center;display:flex}.search-editor .search-widget .monaco-findInput{display:inline-block;vertical-align:middle;width:100%}.search-editor .search-widget .monaco-inputbox>.ibwrapper{height:100%}.search-editor .search-widget .monaco-inputbox>.ibwrapper>.mirror,.search-editor .search-widget .monaco-inputbox>.ibwrapper>textarea.input{padding:3px 3px 3px 6px}.search-editor .search-widget .monaco-inputbox>.ibwrapper>.mirror{max-height:134px}.search-editor .search-widget .monaco-inputbox>.ibwrapper>textarea.input{height:26px;overflow:initial}.search-editor .monaco-inputbox>.ibwrapper>textarea.input{scrollbar-width:none}.search-editor .monaco-inputbox>.ibwrapper>textarea.input::-webkit-scrollbar{display:none}.search-editor .search-widget .context-lines-input{margin-left:5px;margin-right:2px;max-width:50px}.search-editor .search-widget .context-lines-input input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none!important}.search-editor .search-widget .replace-container{display:inline-flex;margin-top:6px;position:relative}.search-editor .search-widget .replace-input{display:flex;height:25px;position:relative;vertical-align:middle;width:auto!important}.search-editor .search-widget .replace-input>.controls{position:absolute;right:2px;top:3px}.search-editor .search-widget .replace-container.disabled{display:none}.search-editor .search-widget .replace-container .monaco-action-bar{height:25px;margin-left:0}.search-editor .search-widget .replace-container .monaco-action-bar .action-item .codicon{align-items:center;background-repeat:no-repeat;display:flex;height:25px;justify-content:center;margin-right:0;width:25px}.search-editor .includes-excludes{min-height:1em;position:relative}.search-editor .includes-excludes .expand{cursor:pointer;height:16px;position:absolute;right:-2px;width:25px;z-index:2}.search-editor .includes-excludes .file-types{display:none}.search-editor .includes-excludes.expanded .file-types{display:inherit}.search-editor .includes-excludes.expanded .file-types:last-child{padding-bottom:10px}.search-editor .includes-excludes.expanded h4{font-size:11px;font-weight:400;margin:0;overflow:hidden;padding:4px 0 0;text-overflow:ellipsis;white-space:nowrap}.search-editor .messages{cursor:default;margin-top:-5px}.search-editor .message{padding-left:7px;padding-right:22px;padding-top:0}.search-editor a.prominent{text-decoration:underline}.monaco-editor .searchEditorFindMatch{background-color:var(--vscode-searchEditor-findMatchBackground);border:1px solid var(--vscode-searchEditor-findMatchBorder);box-sizing:border-box}.monaco-editor.hc-black .searchEditorFindMatch,.monaco-editor.hc-light .searchEditorFindMatch{border:1px dotted var(--vscode-searchEditor-findMatchBorder)}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };