@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,6 @@
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\";font-family:codicon}";
4
+ n(css,{});
5
+
6
+ export { css, css as default };
@@ -0,0 +1,6 @@
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 };
@@ -0,0 +1,234 @@
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
+ import { getDefaultHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
15
+
16
+ let PatternInputWidget = class PatternInputWidget extends Widget {
17
+ static { this.OPTION_CHANGE = 'optionChange'; }
18
+ constructor(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService) {
19
+ super();
20
+ this.contextViewProvider = contextViewProvider;
21
+ this.contextKeyService = contextKeyService;
22
+ this.configurationService = configurationService;
23
+ this.keybindingService = keybindingService;
24
+ this._onSubmit = this._register(( new Emitter()));
25
+ this.onSubmit = this._onSubmit.event;
26
+ this._onCancel = this._register(( new Emitter()));
27
+ this.onCancel = this._onCancel.event;
28
+ options = {
29
+ ...{
30
+ ariaLabel: ( localizeWithPath(
31
+ 'vs/workbench/contrib/search/browser/patternInputWidget',
32
+ 'defaultLabel',
33
+ "input"
34
+ ))
35
+ },
36
+ ...options,
37
+ };
38
+ this.width = options.width ?? 100;
39
+ this.render(options);
40
+ parent.appendChild(this.domNode);
41
+ }
42
+ dispose() {
43
+ super.dispose();
44
+ this.inputFocusTracker?.dispose();
45
+ }
46
+ setWidth(newWidth) {
47
+ this.width = newWidth;
48
+ this.contextViewProvider.layout();
49
+ this.setInputWidth();
50
+ }
51
+ getValue() {
52
+ return this.inputBox.value;
53
+ }
54
+ setValue(value) {
55
+ if (this.inputBox.value !== value) {
56
+ this.inputBox.value = value;
57
+ }
58
+ }
59
+ select() {
60
+ this.inputBox.select();
61
+ }
62
+ focus() {
63
+ this.inputBox.focus();
64
+ }
65
+ inputHasFocus() {
66
+ return this.inputBox.hasFocus();
67
+ }
68
+ setInputWidth() {
69
+ this.inputBox.width = this.width - this.getSubcontrolsWidth() - 2;
70
+ }
71
+ getSubcontrolsWidth() {
72
+ return 0;
73
+ }
74
+ getHistory() {
75
+ return this.inputBox.getHistory();
76
+ }
77
+ clearHistory() {
78
+ this.inputBox.clearHistory();
79
+ }
80
+ prependHistory(history) {
81
+ this.inputBox.prependHistory(history);
82
+ }
83
+ clear() {
84
+ this.setValue('');
85
+ }
86
+ onSearchSubmit() {
87
+ this.inputBox.addToHistory();
88
+ }
89
+ showNextTerm() {
90
+ this.inputBox.showNextValue();
91
+ }
92
+ showPreviousTerm() {
93
+ this.inputBox.showPreviousValue();
94
+ }
95
+ render(options) {
96
+ this.domNode = document.createElement('div');
97
+ this.domNode.classList.add('monaco-findInput');
98
+ this.inputBox = ( new ContextScopedHistoryInputBox(this.domNode, this.contextViewProvider, {
99
+ placeholder: options.placeholder,
100
+ showPlaceholderOnFocus: options.showPlaceholderOnFocus,
101
+ tooltip: options.tooltip,
102
+ ariaLabel: options.ariaLabel,
103
+ validationOptions: {
104
+ validation: undefined
105
+ },
106
+ history: options.history || [],
107
+ showHistoryHint: () => showHistoryKeybindingHint(this.keybindingService),
108
+ inputBoxStyles: options.inputBoxStyles
109
+ }, this.contextKeyService));
110
+ this._register(this.inputBox.onDidChange(() => this._onSubmit.fire(true)));
111
+ this.inputFocusTracker = trackFocus(this.inputBox.inputElement);
112
+ this.onkeyup(this.inputBox.inputElement, (keyboardEvent) => this.onInputKeyUp(keyboardEvent));
113
+ const controls = document.createElement('div');
114
+ controls.className = 'controls';
115
+ this.renderSubcontrols(controls);
116
+ this.domNode.appendChild(controls);
117
+ this.setInputWidth();
118
+ }
119
+ renderSubcontrols(_controlsDiv) {
120
+ }
121
+ onInputKeyUp(keyboardEvent) {
122
+ switch (keyboardEvent.keyCode) {
123
+ case 3 :
124
+ this.onSearchSubmit();
125
+ this._onSubmit.fire(false);
126
+ return;
127
+ case 9 :
128
+ this._onCancel.fire();
129
+ return;
130
+ }
131
+ }
132
+ };
133
+ PatternInputWidget = ( __decorate([
134
+ ( __param(3, IContextKeyService)),
135
+ ( __param(4, IConfigurationService)),
136
+ ( __param(5, IKeybindingService))
137
+ ], PatternInputWidget));
138
+ let IncludePatternInputWidget = class IncludePatternInputWidget extends PatternInputWidget {
139
+ constructor(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService) {
140
+ super(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService);
141
+ this._onChangeSearchInEditorsBoxEmitter = this._register(( new Emitter()));
142
+ this.onChangeSearchInEditorsBox = this._onChangeSearchInEditorsBoxEmitter.event;
143
+ }
144
+ dispose() {
145
+ super.dispose();
146
+ this.useSearchInEditorsBox.dispose();
147
+ }
148
+ onlySearchInOpenEditors() {
149
+ return this.useSearchInEditorsBox.checked;
150
+ }
151
+ setOnlySearchInOpenEditors(value) {
152
+ this.useSearchInEditorsBox.checked = value;
153
+ this._onChangeSearchInEditorsBoxEmitter.fire();
154
+ }
155
+ getSubcontrolsWidth() {
156
+ return super.getSubcontrolsWidth() + this.useSearchInEditorsBox.width();
157
+ }
158
+ renderSubcontrols(controlsDiv) {
159
+ this.useSearchInEditorsBox = this._register(( new Toggle({
160
+ icon: Codicon.book,
161
+ title: ( localizeWithPath(
162
+ 'vs/workbench/contrib/search/browser/patternInputWidget',
163
+ 'onlySearchInOpenEditors',
164
+ "Search only in Open Editors"
165
+ )),
166
+ isChecked: false,
167
+ hoverDelegate: getDefaultHoverDelegate('element'),
168
+ ...defaultToggleStyles
169
+ })));
170
+ this._register(this.useSearchInEditorsBox.onChange(viaKeyboard => {
171
+ this._onChangeSearchInEditorsBoxEmitter.fire();
172
+ if (!viaKeyboard) {
173
+ this.inputBox.focus();
174
+ }
175
+ }));
176
+ controlsDiv.appendChild(this.useSearchInEditorsBox.domNode);
177
+ super.renderSubcontrols(controlsDiv);
178
+ }
179
+ };
180
+ IncludePatternInputWidget = ( __decorate([
181
+ ( __param(3, IContextKeyService)),
182
+ ( __param(4, IConfigurationService)),
183
+ ( __param(5, IKeybindingService))
184
+ ], IncludePatternInputWidget));
185
+ let ExcludePatternInputWidget = class ExcludePatternInputWidget extends PatternInputWidget {
186
+ constructor(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService) {
187
+ super(parent, contextViewProvider, options, contextKeyService, configurationService, keybindingService);
188
+ this._onChangeIgnoreBoxEmitter = this._register(( new Emitter()));
189
+ this.onChangeIgnoreBox = this._onChangeIgnoreBoxEmitter.event;
190
+ }
191
+ dispose() {
192
+ super.dispose();
193
+ this.useExcludesAndIgnoreFilesBox.dispose();
194
+ }
195
+ useExcludesAndIgnoreFiles() {
196
+ return this.useExcludesAndIgnoreFilesBox.checked;
197
+ }
198
+ setUseExcludesAndIgnoreFiles(value) {
199
+ this.useExcludesAndIgnoreFilesBox.checked = value;
200
+ this._onChangeIgnoreBoxEmitter.fire();
201
+ }
202
+ getSubcontrolsWidth() {
203
+ return super.getSubcontrolsWidth() + this.useExcludesAndIgnoreFilesBox.width();
204
+ }
205
+ renderSubcontrols(controlsDiv) {
206
+ this.useExcludesAndIgnoreFilesBox = this._register(( new Toggle({
207
+ icon: Codicon.exclude,
208
+ actionClassName: 'useExcludesAndIgnoreFiles',
209
+ title: ( localizeWithPath(
210
+ 'vs/workbench/contrib/search/browser/patternInputWidget',
211
+ 'useExcludesAndIgnoreFilesDescription',
212
+ "Use Exclude Settings and Ignore Files"
213
+ )),
214
+ isChecked: true,
215
+ hoverDelegate: getDefaultHoverDelegate('element'),
216
+ ...defaultToggleStyles
217
+ })));
218
+ this._register(this.useExcludesAndIgnoreFilesBox.onChange(viaKeyboard => {
219
+ this._onChangeIgnoreBoxEmitter.fire();
220
+ if (!viaKeyboard) {
221
+ this.inputBox.focus();
222
+ }
223
+ }));
224
+ controlsDiv.appendChild(this.useExcludesAndIgnoreFilesBox.domNode);
225
+ super.renderSubcontrols(controlsDiv);
226
+ }
227
+ };
228
+ ExcludePatternInputWidget = ( __decorate([
229
+ ( __param(3, IContextKeyService)),
230
+ ( __param(4, IConfigurationService)),
231
+ ( __param(5, IKeybindingService))
232
+ ], ExcludePatternInputWidget));
233
+
234
+ export { ExcludePatternInputWidget, IncludePatternInputWidget, PatternInputWidget };
@@ -0,0 +1,341 @@
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 { PickerEditorState } from 'vscode/vscode/vs/workbench/browser/quickaccess';
25
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
26
+ import { Sequencer } from 'vscode/vscode/vs/base/common/async';
27
+
28
+ const TEXT_SEARCH_QUICK_ACCESS_PREFIX = '%';
29
+ const DEFAULT_TEXT_QUERY_BUILDER_OPTIONS = {
30
+ _reason: 'quickAccessSearch',
31
+ disregardIgnoreFiles: false,
32
+ disregardExcludeSettings: false,
33
+ onlyOpenEditors: false,
34
+ expandPatterns: true
35
+ };
36
+ const MAX_FILES_SHOWN = 30;
37
+ const MAX_RESULTS_PER_FILE = 10;
38
+ const DEBOUNCE_DELAY = 75;
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) {
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.currentAsyncSearch = Promise.resolve({
63
+ results: [],
64
+ messages: []
65
+ });
66
+ this.queryBuilder = this._instantiationService.createInstance(QueryBuilder);
67
+ this.searchModel = this._register(this._instantiationService.createInstance(SearchModel));
68
+ this.editorViewState = this._register(this._instantiationService.createInstance(PickerEditorState));
69
+ this.searchModel.location = SearchModelLocation.QUICK_ACCESS;
70
+ this.editorSequencer = ( new Sequencer());
71
+ }
72
+ dispose() {
73
+ this.searchModel.dispose();
74
+ super.dispose();
75
+ }
76
+ provide(picker, token, runOptions) {
77
+ const disposables = ( new DisposableStore());
78
+ if (TEXT_SEARCH_QUICK_ACCESS_PREFIX.length < picker.value.length) {
79
+ picker.valueSelection = [TEXT_SEARCH_QUICK_ACCESS_PREFIX.length, picker.value.length];
80
+ }
81
+ picker.customButton = true;
82
+ picker.customLabel = '$(link-external)';
83
+ this.editorViewState.reset();
84
+ disposables.add(picker.onDidCustom(() => {
85
+ if (this.searchModel.searchResult.count() > 0) {
86
+ this.moveToSearchViewlet(undefined);
87
+ }
88
+ else {
89
+ this._viewsService.openView(VIEW_ID, true);
90
+ }
91
+ picker.hide();
92
+ }));
93
+ const onDidChangeActive = () => {
94
+ const [item] = picker.activeItems;
95
+ if (item?.match) {
96
+ this.editorViewState.set();
97
+ const itemMatch = item.match;
98
+ this.editorSequencer.queue(async () => {
99
+ await this.editorViewState.openTransientEditor({
100
+ resource: itemMatch.parent().resource,
101
+ options: { preserveFocus: true, revealIfOpened: true, ignoreError: true, selection: itemMatch.range() }
102
+ });
103
+ });
104
+ }
105
+ };
106
+ disposables.add(Event.debounce(picker.onDidChangeActive, (last, event) => event, DEBOUNCE_DELAY, true)(onDidChangeActive));
107
+ disposables.add(Event.once(picker.onWillHide)(({ reason }) => {
108
+ if (reason === QuickInputHideReason.Gesture) {
109
+ this.editorViewState.restore();
110
+ }
111
+ }));
112
+ disposables.add(Event.once(picker.onDidHide)(({ reason }) => {
113
+ this.searchModel.searchResult.toggleHighlights(false);
114
+ }));
115
+ disposables.add(super.provide(picker, token, runOptions));
116
+ disposables.add(picker.onDidAccept(() => this.searchModel.searchResult.toggleHighlights(false)));
117
+ return disposables;
118
+ }
119
+ get configuration() {
120
+ const editorConfig = this._configurationService.getValue().workbench?.editor;
121
+ const searchConfig = this._configurationService.getValue().search;
122
+ return {
123
+ openEditorPinned: !editorConfig?.enablePreviewFromQuickOpen || !editorConfig?.enablePreview,
124
+ preserveInput: searchConfig.experimental.quickAccess.preserveInput,
125
+ maxResults: searchConfig.maxResults,
126
+ smartCase: searchConfig.smartCase,
127
+ };
128
+ }
129
+ get defaultFilterValue() {
130
+ if (this.configuration.preserveInput) {
131
+ return DefaultQuickAccessFilterValue.LAST;
132
+ }
133
+ return undefined;
134
+ }
135
+ doSearch(contentPattern, token) {
136
+ if (contentPattern === '') {
137
+ return undefined;
138
+ }
139
+ const folderResources = this._contextService.getWorkspace().folders;
140
+ const content = {
141
+ pattern: contentPattern,
142
+ };
143
+ this.searchModel.searchResult.toggleHighlights(false);
144
+ const charsPerLine = content.isRegExp ? 10000 : 1000;
145
+ const query = this.queryBuilder.text(content, ( folderResources.map(folder => folder.uri)), this._getTextQueryBuilderOptions(charsPerLine));
146
+ const result = this.searchModel.search(query, undefined, token);
147
+ const getAsyncResults = async () => {
148
+ this.currentAsyncSearch = result.asyncResults;
149
+ await result.asyncResults;
150
+ const syncResultURIs = ( new ResourceSet(( result.syncResults.map(e => e.resource))));
151
+ return this.searchModel.searchResult.matches().filter(e => !( syncResultURIs.has(e.resource)));
152
+ };
153
+ return {
154
+ syncResults: this.searchModel.searchResult.matches(),
155
+ asyncResults: getAsyncResults()
156
+ };
157
+ }
158
+ moveToSearchViewlet(currentElem) {
159
+ this._viewsService.openView(VIEW_ID, false);
160
+ const viewlet = this._viewsService.getActiveViewWithId(VIEW_ID);
161
+ viewlet.replaceSearchModel(this.searchModel, this.currentAsyncSearch);
162
+ this.searchModel = this._instantiationService.createInstance(SearchModel);
163
+ this.searchModel.location = SearchModelLocation.QUICK_ACCESS;
164
+ const viewer = viewlet?.getControl();
165
+ if (currentElem) {
166
+ viewer.setFocus([currentElem], getSelectionKeyboardEvent());
167
+ viewer.setSelection([currentElem], getSelectionKeyboardEvent());
168
+ viewer.reveal(currentElem);
169
+ }
170
+ else {
171
+ viewlet.searchAndReplaceWidget.focus();
172
+ }
173
+ }
174
+ _getPicksFromMatches(matches, limit) {
175
+ matches = matches.sort(searchComparer);
176
+ const files = matches.length > limit ? matches.slice(0, limit) : matches;
177
+ const picks = [];
178
+ for (let fileIndex = 0; fileIndex < matches.length; fileIndex++) {
179
+ if (fileIndex === limit) {
180
+ picks.push({
181
+ type: 'separator',
182
+ });
183
+ picks.push({
184
+ label: ( localizeWithPath(
185
+ 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
186
+ 'QuickSearchSeeMoreFiles',
187
+ "See More Files"
188
+ )),
189
+ iconClass: ThemeIcon.asClassName(searchDetailsIcon),
190
+ accept: async () => {
191
+ this.moveToSearchViewlet(matches[limit]);
192
+ }
193
+ });
194
+ break;
195
+ }
196
+ const fileMatch = files[fileIndex];
197
+ const label = basenameOrAuthority(fileMatch.resource);
198
+ const description = this._labelService.getUriLabel(dirname(fileMatch.resource), { relative: true });
199
+ picks.push({
200
+ label,
201
+ type: 'separator',
202
+ description,
203
+ buttons: [{
204
+ iconClass: ThemeIcon.asClassName(searchOpenInFileIcon),
205
+ tooltip: ( localizeWithPath(
206
+ 'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
207
+ 'QuickSearchOpenInFile',
208
+ "Open File"
209
+ ))
210
+ }],
211
+ trigger: async () => {
212
+ await this.handleAccept(fileMatch, {});
213
+ return TriggerAction.CLOSE_PICKER;
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
+ ], TextSearchQuickAccess));
340
+
341
+ export { TEXT_SEARCH_QUICK_ACCESS_PREFIX, TextSearchQuickAccess };
@@ -0,0 +1,9 @@
1
+ import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
2
+ import { ReplacePreviewContentProvider } from './replaceService.js';
3
+ import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
4
+
5
+ function registerContributions() {
6
+ registerWorkbenchContribution2(ReplacePreviewContentProvider.ID, ReplacePreviewContentProvider, 1 );
7
+ }
8
+
9
+ export { registerContributions };