@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.
Files changed (35) hide show
  1. package/package.json +2 -2
  2. package/search.js +4 -4
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  6. package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +0 -776
  7. package/vscode/src/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +0 -6
  8. package/vscode/src/vs/workbench/contrib/search/browser/media/searchview.css.js +0 -6
  9. package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +0 -231
  10. package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +0 -342
  11. package/vscode/src/vs/workbench/contrib/search/browser/replaceContributions.js +0 -8
  12. package/vscode/src/vs/workbench/contrib/search/browser/replaceService.js +0 -232
  13. package/vscode/src/vs/workbench/contrib/search/browser/search.contribution.js +0 -621
  14. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +0 -209
  15. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +0 -511
  16. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +0 -374
  17. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsSymbol.js +0 -43
  18. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +0 -44
  19. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +0 -323
  20. package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +0 -47
  21. package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +0 -96
  22. package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +0 -66
  23. package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +0 -434
  24. package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +0 -2096
  25. package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +0 -667
  26. package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +0 -234
  27. package/vscode/src/vs/workbench/contrib/search/common/cacheState.js +0 -87
  28. package/vscode/src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +0 -6
  29. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +0 -586
  30. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.js +0 -736
  31. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +0 -189
  32. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +0 -320
  33. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +0 -138
  34. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +0 -293
  35. package/vscode/src/vs/workbench/services/search/common/searchService.js +0 -372
@@ -1,6 +0,0 @@
1
- import n from '../../../../../../../../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:\"\\ea76\"}";
4
- n(css,{});
5
-
6
- export { css, css as default };
@@ -1,6 +0,0 @@
1
- import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
2
-
3
- var css = ".search-view{display:flex;flex-direction:column;height:100%}.search-view .results{flex-grow:1;min-height:0}.search-view .search-widgets-container{margin:0 12px 0 2px;padding-bottom:6px;padding-top:6px}.search-view .search-widget .toggle-replace-button{align-items:center;background-color:unset;background-position:50%;background-repeat:no-repeat;box-sizing:border-box;color:inherit;cursor:pointer;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:16px}.monaco-workbench .search-view .search-widget .toggle-replace-button:hover{background-color:var(--vscode-toolbar-hoverBackground)}.monaco-workbench .search-view .search-widget .toggle-replace-button:active{background-color:var(--vscode-toolbar-activeBackground)}.search-view .search-widget .replace-container,.search-view .search-widget .search-container{margin-left:18px}.search-view .search-widget .monaco-inputbox>.ibwrapper{height:100%}.search-view .search-widget .monaco-inputbox>.ibwrapper>.mirror,.search-view .search-widget .monaco-inputbox>.ibwrapper>textarea.input{padding:3px 0 3px 6px}.search-view .search-widget .monaco-inputbox>.ibwrapper>textarea.input{height:26px;overflow:initial}.search-view .search-widget .monaco-findInput .monaco-scrollable-element .scrollbar{opacity:0}.search-view .monaco-inputbox>.ibwrapper>textarea.input{scrollbar-width:none}.search-view .monaco-inputbox>.ibwrapper>textarea.input::-webkit-scrollbar{display:none}.search-view .monaco-findInput{display:inline-block;vertical-align:middle;width:100%}.search-view .search-widget .replace-container{display:inline-flex;margin-top:6px;position:relative}.search-view .search-widget .replace-input{display:flex;position:relative;vertical-align:middle;width:auto!important}.search-view .search-widget .replace-input>.controls{position:absolute;right:2px;top:3px}.search-view .search-widget .replace-container.disabled{display:none}.search-view .search-widget .replace-container .monaco-action-bar{height:25px;margin-left:4px}.search-view .query-details{margin:0 0 0 18px;min-height:1em;position:relative}.search-view .query-details .more{color:inherit;cursor:pointer;height:16px;position:absolute;right:-2px;width:25px;z-index:2}.search-view .query-details .file-types{display:none}.search-view .query-details .file-types>.monaco-inputbox{height:25px;width:100%}.search-view .query-details.more .file-types{display:inherit}.search-view .query-details.more .file-types:last-child{padding-bottom:4px}.search-view .query-details.more h4{font-size:11px;font-weight:400;margin:0;overflow:hidden;padding:4px 0 0;text-overflow:ellipsis;white-space:nowrap}.search-view .messages{color:var(--vscode-search-resultsInfoForeground);cursor:default;margin-top:-5px}.search-view .message{overflow-wrap:break-word;padding:0 22px 8px}.search-view .message p:first-child{margin-bottom:0;margin-top:0;padding-bottom:4px;user-select:text;-webkit-user-select:text}.search-view .message a{color:var(--vscode-textLink-foreground)}.search-view .message a:active,.search-view .message a:hover{color:var(--vscode-textLink-activeForeground)}.search-view .filematch,.search-view .foldermatch{display:flex;height:100%;line-height:22px;padding:0;position:relative}.pane-body:not(.wide) .search-view .filematch .monaco-icon-label,.pane-body:not(.wide) .search-view .foldermatch .monaco-icon-label,.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row.focused .filematch .monaco-icon-label,.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row.focused .foldermatch .monaco-icon-label,.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row:hover:not(.highlighted) .filematch .monaco-icon-label,.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row:hover:not(.highlighted) .foldermatch .monaco-icon-label{flex:1}.pane-body.wide .search-view .filematch .badge,.pane-body.wide .search-view .foldermatch .badge{margin-left:10px}.search-view .linematch{display:flex;line-height:22px;overflow:hidden;position:relative}.search-view .linematch>.match{overflow:hidden;text-overflow:ellipsis;white-space:pre}.search-view .linematch .matchLineNum{display:none;font-size:.9em;margin-left:7px;margin-right:4px;opacity:.7}.search-view .linematch .matchLineNum.show{display:block}.pane-body.wide .search-view .monaco-list .monaco-list-row .filematch .actionBarContainer,.pane-body.wide .search-view .monaco-list .monaco-list-row .foldermatch .actionBarContainer,.search-view .monaco-list .monaco-list-row .linematch .actionBarContainer{flex:1 0 auto}.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row .filematch .actionBarContainer,.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row .foldermatch .actionBarContainer{flex:0 0 auto}.pane-body:not(.wide) .search-view .monaco-list .monaco-list-row .linematch .actionBarContainer,.search-view.actions-right .monaco-list .monaco-list-row .filematch .actionBarContainer,.search-view.actions-right .monaco-list .monaco-list-row .foldermatch .actionBarContainer,.search-view.actions-right .monaco-list .monaco-list-row .linematch .actionBarContainer{text-align:right}.search-view .monaco-list .monaco-list-row .monaco-action-bar{display:none;line-height:1em;padding:0 .8em 0 .4em}.search-view .monaco-list .monaco-list-row .monaco-action-bar .action-item{margin:0}.search-view .monaco-list .monaco-list-row.focused .monaco-action-bar,.search-view .monaco-list .monaco-list-row.selected .monaco-action-bar,.search-view .monaco-list .monaco-list-row:hover:not(.highlighted) .monaco-action-bar{display:inline-block}.search-view .monaco-list .monaco-list-row .monaco-action-bar .action-item{margin-right:.2em}.search-view .monaco-list .monaco-list-row .monaco-action-bar .action-label{padding:2px}.monaco-workbench.hc-black .search-view .monaco-list .monaco-list-row .monaco-action-bar .action-label,.monaco-workbench.hc-light .search-view .monaco-list .monaco-list-row .monaco-action-bar .action-label{margin-top:2px}.search-view .monaco-count-badge{margin-right:12px}.pane-body:not(.wide) .search-view>.results>.monaco-list .monaco-list-row.focused .filematch .monaco-count-badge,.pane-body:not(.wide) .search-view>.results>.monaco-list .monaco-list-row.focused .foldermatch .monaco-count-badge,.pane-body:not(.wide) .search-view>.results>.monaco-list .monaco-list-row.focused .linematch .monaco-count-badge,.pane-body:not(.wide) .search-view>.results>.monaco-list .monaco-list-row:hover .filematch .monaco-count-badge,.pane-body:not(.wide) .search-view>.results>.monaco-list .monaco-list-row:hover .foldermatch .monaco-count-badge,.pane-body:not(.wide) .search-view>.results>.monaco-list .monaco-list-row:hover .linematch .monaco-count-badge{display:none}.search-view .replace.findInFileMatch{background-color:var(--vscode-diffEditor-removedTextBackground);border:1px solid var(--vscode-diffEditor-removedTextBackground);text-decoration:line-through}.monaco-workbench.hc-dark .search-view .replace.findInFileMatch,.monaco-workbench.hc-light .search-view .replace.findInFileMatch{border:1px dashed var(--vscode-diffEditor-removedTextBackground)}.search-view .findInFileMatch,.search-view .replaceMatch{white-space:pre}.search-view .findInFileMatch{background-color:var(--vscode-editor-findMatchHighlightBackground);border:1px solid var(--vscode-editor-findMatchHighlightBorder)}.monaco-workbench.hc-dark .search-view .findInFileMatch,.monaco-workbench.hc-light .search-view .findInFileMatch{border:1px dashed var(--vscode-editor-findMatchHighlightBorder)}.search-view .replaceMatch{background-color:var(--vscode-diffEditor-insertedTextBackground)}.monaco-workbench.hc-black .search-view .findInFileMatch,.monaco-workbench.hc-black .search-view .replaceMatch,.monaco-workbench.hc-light .search-view .findInFileMatch,.monaco-workbench.hc-light .search-view .replaceMatch{background:none!important;box-sizing:border-box}.search-view .replaceMatch:not(:empty){border:1px solid var(--vscode-diffEditor-insertedLineBackground)}.monaco-workbench.hc-dark .search-view .replaceMatch:not(:empty),.monaco-workbench.hc-light .search-view .replaceMatch:not(:empty){border:1px dashed var(--vscode-diffEditor-insertedLineBackground)}.monaco-workbench.hc-black .search-view .filematch,.monaco-workbench.hc-black .search-view .foldermatch,.monaco-workbench.hc-black .search-view .linematch,.monaco-workbench.hc-light .search-view .filematch,.monaco-workbench.hc-light .search-view .foldermatch,.monaco-workbench.hc-light .search-view .linematch{line-height:20px}.monaco-workbench.vs .search-panel .search-view .monaco-inputbox{border:1px solid transparent}.text-search-provider-messages .providerMessage{padding-top:4px}.text-search-provider-messages .providerMessage .codicon{padding-right:3px;position:relative;top:3px}.monaco-workbench .search-view .monaco-list.element-focused .monaco-list-row.focused.selected:not(.highlighted) .action-label:focus{outline-color:var(--vscode-list-activeSelectionForeground)}.monaco-workbench .search-container .monaco-custom-toggle.disabled{background-color:inherit!important;cursor:default;opacity:.3;pointer-events:none;user-select:none;-webkit-user-select:none}.monaco-workbench .search-container .find-filter-button{box-sizing:border-box;color:inherit;cursor:pointer;float:left;margin-left:2px;user-select:none;-webkit-user-select:none}";
4
- n(css,{});
5
-
6
- export { css, css as default };
@@ -1,231 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { trackFocus } from 'vscode/vscode/vs/base/browser/dom';
3
- import { Toggle } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
4
- import { Widget } from 'vscode/vscode/vs/base/browser/ui/widget';
5
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
6
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
7
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
8
- import { ContextScopedHistoryInputBox } from 'vscode/vscode/vs/platform/history/browser/contextScopedHistoryWidget';
9
- import { showHistoryKeybindingHint } from 'vscode/vscode/vs/platform/history/browser/historyWidgetKeybindingHint';
10
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
11
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
12
- import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
13
- import { defaultToggleStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
14
-
15
- let PatternInputWidget = class PatternInputWidget extends Widget {
16
- static { this.OPTION_CHANGE = 'optionChange'; }
17
- constructor(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService) {
18
- super();
19
- this.contextViewProvider = contextViewProvider;
20
- this.contextKeyService = contextKeyService;
21
- this.configurationService = configurationService;
22
- this.keybindingService = keybindingService;
23
- this._onSubmit = this._register(( new Emitter()));
24
- this.onSubmit = this._onSubmit.event;
25
- this._onCancel = this._register(( new Emitter()));
26
- this.onCancel = this._onCancel.event;
27
- options = {
28
- ...{
29
- ariaLabel: ( localizeWithPath(
30
- 'vs/workbench/contrib/search/browser/patternInputWidget',
31
- 'defaultLabel',
32
- "input"
33
- ))
34
- },
35
- ...options,
36
- };
37
- this.width = options.width ?? 100;
38
- this.render(options);
39
- parent.appendChild(this.domNode);
40
- }
41
- dispose() {
42
- super.dispose();
43
- this.inputFocusTracker?.dispose();
44
- }
45
- setWidth(newWidth) {
46
- this.width = newWidth;
47
- this.contextViewProvider.layout();
48
- this.setInputWidth();
49
- }
50
- getValue() {
51
- return this.inputBox.value;
52
- }
53
- setValue(value) {
54
- if (this.inputBox.value !== value) {
55
- this.inputBox.value = value;
56
- }
57
- }
58
- select() {
59
- this.inputBox.select();
60
- }
61
- focus() {
62
- this.inputBox.focus();
63
- }
64
- inputHasFocus() {
65
- return this.inputBox.hasFocus();
66
- }
67
- setInputWidth() {
68
- this.inputBox.width = this.width - this.getSubcontrolsWidth() - 2;
69
- }
70
- getSubcontrolsWidth() {
71
- return 0;
72
- }
73
- getHistory() {
74
- return this.inputBox.getHistory();
75
- }
76
- clearHistory() {
77
- this.inputBox.clearHistory();
78
- }
79
- prependHistory(history) {
80
- this.inputBox.prependHistory(history);
81
- }
82
- clear() {
83
- this.setValue('');
84
- }
85
- onSearchSubmit() {
86
- this.inputBox.addToHistory();
87
- }
88
- showNextTerm() {
89
- this.inputBox.showNextValue();
90
- }
91
- showPreviousTerm() {
92
- this.inputBox.showPreviousValue();
93
- }
94
- render(options) {
95
- this.domNode = document.createElement('div');
96
- this.domNode.classList.add('monaco-findInput');
97
- this.inputBox = ( new ContextScopedHistoryInputBox(this.domNode, this.contextViewProvider, {
98
- placeholder: options.placeholder,
99
- showPlaceholderOnFocus: options.showPlaceholderOnFocus,
100
- tooltip: options.tooltip,
101
- ariaLabel: options.ariaLabel,
102
- validationOptions: {
103
- validation: undefined
104
- },
105
- history: options.history || [],
106
- showHistoryHint: () => showHistoryKeybindingHint(this.keybindingService),
107
- inputBoxStyles: options.inputBoxStyles
108
- }, this.contextKeyService));
109
- this._register(this.inputBox.onDidChange(() => this._onSubmit.fire(true)));
110
- this.inputFocusTracker = trackFocus(this.inputBox.inputElement);
111
- this.onkeyup(this.inputBox.inputElement, (keyboardEvent) => this.onInputKeyUp(keyboardEvent));
112
- const controls = document.createElement('div');
113
- controls.className = 'controls';
114
- this.renderSubcontrols(controls);
115
- this.domNode.appendChild(controls);
116
- this.setInputWidth();
117
- }
118
- renderSubcontrols(_controlsDiv) {
119
- }
120
- onInputKeyUp(keyboardEvent) {
121
- switch (keyboardEvent.keyCode) {
122
- case 3 :
123
- this.onSearchSubmit();
124
- this._onSubmit.fire(false);
125
- return;
126
- case 9 :
127
- this._onCancel.fire();
128
- return;
129
- }
130
- }
131
- };
132
- PatternInputWidget = ( __decorate([
133
- ( __param(3, IContextKeyService)),
134
- ( __param(4, IConfigurationService)),
135
- ( __param(5, IKeybindingService))
136
- ], PatternInputWidget));
137
- let IncludePatternInputWidget = class IncludePatternInputWidget extends PatternInputWidget {
138
- constructor(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService) {
139
- super(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService);
140
- this._onChangeSearchInEditorsBoxEmitter = this._register(( new Emitter()));
141
- this.onChangeSearchInEditorsBox = this._onChangeSearchInEditorsBoxEmitter.event;
142
- }
143
- dispose() {
144
- super.dispose();
145
- this.useSearchInEditorsBox.dispose();
146
- }
147
- onlySearchInOpenEditors() {
148
- return this.useSearchInEditorsBox.checked;
149
- }
150
- setOnlySearchInOpenEditors(value) {
151
- this.useSearchInEditorsBox.checked = value;
152
- this._onChangeSearchInEditorsBoxEmitter.fire();
153
- }
154
- getSubcontrolsWidth() {
155
- return super.getSubcontrolsWidth() + this.useSearchInEditorsBox.width();
156
- }
157
- renderSubcontrols(controlsDiv) {
158
- this.useSearchInEditorsBox = this._register(( new Toggle({
159
- icon: Codicon.book,
160
- title: ( localizeWithPath(
161
- 'vs/workbench/contrib/search/browser/patternInputWidget',
162
- 'onlySearchInOpenEditors',
163
- "Search only in Open Editors"
164
- )),
165
- isChecked: false,
166
- ...defaultToggleStyles
167
- })));
168
- this._register(this.useSearchInEditorsBox.onChange(viaKeyboard => {
169
- this._onChangeSearchInEditorsBoxEmitter.fire();
170
- if (!viaKeyboard) {
171
- this.inputBox.focus();
172
- }
173
- }));
174
- controlsDiv.appendChild(this.useSearchInEditorsBox.domNode);
175
- super.renderSubcontrols(controlsDiv);
176
- }
177
- };
178
- IncludePatternInputWidget = ( __decorate([
179
- ( __param(3, IContextKeyService)),
180
- ( __param(4, IConfigurationService)),
181
- ( __param(5, IKeybindingService))
182
- ], IncludePatternInputWidget));
183
- let ExcludePatternInputWidget = class ExcludePatternInputWidget extends PatternInputWidget {
184
- constructor(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService) {
185
- super(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService);
186
- this._onChangeIgnoreBoxEmitter = this._register(( new Emitter()));
187
- this.onChangeIgnoreBox = this._onChangeIgnoreBoxEmitter.event;
188
- }
189
- dispose() {
190
- super.dispose();
191
- this.useExcludesAndIgnoreFilesBox.dispose();
192
- }
193
- useExcludesAndIgnoreFiles() {
194
- return this.useExcludesAndIgnoreFilesBox.checked;
195
- }
196
- setUseExcludesAndIgnoreFiles(value) {
197
- this.useExcludesAndIgnoreFilesBox.checked = value;
198
- this._onChangeIgnoreBoxEmitter.fire();
199
- }
200
- getSubcontrolsWidth() {
201
- return super.getSubcontrolsWidth() + this.useExcludesAndIgnoreFilesBox.width();
202
- }
203
- renderSubcontrols(controlsDiv) {
204
- this.useExcludesAndIgnoreFilesBox = this._register(( new Toggle({
205
- icon: Codicon.exclude,
206
- actionClassName: 'useExcludesAndIgnoreFiles',
207
- title: ( localizeWithPath(
208
- 'vs/workbench/contrib/search/browser/patternInputWidget',
209
- 'useExcludesAndIgnoreFilesDescription',
210
- "Use Exclude Settings and Ignore Files"
211
- )),
212
- isChecked: true,
213
- ...defaultToggleStyles
214
- })));
215
- this._register(this.useExcludesAndIgnoreFilesBox.onChange(viaKeyboard => {
216
- this._onChangeIgnoreBoxEmitter.fire();
217
- if (!viaKeyboard) {
218
- this.inputBox.focus();
219
- }
220
- }));
221
- controlsDiv.appendChild(this.useExcludesAndIgnoreFilesBox.domNode);
222
- super.renderSubcontrols(controlsDiv);
223
- }
224
- };
225
- ExcludePatternInputWidget = ( __decorate([
226
- ( __param(3, IContextKeyService)),
227
- ( __param(4, IConfigurationService)),
228
- ( __param(5, IKeybindingService))
229
- ], ExcludePatternInputWidget));
230
-
231
- export { ExcludePatternInputWidget, IncludePatternInputWidget, PatternInputWidget };
@@ -1,342 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
3
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
4
- import { ResourceSet } from 'vscode/vscode/vs/base/common/map';
5
- import { basenameOrAuthority, dirname } from 'vscode/vscode/vs/base/common/resources';
6
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
7
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
8
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
9
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
10
- import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
11
- import { getSelectionKeyboardEvent } from 'vscode/vscode/vs/platform/list/browser/listService';
12
- import { PickerQuickAccessProvider, TriggerAction } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
13
- import { DefaultQuickAccessFilterValue } from 'vscode/vscode/vs/platform/quickinput/common/quickAccess';
14
- import { QuickInputHideReason } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
15
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
16
- import { searchDetailsIcon, searchOpenInFileIcon, searchActivityBarIcon } from '../searchIcons.js';
17
- import { SearchModel, SearchModelLocation, searchComparer } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
18
- import { getEditorSelectionFromMatch } from '../searchView.js';
19
- import { getOutOfWorkspaceEditorResources } from 'vscode/vscode/vs/workbench/contrib/search/common/search';
20
- import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
21
- import { QueryBuilder } from 'vscode/vscode/vs/workbench/services/search/common/queryBuilder';
22
- import { VIEW_ID } from 'vscode/vscode/vs/workbench/services/search/common/search';
23
- import { Event } from 'vscode/vscode/vs/base/common/event';
24
- import { EditorViewState } from 'vscode/vscode/vs/workbench/browser/quickaccess';
25
- import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
26
- import { IHistoryService } from 'vscode/vscode/vs/workbench/services/history/common/history';
27
- import { Sequencer } from 'vscode/vscode/vs/base/common/async';
28
-
29
- const TEXT_SEARCH_QUICK_ACCESS_PREFIX = '%';
30
- const DEFAULT_TEXT_QUERY_BUILDER_OPTIONS = {
31
- _reason: 'quickAccessSearch',
32
- disregardIgnoreFiles: false,
33
- disregardExcludeSettings: false,
34
- onlyOpenEditors: false,
35
- expandPatterns: true
36
- };
37
- const MAX_FILES_SHOWN = 30;
38
- const MAX_RESULTS_PER_FILE = 10;
39
- let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAccessProvider {
40
- _getTextQueryBuilderOptions(charsPerLine) {
41
- return {
42
- ...DEFAULT_TEXT_QUERY_BUILDER_OPTIONS,
43
- ...{
44
- extraFileResources: this._instantiationService.invokeFunction(getOutOfWorkspaceEditorResources),
45
- maxResults: this.configuration.maxResults ?? undefined,
46
- isSmartCase: this.configuration.smartCase,
47
- },
48
- previewOptions: {
49
- matchLines: 1,
50
- charsPerLine
51
- }
52
- };
53
- }
54
- constructor(_instantiationService, _contextService, _editorService, _labelService, _viewsService, _configurationService, _historyService) {
55
- super(TEXT_SEARCH_QUICK_ACCESS_PREFIX, { canAcceptInBackground: true, shouldSkipTrimPickFilter: true });
56
- this._instantiationService = _instantiationService;
57
- this._contextService = _contextService;
58
- this._editorService = _editorService;
59
- this._labelService = _labelService;
60
- this._viewsService = _viewsService;
61
- this._configurationService = _configurationService;
62
- this._historyService = _historyService;
63
- this.currentAsyncSearch = Promise.resolve({
64
- results: [],
65
- messages: []
66
- });
67
- this.editorViewState = ( new EditorViewState(this._editorService));
68
- this.queryBuilder = this._instantiationService.createInstance(QueryBuilder);
69
- this.searchModel = this._instantiationService.createInstance(SearchModel);
70
- this.searchModel.location = SearchModelLocation.QUICK_ACCESS;
71
- this.editorSequencer = ( new Sequencer());
72
- }
73
- dispose() {
74
- this.searchModel.dispose();
75
- super.dispose();
76
- }
77
- provide(picker, token, runOptions) {
78
- const disposables = ( new DisposableStore());
79
- if (TEXT_SEARCH_QUICK_ACCESS_PREFIX.length < picker.value.length) {
80
- picker.valueSelection = [TEXT_SEARCH_QUICK_ACCESS_PREFIX.length, picker.value.length];
81
- }
82
- picker.customButton = true;
83
- picker.customLabel = '$(link-external)';
84
- this.editorViewState.reset();
85
- disposables.add(picker.onDidCustom(() => {
86
- if (this.searchModel.searchResult.count() > 0) {
87
- this.moveToSearchViewlet(undefined);
88
- }
89
- else {
90
- this._viewsService.openView(VIEW_ID, true);
91
- }
92
- picker.hide();
93
- }));
94
- disposables.add(picker.onDidChangeActive(() => {
95
- const [item] = picker.activeItems;
96
- if (item?.match) {
97
- this.editorViewState.set();
98
- const itemMatch = item.match;
99
- this.editorSequencer.queue(async () => {
100
- const disposable = this._historyService.suspendTracking();
101
- try {
102
- await this._editorService.openEditor({
103
- resource: itemMatch.parent().resource,
104
- options: { preserveFocus: true, revealIfOpened: true, ignoreError: true, selection: itemMatch.range() }
105
- });
106
- }
107
- finally {
108
- disposable.dispose();
109
- }
110
- });
111
- }
112
- }));
113
- disposables.add(Event.once(picker.onDidHide)(({ reason }) => {
114
- if (reason === QuickInputHideReason.Gesture) {
115
- this.editorViewState.restore(true);
116
- }
117
- this.searchModel.searchResult.toggleHighlights(false);
118
- }));
119
- disposables.add(super.provide(picker, token, runOptions));
120
- disposables.add(picker.onDidAccept(() => this.searchModel.searchResult.toggleHighlights(false)));
121
- return disposables;
122
- }
123
- get configuration() {
124
- const editorConfig = this._configurationService.getValue().workbench?.editor;
125
- const searchConfig = this._configurationService.getValue().search;
126
- return {
127
- openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
128
- preserveInput: searchConfig.experimental.quickAccess.preserveInput,
129
- maxResults: searchConfig.maxResults,
130
- smartCase: searchConfig.smartCase,
131
- };
132
- }
133
- get defaultFilterValue() {
134
- if (this.configuration.preserveInput) {
135
- return DefaultQuickAccessFilterValue.LAST;
136
- }
137
- return undefined;
138
- }
139
- doSearch(contentPattern, token) {
140
- if (contentPattern === '') {
141
- return undefined;
142
- }
143
- const folderResources = this._contextService.getWorkspace().folders;
144
- const content = {
145
- pattern: contentPattern,
146
- };
147
- this.searchModel.searchResult.toggleHighlights(false);
148
- const charsPerLine = content.isRegExp ? 10000 : 1000;
149
- const query = this.queryBuilder.text(content, ( folderResources.map(folder => folder.uri)), this._getTextQueryBuilderOptions(charsPerLine));
150
- const result = this.searchModel.search(query, undefined, token);
151
- const getAsyncResults = async () => {
152
- this.currentAsyncSearch = result.asyncResults;
153
- await result.asyncResults;
154
- const syncResultURIs = ( new ResourceSet(( result.syncResults.map(e => e.resource))));
155
- return this.searchModel.searchResult.matches().filter(e => !( syncResultURIs.has(e.resource)));
156
- };
157
- return {
158
- syncResults: this.searchModel.searchResult.matches(),
159
- asyncResults: getAsyncResults()
160
- };
161
- }
162
- moveToSearchViewlet(currentElem) {
163
- this._viewsService.openView(VIEW_ID, false);
164
- const viewlet = this._viewsService.getActiveViewWithId(VIEW_ID);
165
- viewlet.replaceSearchModel(this.searchModel, this.currentAsyncSearch);
166
- this.searchModel = this._instantiationService.createInstance(SearchModel);
167
- this.searchModel.location = SearchModelLocation.QUICK_ACCESS;
168
- const viewer = viewlet?.getControl();
169
- if (currentElem) {
170
- viewer.setFocus([currentElem], getSelectionKeyboardEvent());
171
- viewer.setSelection([currentElem], getSelectionKeyboardEvent());
172
- viewer.reveal(currentElem);
173
- }
174
- else {
175
- viewlet.searchAndReplaceWidget.focus();
176
- }
177
- }
178
- _getPicksFromMatches(matches, limit) {
179
- matches = matches.sort(searchComparer);
180
- const files = matches.length > limit ? matches.slice(0, limit) : matches;
181
- const picks = [];
182
- for (let fileIndex = 0; fileIndex < matches.length; fileIndex++) {
183
- if (fileIndex === limit) {
184
- picks.push({
185
- type: 'separator',
186
- });
187
- picks.push({
188
- label: ( localizeWithPath(
189
- 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
190
- 'QuickSearchSeeMoreFiles',
191
- "See More Files"
192
- )),
193
- iconClass: ThemeIcon.asClassName(searchDetailsIcon),
194
- accept: async () => {
195
- this.moveToSearchViewlet(matches[limit]);
196
- }
197
- });
198
- break;
199
- }
200
- const fileMatch = files[fileIndex];
201
- const label = basenameOrAuthority(fileMatch.resource);
202
- const description = this._labelService.getUriLabel(dirname(fileMatch.resource), { relative: true });
203
- picks.push({
204
- label,
205
- type: 'separator',
206
- tooltip: description,
207
- buttons: [{
208
- iconClass: ThemeIcon.asClassName(searchOpenInFileIcon),
209
- tooltip: ( localizeWithPath(
210
- 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
211
- 'QuickSearchOpenInFile',
212
- "Open File"
213
- ))
214
- }],
215
- });
216
- const results = fileMatch.matches() ?? [];
217
- for (let matchIndex = 0; matchIndex < results.length; matchIndex++) {
218
- const element = results[matchIndex];
219
- if (matchIndex === MAX_RESULTS_PER_FILE) {
220
- picks.push({
221
- label: ( localizeWithPath(
222
- 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
223
- 'QuickSearchMore',
224
- "More"
225
- )),
226
- iconClass: ThemeIcon.asClassName(searchDetailsIcon),
227
- accept: async () => {
228
- this.moveToSearchViewlet(element);
229
- }
230
- });
231
- break;
232
- }
233
- const preview = element.preview();
234
- const previewText = (preview.before + preview.inside + preview.after).trim().substring(0, 999);
235
- const match = [{
236
- start: preview.before.length,
237
- end: preview.before.length + preview.inside.length
238
- }];
239
- picks.push({
240
- label: `${previewText}`,
241
- highlights: {
242
- label: match
243
- },
244
- buttons: [{
245
- iconClass: ThemeIcon.asClassName(searchActivityBarIcon),
246
- tooltip: ( localizeWithPath(
247
- 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
248
- 'showMore',
249
- "See in Search Panel"
250
- )),
251
- }],
252
- ariaLabel: `Match at location ${element.range().startLineNumber}:${element.range().startColumn} - ${previewText}`,
253
- accept: async (keyMods, event) => {
254
- await this.handleAccept(fileMatch, {
255
- keyMods,
256
- selection: getEditorSelectionFromMatch(element, this.searchModel),
257
- preserveFocus: event.inBackground,
258
- forcePinned: event.inBackground
259
- });
260
- },
261
- trigger: () => {
262
- this.moveToSearchViewlet(element);
263
- return TriggerAction.CLOSE_PICKER;
264
- },
265
- match: element
266
- });
267
- }
268
- }
269
- return picks;
270
- }
271
- async handleAccept(fileMatch, options) {
272
- const editorOptions = {
273
- preserveFocus: options.preserveFocus,
274
- pinned: options.keyMods?.ctrlCmd || options.forcePinned || this.configuration.openEditorPinned,
275
- selection: options.selection
276
- };
277
- const targetGroup = options.keyMods?.alt || (this.configuration.openEditorPinned && options.keyMods?.ctrlCmd) || options.forceOpenSideBySide ? SIDE_GROUP : ACTIVE_GROUP;
278
- await this._editorService.openEditor({
279
- resource: fileMatch.resource,
280
- options: editorOptions
281
- }, targetGroup);
282
- }
283
- _getPicks(contentPattern, disposables, token) {
284
- const searchModelAtTimeOfSearch = this.searchModel;
285
- if (contentPattern === '') {
286
- this.searchModel.searchResult.clear();
287
- return [{
288
- label: ( localizeWithPath(
289
- 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
290
- 'enterSearchTerm',
291
- "Enter a term to search for across your files."
292
- ))
293
- }];
294
- }
295
- const conditionalTokenCts = disposables.add(( new CancellationTokenSource()));
296
- disposables.add(token.onCancellationRequested(() => {
297
- if (searchModelAtTimeOfSearch.location === SearchModelLocation.QUICK_ACCESS) {
298
- conditionalTokenCts.cancel();
299
- }
300
- }));
301
- const allMatches = this.doSearch(contentPattern, conditionalTokenCts.token);
302
- if (!allMatches) {
303
- return null;
304
- }
305
- const matches = allMatches.syncResults;
306
- const syncResult = this._getPicksFromMatches(matches, MAX_FILES_SHOWN);
307
- if (syncResult.length > 0) {
308
- this.searchModel.searchResult.toggleHighlights(true);
309
- }
310
- if (matches.length >= MAX_FILES_SHOWN) {
311
- return syncResult;
312
- }
313
- return {
314
- picks: syncResult,
315
- additionalPicks: allMatches.asyncResults
316
- .then(asyncResults => (asyncResults.length + syncResult.length === 0) ? [{
317
- label: ( localizeWithPath(
318
- 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
319
- 'noAnythingResults',
320
- "No matching results"
321
- ))
322
- }] : this._getPicksFromMatches(asyncResults, MAX_FILES_SHOWN - matches.length))
323
- .then(picks => {
324
- if (picks.length > 0) {
325
- this.searchModel.searchResult.toggleHighlights(true);
326
- }
327
- return picks;
328
- })
329
- };
330
- }
331
- };
332
- TextSearchQuickAccess = ( __decorate([
333
- ( __param(0, IInstantiationService)),
334
- ( __param(1, IWorkspaceContextService)),
335
- ( __param(2, IEditorService)),
336
- ( __param(3, ILabelService)),
337
- ( __param(4, IViewsService)),
338
- ( __param(5, IConfigurationService)),
339
- ( __param(6, IHistoryService))
340
- ], TextSearchQuickAccess));
341
-
342
- export { TEXT_SEARCH_QUICK_ACCESS_PREFIX, TextSearchQuickAccess };
@@ -1,8 +0,0 @@
1
- import { ReplacePreviewContentProvider } from './replaceService.js';
2
- import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
3
-
4
- function registerContributions() {
5
- registerWorkbenchContribution2(ReplacePreviewContentProvider.ID, ReplacePreviewContentProvider, 1 );
6
- }
7
-
8
- export { registerContributions };