@codingame/monaco-vscode-search-service-override 2.0.3 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +11 -33
- package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +88 -16
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +1 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +6 -1
- package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +11 -12
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +201 -173
- package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +38 -38
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-search-service-override",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@2.0
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.1.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -34,10 +34,10 @@ import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/
|
|
|
34
34
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
35
35
|
import { SymbolsQuickAccessProvider } from './symbolsQuickAccess.js';
|
|
36
36
|
import { DefaultQuickAccessFilterValue, Extensions } from 'vscode/vscode/vs/platform/quickinput/common/quickAccess';
|
|
37
|
+
import { EditorViewState } from 'vscode/vscode/vs/workbench/browser/quickaccess';
|
|
37
38
|
import { GotoSymbolQuickAccessProvider } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess';
|
|
38
39
|
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
39
40
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
40
|
-
import { getIEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
41
41
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
42
42
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
43
43
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
@@ -99,9 +99,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
99
99
|
this.pickState = new (class {
|
|
100
100
|
constructor(provider, editorService) {
|
|
101
101
|
this.provider = provider;
|
|
102
|
-
this.editorService = editorService;
|
|
103
102
|
this.picker = undefined;
|
|
104
|
-
this.editorViewState = undefined;
|
|
105
103
|
this.scorerCache = Object.create(null);
|
|
106
104
|
this.fileQueryCache = undefined;
|
|
107
105
|
this.lastOriginalFilter = undefined;
|
|
@@ -109,6 +107,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
109
107
|
this.lastRange = undefined;
|
|
110
108
|
this.lastGlobalPicks = undefined;
|
|
111
109
|
this.isQuickNavigating = undefined;
|
|
110
|
+
this.editorViewState = ( new EditorViewState(editorService));
|
|
112
111
|
}
|
|
113
112
|
set(picker) {
|
|
114
113
|
this.picker = picker;
|
|
@@ -127,29 +126,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
127
126
|
this.lastFilter = undefined;
|
|
128
127
|
this.lastRange = undefined;
|
|
129
128
|
this.lastGlobalPicks = undefined;
|
|
130
|
-
this.editorViewState
|
|
131
|
-
}
|
|
132
|
-
rememberEditorViewState() {
|
|
133
|
-
if (this.editorViewState) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const activeEditorPane = this.editorService.activeEditorPane;
|
|
137
|
-
if (activeEditorPane) {
|
|
138
|
-
this.editorViewState = {
|
|
139
|
-
group: activeEditorPane.group,
|
|
140
|
-
editor: activeEditorPane.input,
|
|
141
|
-
state: getIEditor(activeEditorPane.getControl())?.saveViewState() ?? undefined,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
async restoreEditorViewState() {
|
|
146
|
-
if (this.editorViewState) {
|
|
147
|
-
const options = {
|
|
148
|
-
viewState: this.editorViewState.state,
|
|
149
|
-
preserveFocus: true
|
|
150
|
-
};
|
|
151
|
-
await this.editorViewState.group.openEditor(this.editorViewState.editor, options);
|
|
152
|
-
}
|
|
129
|
+
this.editorViewState.reset();
|
|
153
130
|
}
|
|
154
131
|
})(this, this.editorService);
|
|
155
132
|
this.labelOnlyEditorHistoryPickAccessor = ( new QuickPickItemScorerAccessor({ skipDescription: true }));
|
|
@@ -169,7 +146,6 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
169
146
|
includeSymbols: searchConfig?.quickOpen.includeSymbols,
|
|
170
147
|
includeHistory: searchConfig?.quickOpen.includeHistory,
|
|
171
148
|
historyFilterSortOrder: searchConfig?.quickOpen.history.filterSortOrder,
|
|
172
|
-
shortAutoSaveDelay: this.filesConfigurationService.getAutoSaveMode() === 1 ,
|
|
173
149
|
preserveInput: quickAccessConfig.preserveInput
|
|
174
150
|
};
|
|
175
151
|
}
|
|
@@ -186,7 +162,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
186
162
|
}));
|
|
187
163
|
disposables.add(Event.once(picker.onDidHide)(({ reason }) => {
|
|
188
164
|
if (reason === QuickInputHideReason.Gesture) {
|
|
189
|
-
this.pickState.
|
|
165
|
+
this.pickState.editorViewState.restore();
|
|
190
166
|
}
|
|
191
167
|
}));
|
|
192
168
|
disposables.add(super.provide(picker, token, runOptions));
|
|
@@ -201,7 +177,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
201
177
|
if (!activeEditorControl) {
|
|
202
178
|
return Disposable.None;
|
|
203
179
|
}
|
|
204
|
-
this.pickState.
|
|
180
|
+
this.pickState.editorViewState.set();
|
|
205
181
|
activeEditorControl.revealRangeInCenter(pick.range.selection, 0 );
|
|
206
182
|
this.addDecorations(activeEditorControl, pick.range.decoration);
|
|
207
183
|
return toDisposable(() => this.clearDecorations(activeEditorControl));
|
|
@@ -605,7 +581,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
605
581
|
}
|
|
606
582
|
async doGetEditorSymbolPicks(activeGlobalPick, activeGlobalResource, filter, disposables, token) {
|
|
607
583
|
try {
|
|
608
|
-
this.pickState.
|
|
584
|
+
this.pickState.editorViewState.set();
|
|
609
585
|
await this.editorService.openEditor({
|
|
610
586
|
resource: activeGlobalResource,
|
|
611
587
|
options: { preserveFocus: true, revealIfOpened: true, ignoreError: true }
|
|
@@ -663,23 +639,25 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
663
639
|
let description = undefined;
|
|
664
640
|
let isDirty = undefined;
|
|
665
641
|
let extraClasses;
|
|
642
|
+
let icon = undefined;
|
|
666
643
|
if (isEditorInput(resourceOrEditor)) {
|
|
667
644
|
resource = EditorResourceAccessor.getOriginalUri(resourceOrEditor);
|
|
668
645
|
label = resourceOrEditor.getName();
|
|
669
646
|
description = resourceOrEditor.getDescription();
|
|
670
647
|
isDirty = resourceOrEditor.isDirty() && !resourceOrEditor.isSaving();
|
|
671
648
|
extraClasses = resourceOrEditor.getLabelExtraClasses();
|
|
649
|
+
icon = resourceOrEditor.getIcon();
|
|
672
650
|
}
|
|
673
651
|
else {
|
|
674
652
|
resource = URI.isUri(resourceOrEditor) ? resourceOrEditor : resourceOrEditor.resource;
|
|
675
653
|
label = basenameOrAuthority(resource);
|
|
676
654
|
description = this.labelService.getUriLabel(dirname(resource), { relative: true });
|
|
677
|
-
isDirty = this.workingCopyService.isDirty(resource) && !
|
|
655
|
+
isDirty = this.workingCopyService.isDirty(resource) && !this.filesConfigurationService.hasShortAutoSaveDelay(resource);
|
|
678
656
|
extraClasses = [];
|
|
679
657
|
}
|
|
680
658
|
const labelAndDescription = description ? `${label} ${description}` : label;
|
|
681
659
|
const iconClassesValue = ( new Lazy(
|
|
682
|
-
() => getIconClasses(this.modelService, this.languageService, resource).concat(extraClasses)
|
|
660
|
+
() => getIconClasses(this.modelService, this.languageService, resource, undefined, icon).concat(extraClasses)
|
|
683
661
|
));
|
|
684
662
|
const buttonsValue = ( new Lazy(() => {
|
|
685
663
|
const openSideBySideDirection = configuration.openSideBySideDirection;
|
|
@@ -747,7 +725,7 @@ let AnythingQuickAccessProvider = class AnythingQuickAccessProvider extends Pick
|
|
|
747
725
|
};
|
|
748
726
|
const targetGroup = options.keyMods?.alt || (this.configuration.openEditorPinned && options.keyMods?.ctrlCmd) || options.forceOpenSideBySide ? SIDE_GROUP : ACTIVE_GROUP;
|
|
749
727
|
if (targetGroup === SIDE_GROUP) {
|
|
750
|
-
await this.pickState.
|
|
728
|
+
await this.pickState.editorViewState.restore();
|
|
751
729
|
}
|
|
752
730
|
if (isEditorInput(resourceOrEditor)) {
|
|
753
731
|
await this.editorService.openEditor(resourceOrEditor, editorOptions, targetGroup);
|
package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
2
3
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
4
|
import { ResourceSet } from 'vscode/vscode/vs/base/common/map';
|
|
4
5
|
import { basenameOrAuthority, dirname } from 'vscode/vscode/vs/base/common/resources';
|
|
@@ -8,17 +9,20 @@ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/c
|
|
|
8
9
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
10
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
10
11
|
import { getSelectionKeyboardEvent } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
11
|
-
import { PickerQuickAccessProvider } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
|
|
12
|
+
import { PickerQuickAccessProvider, TriggerAction } from 'vscode/vscode/vs/platform/quickinput/browser/pickerQuickAccess';
|
|
12
13
|
import { DefaultQuickAccessFilterValue } from 'vscode/vscode/vs/platform/quickinput/common/quickAccess';
|
|
14
|
+
import { QuickInputHideReason } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
13
15
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { SearchModel, searchComparer } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
16
|
+
import { searchDetailsIcon, searchOpenInFileIcon, searchActivityBarIcon } from '../searchIcons.js';
|
|
17
|
+
import { SearchModel, SearchModelLocation, searchComparer } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
17
18
|
import { getEditorSelectionFromMatch } from '../searchView.js';
|
|
18
19
|
import { getOutOfWorkspaceEditorResources } from 'vscode/vscode/vs/workbench/contrib/search/common/search';
|
|
19
20
|
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
20
21
|
import { QueryBuilder } from 'vscode/vscode/vs/workbench/services/search/common/queryBuilder';
|
|
21
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';
|
|
22
26
|
|
|
23
27
|
const TEXT_SEARCH_QUICK_ACCESS_PREFIX = '%';
|
|
24
28
|
const DEFAULT_TEXT_QUERY_BUILDER_OPTIONS = {
|
|
@@ -46,15 +50,21 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
46
50
|
};
|
|
47
51
|
}
|
|
48
52
|
constructor(_instantiationService, _contextService, _editorService, _labelService, _viewsService, _configurationService) {
|
|
49
|
-
super(TEXT_SEARCH_QUICK_ACCESS_PREFIX, { canAcceptInBackground: true });
|
|
53
|
+
super(TEXT_SEARCH_QUICK_ACCESS_PREFIX, { canAcceptInBackground: true, shouldSkipTrimPickFilter: true });
|
|
50
54
|
this._instantiationService = _instantiationService;
|
|
51
55
|
this._contextService = _contextService;
|
|
52
56
|
this._editorService = _editorService;
|
|
53
57
|
this._labelService = _labelService;
|
|
54
58
|
this._viewsService = _viewsService;
|
|
55
59
|
this._configurationService = _configurationService;
|
|
60
|
+
this.currentAsyncSearch = Promise.resolve({
|
|
61
|
+
results: [],
|
|
62
|
+
messages: []
|
|
63
|
+
});
|
|
64
|
+
this.editorViewState = ( new EditorViewState(this._editorService));
|
|
56
65
|
this.queryBuilder = this._instantiationService.createInstance(QueryBuilder);
|
|
57
66
|
this.searchModel = this._instantiationService.createInstance(SearchModel);
|
|
67
|
+
this.searchModel.location = SearchModelLocation.QUICK_ACCESS;
|
|
58
68
|
}
|
|
59
69
|
dispose() {
|
|
60
70
|
this.searchModel.dispose();
|
|
@@ -65,8 +75,35 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
65
75
|
if (TEXT_SEARCH_QUICK_ACCESS_PREFIX.length < picker.value.length) {
|
|
66
76
|
picker.valueSelection = [TEXT_SEARCH_QUICK_ACCESS_PREFIX.length, picker.value.length];
|
|
67
77
|
}
|
|
78
|
+
picker.customButton = true;
|
|
79
|
+
picker.customLabel = '$(link-external)';
|
|
80
|
+
this.editorViewState.reset();
|
|
81
|
+
disposables.add(picker.onDidCustom(() => {
|
|
82
|
+
if (this.searchModel.searchResult.count() > 0) {
|
|
83
|
+
this.moveToSearchViewlet(undefined);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this._viewsService.openView(VIEW_ID, true);
|
|
87
|
+
}
|
|
88
|
+
picker.hide();
|
|
89
|
+
}));
|
|
90
|
+
disposables.add(picker.onDidChangeActive(() => {
|
|
91
|
+
const [item] = picker.activeItems;
|
|
92
|
+
if (item?.match) {
|
|
93
|
+
this.editorViewState.set();
|
|
94
|
+
this._editorService.openEditor({
|
|
95
|
+
resource: item.match.parent().resource,
|
|
96
|
+
options: { preserveFocus: true, revealIfOpened: true, ignoreError: true, selection: item.match.range() }
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
disposables.add(Event.once(picker.onDidHide)(({ reason }) => {
|
|
101
|
+
if (reason === QuickInputHideReason.Gesture) {
|
|
102
|
+
this.editorViewState.restore();
|
|
103
|
+
}
|
|
104
|
+
this.searchModel.searchResult.toggleHighlights(false);
|
|
105
|
+
}));
|
|
68
106
|
disposables.add(super.provide(picker, token, runOptions));
|
|
69
|
-
disposables.add(picker.onDidHide(() => this.searchModel.searchResult.toggleHighlights(false)));
|
|
70
107
|
disposables.add(picker.onDidAccept(() => this.searchModel.searchResult.toggleHighlights(false)));
|
|
71
108
|
return disposables;
|
|
72
109
|
}
|
|
@@ -94,10 +131,12 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
94
131
|
const content = {
|
|
95
132
|
pattern: contentPattern,
|
|
96
133
|
};
|
|
134
|
+
this.searchModel.searchResult.toggleHighlights(false);
|
|
97
135
|
const charsPerLine = content.isRegExp ? 10000 : 1000;
|
|
98
136
|
const query = this.queryBuilder.text(content, ( folderResources.map(folder => folder.uri)), this._getTextQueryBuilderOptions(charsPerLine));
|
|
99
137
|
const result = this.searchModel.search(query, undefined, token);
|
|
100
138
|
const getAsyncResults = async () => {
|
|
139
|
+
this.currentAsyncSearch = result.asyncResults;
|
|
101
140
|
await result.asyncResults;
|
|
102
141
|
const syncResultURIs = ( new ResourceSet(( result.syncResults.map(e => e.resource))));
|
|
103
142
|
return this.searchModel.searchResult.matches().filter(e => !( syncResultURIs.has(e.resource)));
|
|
@@ -107,14 +146,21 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
107
146
|
asyncResults: getAsyncResults()
|
|
108
147
|
};
|
|
109
148
|
}
|
|
110
|
-
moveToSearchViewlet(
|
|
149
|
+
moveToSearchViewlet(currentElem) {
|
|
111
150
|
this._viewsService.openView(VIEW_ID, false);
|
|
112
151
|
const viewlet = this._viewsService.getActiveViewWithId(VIEW_ID);
|
|
113
|
-
viewlet.
|
|
152
|
+
viewlet.replaceSearchModel(this.searchModel, this.currentAsyncSearch);
|
|
153
|
+
this.searchModel = this._instantiationService.createInstance(SearchModel);
|
|
154
|
+
this.searchModel.location = SearchModelLocation.QUICK_ACCESS;
|
|
114
155
|
const viewer = viewlet?.getControl();
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
156
|
+
if (currentElem) {
|
|
157
|
+
viewer.setFocus([currentElem], getSelectionKeyboardEvent());
|
|
158
|
+
viewer.setSelection([currentElem], getSelectionKeyboardEvent());
|
|
159
|
+
viewer.reveal(currentElem);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
viewlet.searchAndReplaceWidget.focus();
|
|
163
|
+
}
|
|
118
164
|
}
|
|
119
165
|
_getPicksFromMatches(matches, limit) {
|
|
120
166
|
matches = matches.sort(searchComparer);
|
|
@@ -133,7 +179,7 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
133
179
|
)),
|
|
134
180
|
iconClass: ThemeIcon.asClassName(searchDetailsIcon),
|
|
135
181
|
accept: async () => {
|
|
136
|
-
this.moveToSearchViewlet(
|
|
182
|
+
this.moveToSearchViewlet(matches[limit]);
|
|
137
183
|
}
|
|
138
184
|
});
|
|
139
185
|
break;
|
|
@@ -166,7 +212,7 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
166
212
|
)),
|
|
167
213
|
iconClass: ThemeIcon.asClassName(searchDetailsIcon),
|
|
168
214
|
accept: async () => {
|
|
169
|
-
this.moveToSearchViewlet(
|
|
215
|
+
this.moveToSearchViewlet(element);
|
|
170
216
|
}
|
|
171
217
|
});
|
|
172
218
|
break;
|
|
@@ -182,6 +228,14 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
182
228
|
highlights: {
|
|
183
229
|
label: match
|
|
184
230
|
},
|
|
231
|
+
buttons: [{
|
|
232
|
+
iconClass: ThemeIcon.asClassName(searchActivityBarIcon),
|
|
233
|
+
tooltip: ( localizeWithPath(
|
|
234
|
+
'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
|
|
235
|
+
'showMore',
|
|
236
|
+
"See in Search Panel"
|
|
237
|
+
)),
|
|
238
|
+
}],
|
|
185
239
|
ariaLabel: `Match at location ${element.range().startLineNumber}:${element.range().startColumn} - ${previewText}`,
|
|
186
240
|
accept: async (keyMods, event) => {
|
|
187
241
|
await this.handleAccept(fileMatch, {
|
|
@@ -190,7 +244,12 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
190
244
|
preserveFocus: event.inBackground,
|
|
191
245
|
forcePinned: event.inBackground
|
|
192
246
|
});
|
|
193
|
-
}
|
|
247
|
+
},
|
|
248
|
+
trigger: () => {
|
|
249
|
+
this.moveToSearchViewlet(element);
|
|
250
|
+
return TriggerAction.CLOSE_PICKER;
|
|
251
|
+
},
|
|
252
|
+
match: element
|
|
194
253
|
});
|
|
195
254
|
}
|
|
196
255
|
}
|
|
@@ -209,11 +268,24 @@ let TextSearchQuickAccess = class TextSearchQuickAccess extends PickerQuickAcces
|
|
|
209
268
|
}, targetGroup);
|
|
210
269
|
}
|
|
211
270
|
_getPicks(contentPattern, disposables, token) {
|
|
271
|
+
const searchModelAtTimeOfSearch = this.searchModel;
|
|
212
272
|
if (contentPattern === '') {
|
|
213
273
|
this.searchModel.searchResult.clear();
|
|
214
|
-
return [
|
|
274
|
+
return [{
|
|
275
|
+
label: ( localizeWithPath(
|
|
276
|
+
'vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess',
|
|
277
|
+
'enterSearchTerm',
|
|
278
|
+
"Enter a term to search for across your files."
|
|
279
|
+
))
|
|
280
|
+
}];
|
|
215
281
|
}
|
|
216
|
-
const
|
|
282
|
+
const conditionalTokenCts = disposables.add(( new CancellationTokenSource()));
|
|
283
|
+
disposables.add(token.onCancellationRequested(() => {
|
|
284
|
+
if (searchModelAtTimeOfSearch.location === SearchModelLocation.QUICK_ACCESS) {
|
|
285
|
+
conditionalTokenCts.cancel();
|
|
286
|
+
}
|
|
287
|
+
}));
|
|
288
|
+
const allMatches = this.doSearch(contentPattern, conditionalTokenCts.token);
|
|
217
289
|
if (!allMatches) {
|
|
218
290
|
return null;
|
|
219
291
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
3
3
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
4
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
4
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
5
5
|
import { CopyMatchCommandId, FileMatchOrMatchFocusKey, CopyPathCommandId, FileMatchOrFolderMatchWithResourceFocusKey, CopyAllCommandId, HasSearchResults } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
6
6
|
import { FileMatch, FolderMatchWithResource, Match, FolderMatch, searchMatchComparer } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
7
7
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
4
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
4
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
5
5
|
import { ToggleQueryDetailsActionId, SearchViewFocusedKey, CloseReplaceWidgetActionId, SearchViewVisibleKey, ReplaceInputBoxFocusedKey, ToggleCaseSensitiveCommandId, FileMatchOrFolderMatchFocusKey, ToggleWholeWordCommandId, ToggleRegexCommandId, TogglePreserveCaseId, OpenMatch, FileMatchOrMatchFocusKey, OpenMatchToSide, AddCursorsAtSearchResults, FocusNextInputActionId, InputBoxFocusedKey, FocusPreviousInputActionId, SearchInputBoxFocusedKey, FocusSearchFromResults, FirstMatchFocusKey, ToggleSearchOnTypeActionId, FocusSearchListCommandID, FocusNextSearchResultActionId, HasSearchResults, FocusPreviousSearchResultActionId, ReplaceInFilesActionId } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
6
6
|
import { InSearchEditor } from 'vscode/vscode/vs/workbench/contrib/searchEditor/browser/constants';
|
|
7
7
|
import { FolderMatch } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
3
3
|
import { getSelectionKeyboardEvent } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
4
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
4
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
5
5
|
import { searchRemoveIcon, searchReplaceIcon } from './searchIcons.js';
|
|
6
6
|
import { RemoveActionId, SearchViewVisibleKey, FileMatchOrMatchFocusKey, ReplaceActionId, ReplaceActiveKey, MatchFocusKey, IsEditableItemKey, ReplaceAllInFileActionId, FileFocusKey, ReplaceAllInFolderActionId, FolderFocusKey } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
7
7
|
import { IReplaceService } from 'vscode/vscode/vs/workbench/contrib/search/browser/replace';
|
|
@@ -16,9 +16,9 @@ registerAction2(class TextSearchQuickAccessAction extends Action2 {
|
|
|
16
16
|
value: ( localizeWithPath(
|
|
17
17
|
'vs/workbench/contrib/search/browser/searchActionsTextQuickAccess',
|
|
18
18
|
'quickTextSearch',
|
|
19
|
-
"Quick
|
|
19
|
+
"Quick Search (Experimental)"
|
|
20
20
|
)),
|
|
21
|
-
original: 'Quick
|
|
21
|
+
original: 'Quick Search (Experimental)'
|
|
22
22
|
},
|
|
23
23
|
category,
|
|
24
24
|
f1: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { WorkbenchListFocusContextKey } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
3
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
3
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
4
4
|
import { searchStopIcon, searchRefreshIcon, searchCollapseAllIcon, searchExpandAllIcon, searchClearIcon, searchShowAsList, searchShowAsTree } from './searchIcons.js';
|
|
5
5
|
import { ClearSearchHistoryCommandId, CancelSearchActionId, SearchViewVisibleKey, RefreshSearchResultsActionId, ViewHasSearchPatternKey, CollapseSearchResultsActionId, HasSearchResults, ViewHasSomeCollapsibleKey, ExpandSearchResultsActionId, ClearSearchResultsActionId, ViewHasReplacePatternKey, ViewHasFilePatternKey, ViewAsTreeActionId, InTreeViewKey, ViewAsListActionId } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
6
6
|
import { ISearchHistoryService } from 'vscode/vscode/vs/workbench/contrib/search/common/searchHistoryService';
|
|
@@ -7,6 +7,11 @@ const searchDetailsIcon = registerIcon('search-details', Codicon.ellipsis, ( loc
|
|
|
7
7
|
'searchDetailsIcon',
|
|
8
8
|
'Icon to make search details visible.'
|
|
9
9
|
)));
|
|
10
|
+
const searchActivityBarIcon = registerIcon('search-see-more', Codicon.linkExternal, ( localizeWithPath(
|
|
11
|
+
'vs/workbench/contrib/search/browser/searchIcons',
|
|
12
|
+
'searchSeeMoreIcon',
|
|
13
|
+
'Icon to view more context in the search view.'
|
|
14
|
+
)));
|
|
10
15
|
const searchShowContextIcon = registerIcon('search-show-context', Codicon.listSelection, ( localizeWithPath(
|
|
11
16
|
'vs/workbench/contrib/search/browser/searchIcons',
|
|
12
17
|
'searchShowContextIcon',
|
|
@@ -88,4 +93,4 @@ const searchOpenInFileIcon = registerIcon('search-open-in-file', Codicon.goToFil
|
|
|
88
93
|
'Icon for the action to go to the file of the current search result.'
|
|
89
94
|
)));
|
|
90
95
|
|
|
91
|
-
export { searchClearIcon, searchCollapseAllIcon, searchDetailsIcon, searchExpandAllIcon, searchHideReplaceIcon, searchNewEditorIcon, searchOpenInFileIcon, searchRefreshIcon, searchRemoveIcon, searchReplaceAllIcon, searchReplaceIcon, searchShowAsList, searchShowAsTree, searchShowContextIcon, searchShowReplaceIcon, searchStopIcon, searchViewIcon };
|
|
96
|
+
export { searchActivityBarIcon, searchClearIcon, searchCollapseAllIcon, searchDetailsIcon, searchExpandAllIcon, searchHideReplaceIcon, searchNewEditorIcon, searchOpenInFileIcon, searchRefreshIcon, searchRemoveIcon, searchReplaceAllIcon, searchReplaceIcon, searchShowAsList, searchShowAsTree, searchShowContextIcon, searchShowReplaceIcon, searchStopIcon, searchViewIcon };
|
|
@@ -254,9 +254,8 @@ FileMatchRenderer = FileMatchRenderer_1 = ( __decorate([
|
|
|
254
254
|
let MatchRenderer = class MatchRenderer extends Disposable {
|
|
255
255
|
static { MatchRenderer_1 = this; }
|
|
256
256
|
static { this.TEMPLATE_ID = 'match'; }
|
|
257
|
-
constructor(
|
|
257
|
+
constructor(searchView, contextService, configurationService, instantiationService, contextKeyService) {
|
|
258
258
|
super();
|
|
259
|
-
this.searchModel = searchModel;
|
|
260
259
|
this.searchView = searchView;
|
|
261
260
|
this.contextService = contextService;
|
|
262
261
|
this.configurationService = configurationService;
|
|
@@ -306,15 +305,15 @@ let MatchRenderer = class MatchRenderer extends Disposable {
|
|
|
306
305
|
renderElement(node, index, templateData) {
|
|
307
306
|
const match = node.element;
|
|
308
307
|
const preview = match.preview();
|
|
309
|
-
const replace = this.
|
|
310
|
-
!!this.
|
|
308
|
+
const replace = this.searchView.model.isReplaceActive() &&
|
|
309
|
+
!!this.searchView.model.replaceString &&
|
|
311
310
|
!(match instanceof MatchInNotebook && match.isReadonly());
|
|
312
311
|
templateData.before.textContent = preview.before;
|
|
313
312
|
templateData.match.textContent = preview.inside;
|
|
314
313
|
templateData.match.classList.toggle('replace', replace);
|
|
315
314
|
templateData.replace.textContent = replace ? match.replaceString : '';
|
|
316
315
|
templateData.after.textContent = preview.after;
|
|
317
|
-
templateData.parent.title = (preview.
|
|
316
|
+
templateData.parent.title = (preview.fullBefore + (replace ? match.replaceString : preview.inside) + preview.after).trim().substr(0, 999);
|
|
318
317
|
IsEditableItemKey.bindTo(templateData.contextKeyService).set(!(match instanceof MatchInNotebook && match.isReadonly()));
|
|
319
318
|
const numLines = match.range().endLineNumber - match.range().startLineNumber;
|
|
320
319
|
const extraLinesStr = numLines > 0 ? `+${numLines}` : '';
|
|
@@ -352,14 +351,14 @@ let MatchRenderer = class MatchRenderer extends Disposable {
|
|
|
352
351
|
}
|
|
353
352
|
};
|
|
354
353
|
MatchRenderer = MatchRenderer_1 = ( __decorate([
|
|
355
|
-
( __param(
|
|
356
|
-
( __param(
|
|
357
|
-
( __param(
|
|
358
|
-
( __param(
|
|
354
|
+
( __param(1, IWorkspaceContextService)),
|
|
355
|
+
( __param(2, IConfigurationService)),
|
|
356
|
+
( __param(3, IInstantiationService)),
|
|
357
|
+
( __param(4, IContextKeyService))
|
|
359
358
|
], MatchRenderer));
|
|
360
359
|
let SearchAccessibilityProvider = class SearchAccessibilityProvider {
|
|
361
|
-
constructor(
|
|
362
|
-
this.
|
|
360
|
+
constructor(searchView, labelService) {
|
|
361
|
+
this.searchView = searchView;
|
|
363
362
|
this.labelService = labelService;
|
|
364
363
|
}
|
|
365
364
|
getWidgetAriaLabel() {
|
|
@@ -400,7 +399,7 @@ let SearchAccessibilityProvider = class SearchAccessibilityProvider {
|
|
|
400
399
|
}
|
|
401
400
|
if (element instanceof Match) {
|
|
402
401
|
const match = element;
|
|
403
|
-
const searchModel = this.
|
|
402
|
+
const searchModel = this.searchView.model;
|
|
404
403
|
const replace = searchModel.isReplaceActive() && !!searchModel.replaceString;
|
|
405
404
|
const matchString = match.getMatchString();
|
|
406
405
|
const range = match.range();
|
|
@@ -4,7 +4,7 @@ import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEve
|
|
|
4
4
|
import { status } from 'vscode/vscode/vs/base/browser/ui/aria/aria';
|
|
5
5
|
import { ObjectTreeElementCollapseState } from 'vscode/vscode/vs/base/browser/ui/tree/tree';
|
|
6
6
|
import { Delayer, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
7
|
-
import {
|
|
7
|
+
import { isCancellationError, onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
|
|
8
8
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
9
9
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
10
10
|
import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
@@ -20,7 +20,7 @@ import { Selection } from 'vscode/vscode/vs/editor/common/core/selection';
|
|
|
20
20
|
import { CommonFindController } from 'vscode/vscode/vs/editor/contrib/find/browser/findController';
|
|
21
21
|
import { MultiCursorSelectionController } from 'vscode/vscode/vs/editor/contrib/multicursor/browser/multicursor';
|
|
22
22
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
23
|
-
import { IAccessibilityService
|
|
23
|
+
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
24
24
|
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
25
25
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
26
26
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
@@ -58,7 +58,7 @@ import { SearchViewVisibleKey, FirstMatchFocusKey, FileMatchOrMatchFocusKey, Fil
|
|
|
58
58
|
import { IReplaceService } from 'vscode/vscode/vs/workbench/contrib/search/browser/replace';
|
|
59
59
|
import { SearchStateKey, SearchUIState, getOutOfWorkspaceEditorResources } from 'vscode/vscode/vs/workbench/contrib/search/common/search';
|
|
60
60
|
import { SearchHistoryService, ISearchHistoryService } from 'vscode/vscode/vs/workbench/contrib/search/common/searchHistoryService';
|
|
61
|
-
import { searchMatchComparer, FileMatch, SearchResult, FolderMatch, Match, FolderMatchWithResource, MatchInNotebook, ISearchViewModelWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
61
|
+
import { SearchModelLocation, searchMatchComparer, FileMatch, SearchResult, FolderMatch, Match, FolderMatchWithResource, MatchInNotebook, ISearchViewModelWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
62
62
|
import { createEditorFromSearchResult } from '../../searchEditor/browser/searchEditorActions.js';
|
|
63
63
|
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
64
64
|
import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
|
|
@@ -67,6 +67,7 @@ import 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
|
67
67
|
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
68
68
|
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
69
69
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
70
|
+
import { AudioCue, IAudioCueService } from 'vscode/vscode/vs/platform/audioCues/browser/audioCueService';
|
|
70
71
|
import { TextSearchCompleteMessageType } from 'vscode/vscode/vs/workbench/services/search/common/searchExtTypes';
|
|
71
72
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
72
73
|
|
|
@@ -81,7 +82,7 @@ const DEBOUNCE_DELAY = 75;
|
|
|
81
82
|
let SearchView = class SearchView extends ViewPane {
|
|
82
83
|
static { SearchView_1 = this; }
|
|
83
84
|
static { this.ACTIONS_RIGHT_CLASS_NAME = 'actions-right'; }
|
|
84
|
-
constructor(options, fileService, editorService, codeEditorService, progressService, notificationService, dialogService, commandService, contextViewService, instantiationService, viewDescriptorService, configurationService, contextService, searchViewModelWorkbenchService, contextKeyService, replaceService, textFileService, preferencesService, themeService, searchHistoryService, contextMenuService, accessibilityService, keybindingService, storageService, openerService, telemetryService, notebookService, logService,
|
|
85
|
+
constructor(options, fileService, editorService, codeEditorService, progressService, notificationService, dialogService, commandService, contextViewService, instantiationService, viewDescriptorService, configurationService, contextService, searchViewModelWorkbenchService, contextKeyService, replaceService, textFileService, preferencesService, themeService, searchHistoryService, contextMenuService, accessibilityService, keybindingService, storageService, openerService, telemetryService, notebookService, logService, audioCueService) {
|
|
85
86
|
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
86
87
|
this.fileService = fileService;
|
|
87
88
|
this.editorService = editorService;
|
|
@@ -101,7 +102,7 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
101
102
|
this.storageService = storageService;
|
|
102
103
|
this.notebookService = notebookService;
|
|
103
104
|
this.logService = logService;
|
|
104
|
-
this.
|
|
105
|
+
this.audioCueService = audioCueService;
|
|
105
106
|
this.isDisposed = false;
|
|
106
107
|
this.lastFocusState = 'input';
|
|
107
108
|
this.messageDisposables = ( new DisposableStore());
|
|
@@ -154,7 +155,7 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
154
155
|
this.addToSearchHistoryDelayer = this._register(( new Delayer(2000)));
|
|
155
156
|
this.toggleCollapseStateDelayer = this._register(( new Delayer(100)));
|
|
156
157
|
this.triggerQueryDelayer = this._register(( new Delayer(0)));
|
|
157
|
-
this.treeAccessibilityProvider = this.instantiationService.createInstance(SearchAccessibilityProvider, this
|
|
158
|
+
this.treeAccessibilityProvider = this.instantiationService.createInstance(SearchAccessibilityProvider, this);
|
|
158
159
|
this.isTreeLayoutViewVisible = this.viewletState['view.treeLayout'] ?? ((this.searchConfig.defaultViewMode === "tree") );
|
|
159
160
|
this._refreshResultsScheduler = this._register(( new RunOnceScheduler(this._updateResults.bind(this), 80)));
|
|
160
161
|
this._register(this.storageService.onWillSaveState(() => {
|
|
@@ -202,6 +203,9 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
202
203
|
get searchResult() {
|
|
203
204
|
return this.viewModel && this.viewModel.searchResult;
|
|
204
205
|
}
|
|
206
|
+
get model() {
|
|
207
|
+
return this.viewModel;
|
|
208
|
+
}
|
|
205
209
|
onDidChangeWorkbenchState() {
|
|
206
210
|
if (this.contextService.getWorkbenchState() !== 1 && this.searchWithoutFolderMessageElement) {
|
|
207
211
|
hide(this.searchWithoutFolderMessageElement);
|
|
@@ -218,10 +222,31 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
218
222
|
this.searchExcludePattern.setValue('');
|
|
219
223
|
this.pauseSearching = false;
|
|
220
224
|
}
|
|
221
|
-
async
|
|
222
|
-
|
|
225
|
+
async replaceSearchModel(searchModel, asyncResults) {
|
|
226
|
+
let progressComplete;
|
|
227
|
+
this.progressService.withProgress({ location: this.getProgressLocation(), delay: 0 }, _progress => {
|
|
228
|
+
return ( new Promise(resolve => progressComplete = resolve));
|
|
229
|
+
});
|
|
230
|
+
const slowTimer = setTimeout(() => {
|
|
231
|
+
this.state = SearchUIState.SlowSearch;
|
|
232
|
+
}, 2000);
|
|
233
|
+
this._refreshResultsScheduler.schedule();
|
|
234
|
+
searchModel.location = SearchModelLocation.PANEL;
|
|
235
|
+
searchModel.replaceActive = this.viewModel.isReplaceActive();
|
|
236
|
+
searchModel.replaceString = this.searchWidget.getReplaceValue();
|
|
237
|
+
this._onSearchResultChangedDisposable?.dispose();
|
|
238
|
+
this._onSearchResultChangedDisposable = this._register(searchModel.onSearchResultChanged((event) => this.onSearchResultsChanged(event)));
|
|
239
|
+
this.searchViewModelWorkbenchService.searchModel = searchModel;
|
|
240
|
+
this.viewModel = searchModel;
|
|
223
241
|
this.onSearchResultsChanged();
|
|
224
242
|
this.refreshInputs();
|
|
243
|
+
asyncResults.then((complete) => {
|
|
244
|
+
clearTimeout(slowTimer);
|
|
245
|
+
this.onSearchComplete(progressComplete, undefined, undefined, complete);
|
|
246
|
+
}, (e) => {
|
|
247
|
+
clearTimeout(slowTimer);
|
|
248
|
+
this.onSearchError(e, progressComplete, undefined, undefined);
|
|
249
|
+
});
|
|
225
250
|
const collapseResults = this.searchConfig.collapseResults;
|
|
226
251
|
if (collapseResults !== 'alwaysCollapse' && this.viewModel.searchResult.matches().length === 1) {
|
|
227
252
|
const onlyMatch = this.viewModel.searchResult.matches()[0];
|
|
@@ -338,7 +363,7 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
338
363
|
if (filePatterns !== '' || patternExclusions !== '' || patternIncludes !== '' || queryDetailsExpanded !== '' || !useExcludesAndIgnoreFiles) {
|
|
339
364
|
this.toggleQueryDetails(true, true, true);
|
|
340
365
|
}
|
|
341
|
-
this._register(this.viewModel.onSearchResultChanged((event) => this.onSearchResultsChanged(event)));
|
|
366
|
+
this._onSearchResultChangedDisposable = this._register(this.viewModel.onSearchResultChanged((event) => this.onSearchResultsChanged(event)));
|
|
342
367
|
this._register(this.onDidChangeBodyVisibility(visible => this.onVisibilityChanged(visible)));
|
|
343
368
|
this.updateIndentStyles(this.themeService.getFileIconTheme());
|
|
344
369
|
this._register(this.themeService.onDidFileIconThemeChange(this.updateIndentStyles, this));
|
|
@@ -756,7 +781,7 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
756
781
|
this.tree = this._register(this.instantiationService.createInstance(WorkbenchCompressibleObjectTree, 'SearchView', this.resultsElement, delegate, [
|
|
757
782
|
this._register(this.instantiationService.createInstance(FolderMatchRenderer, this, this.treeLabels)),
|
|
758
783
|
this._register(this.instantiationService.createInstance(FileMatchRenderer, this, this.treeLabels)),
|
|
759
|
-
this._register(this.instantiationService.createInstance(MatchRenderer, this
|
|
784
|
+
this._register(this.instantiationService.createInstance(MatchRenderer, this)),
|
|
760
785
|
], {
|
|
761
786
|
identityProvider,
|
|
762
787
|
accessibilityProvider: this.treeAccessibilityProvider,
|
|
@@ -779,7 +804,6 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
779
804
|
this._register(this.tree.onContextMenu(e => this.onContextMenu(e)));
|
|
780
805
|
const updateHasSomeCollapsible = () => this.toggleCollapseStateDelayer.trigger(() => this.hasSomeCollapsibleResultKey.set(this.hasSomeCollapsible()));
|
|
781
806
|
updateHasSomeCollapsible();
|
|
782
|
-
this._register(this.viewModel.onSearchResultChanged(() => updateHasSomeCollapsible()));
|
|
783
807
|
this._register(this.tree.onDidChangeCollapseState(() => updateHasSomeCollapsible()));
|
|
784
808
|
this._register(Event.debounce(this.tree.onDidOpen, (last, event) => event, DEBOUNCE_DELAY, true)(options => {
|
|
785
809
|
if (options.element instanceof Match) {
|
|
@@ -1102,7 +1126,7 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
1102
1126
|
'emptySearch',
|
|
1103
1127
|
"Empty Search"
|
|
1104
1128
|
));
|
|
1105
|
-
this.
|
|
1129
|
+
this.audioCueService.playAudioCue(AudioCue.clear);
|
|
1106
1130
|
this.reLayout();
|
|
1107
1131
|
}
|
|
1108
1132
|
clearFilePatternFields() {
|
|
@@ -1379,194 +1403,198 @@ let SearchView = class SearchView extends ViewPane {
|
|
|
1379
1403
|
this._refreshResultsScheduler.schedule();
|
|
1380
1404
|
}
|
|
1381
1405
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
this.
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
this.state = SearchUIState.SlowSearch;
|
|
1392
|
-
}, 2000);
|
|
1393
|
-
const onComplete = (completed) => {
|
|
1394
|
-
clearTimeout(slowTimer);
|
|
1395
|
-
this.state = SearchUIState.Idle;
|
|
1396
|
-
progressComplete();
|
|
1397
|
-
this.onSearchResultsChanged();
|
|
1398
|
-
const collapseResults = this.searchConfig.collapseResults;
|
|
1399
|
-
if (collapseResults !== 'alwaysCollapse' && this.viewModel.searchResult.matches().length === 1) {
|
|
1400
|
-
const onlyMatch = this.viewModel.searchResult.matches()[0];
|
|
1401
|
-
if (onlyMatch.count() < 50) {
|
|
1402
|
-
this.tree.expand(onlyMatch);
|
|
1403
|
-
}
|
|
1406
|
+
onSearchComplete(progressComplete, excludePatternText, includePatternText, completed) {
|
|
1407
|
+
this.state = SearchUIState.Idle;
|
|
1408
|
+
progressComplete();
|
|
1409
|
+
this.onSearchResultsChanged();
|
|
1410
|
+
const collapseResults = this.searchConfig.collapseResults;
|
|
1411
|
+
if (collapseResults !== 'alwaysCollapse' && this.viewModel.searchResult.matches().length === 1) {
|
|
1412
|
+
const onlyMatch = this.viewModel.searchResult.matches()[0];
|
|
1413
|
+
if (onlyMatch.count() < 50) {
|
|
1414
|
+
this.tree.expand(onlyMatch);
|
|
1404
1415
|
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1416
|
+
}
|
|
1417
|
+
const hasResults = !this.viewModel.searchResult.isEmpty();
|
|
1418
|
+
if (completed?.exit === 1 ) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
if (!hasResults) {
|
|
1422
|
+
const hasExcludes = !!excludePatternText;
|
|
1423
|
+
const hasIncludes = !!includePatternText;
|
|
1424
|
+
let message;
|
|
1425
|
+
if (!completed) {
|
|
1426
|
+
message = SEARCH_CANCELLED_MESSAGE;
|
|
1409
1427
|
}
|
|
1410
|
-
if (
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1428
|
+
else if (this.inputPatternIncludes.onlySearchInOpenEditors()) {
|
|
1429
|
+
if (hasIncludes && hasExcludes) {
|
|
1430
|
+
message = ( localizeWithPath(
|
|
1431
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1432
|
+
'noOpenEditorResultsIncludesExcludes',
|
|
1433
|
+
"No results found in open editors matching '{0}' excluding '{1}' - ",
|
|
1434
|
+
includePatternText,
|
|
1435
|
+
excludePatternText
|
|
1436
|
+
));
|
|
1416
1437
|
}
|
|
1417
|
-
else if (
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
excludePatternText
|
|
1425
|
-
));
|
|
1426
|
-
}
|
|
1427
|
-
else if (hasIncludes) {
|
|
1428
|
-
message = ( localizeWithPath(
|
|
1429
|
-
'vs/workbench/contrib/search/browser/searchView',
|
|
1430
|
-
'noOpenEditorResultsIncludes',
|
|
1431
|
-
"No results found in open editors matching '{0}' - ",
|
|
1432
|
-
includePatternText
|
|
1433
|
-
));
|
|
1434
|
-
}
|
|
1435
|
-
else if (hasExcludes) {
|
|
1436
|
-
message = ( localizeWithPath(
|
|
1437
|
-
'vs/workbench/contrib/search/browser/searchView',
|
|
1438
|
-
'noOpenEditorResultsExcludes',
|
|
1439
|
-
"No results found in open editors excluding '{0}' - ",
|
|
1440
|
-
excludePatternText
|
|
1441
|
-
));
|
|
1442
|
-
}
|
|
1443
|
-
else {
|
|
1444
|
-
message = ( localizeWithPath(
|
|
1445
|
-
'vs/workbench/contrib/search/browser/searchView',
|
|
1446
|
-
'noOpenEditorResultsFound',
|
|
1447
|
-
"No results found in open editors. Review your settings for configured exclusions and check your gitignore files - "
|
|
1448
|
-
));
|
|
1449
|
-
}
|
|
1438
|
+
else if (hasIncludes) {
|
|
1439
|
+
message = ( localizeWithPath(
|
|
1440
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1441
|
+
'noOpenEditorResultsIncludes',
|
|
1442
|
+
"No results found in open editors matching '{0}' - ",
|
|
1443
|
+
includePatternText
|
|
1444
|
+
));
|
|
1450
1445
|
}
|
|
1451
|
-
else {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
excludePatternText
|
|
1459
|
-
));
|
|
1460
|
-
}
|
|
1461
|
-
else if (hasIncludes) {
|
|
1462
|
-
message = ( localizeWithPath(
|
|
1463
|
-
'vs/workbench/contrib/search/browser/searchView',
|
|
1464
|
-
'noResultsIncludes',
|
|
1465
|
-
"No results found in '{0}' - ",
|
|
1466
|
-
includePatternText
|
|
1467
|
-
));
|
|
1468
|
-
}
|
|
1469
|
-
else if (hasExcludes) {
|
|
1470
|
-
message = ( localizeWithPath(
|
|
1471
|
-
'vs/workbench/contrib/search/browser/searchView',
|
|
1472
|
-
'noResultsExcludes',
|
|
1473
|
-
"No results found excluding '{0}' - ",
|
|
1474
|
-
excludePatternText
|
|
1475
|
-
));
|
|
1476
|
-
}
|
|
1477
|
-
else {
|
|
1478
|
-
message = ( localizeWithPath(
|
|
1479
|
-
'vs/workbench/contrib/search/browser/searchView',
|
|
1480
|
-
'noResultsFound',
|
|
1481
|
-
"No results found. Review your settings for configured exclusions and check your gitignore files - "
|
|
1482
|
-
));
|
|
1483
|
-
}
|
|
1446
|
+
else if (hasExcludes) {
|
|
1447
|
+
message = ( localizeWithPath(
|
|
1448
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1449
|
+
'noOpenEditorResultsExcludes',
|
|
1450
|
+
"No results found in open editors excluding '{0}' - ",
|
|
1451
|
+
excludePatternText
|
|
1452
|
+
));
|
|
1484
1453
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
append(messageEl, message);
|
|
1488
|
-
if (!completed) {
|
|
1489
|
-
const searchAgainButton = this.messageDisposables.add(( new SearchLinkButton(( localizeWithPath(
|
|
1454
|
+
else {
|
|
1455
|
+
message = ( localizeWithPath(
|
|
1490
1456
|
'vs/workbench/contrib/search/browser/searchView',
|
|
1491
|
-
'
|
|
1492
|
-
"
|
|
1493
|
-
))
|
|
1494
|
-
append(messageEl, searchAgainButton.element);
|
|
1457
|
+
'noOpenEditorResultsFound',
|
|
1458
|
+
"No results found in open editors. Review your settings for configured exclusions and check your gitignore files - "
|
|
1459
|
+
));
|
|
1495
1460
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1461
|
+
}
|
|
1462
|
+
else {
|
|
1463
|
+
if (hasIncludes && hasExcludes) {
|
|
1464
|
+
message = ( localizeWithPath(
|
|
1498
1465
|
'vs/workbench/contrib/search/browser/searchView',
|
|
1499
|
-
'
|
|
1500
|
-
"
|
|
1501
|
-
|
|
1502
|
-
|
|
1466
|
+
'noResultsIncludesExcludes',
|
|
1467
|
+
"No results found in '{0}' excluding '{1}' - ",
|
|
1468
|
+
includePatternText,
|
|
1469
|
+
excludePatternText
|
|
1470
|
+
));
|
|
1503
1471
|
}
|
|
1504
|
-
else {
|
|
1505
|
-
|
|
1472
|
+
else if (hasIncludes) {
|
|
1473
|
+
message = ( localizeWithPath(
|
|
1506
1474
|
'vs/workbench/contrib/search/browser/searchView',
|
|
1507
|
-
'
|
|
1508
|
-
"
|
|
1509
|
-
|
|
1510
|
-
|
|
1475
|
+
'noResultsIncludes',
|
|
1476
|
+
"No results found in '{0}' - ",
|
|
1477
|
+
includePatternText
|
|
1478
|
+
));
|
|
1511
1479
|
}
|
|
1512
|
-
if (
|
|
1513
|
-
|
|
1514
|
-
const learnMoreButton = this.messageDisposables.add(( new SearchLinkButton(( localizeWithPath(
|
|
1480
|
+
else if (hasExcludes) {
|
|
1481
|
+
message = ( localizeWithPath(
|
|
1515
1482
|
'vs/workbench/contrib/search/browser/searchView',
|
|
1516
|
-
'
|
|
1517
|
-
"
|
|
1518
|
-
|
|
1519
|
-
|
|
1483
|
+
'noResultsExcludes',
|
|
1484
|
+
"No results found excluding '{0}' - ",
|
|
1485
|
+
excludePatternText
|
|
1486
|
+
));
|
|
1520
1487
|
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1488
|
+
else {
|
|
1489
|
+
message = ( localizeWithPath(
|
|
1490
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1491
|
+
'noResultsFound',
|
|
1492
|
+
"No results found. Review your settings for configured exclusions and check your gitignore files - "
|
|
1493
|
+
));
|
|
1523
1494
|
}
|
|
1524
|
-
|
|
1495
|
+
}
|
|
1496
|
+
status(message);
|
|
1497
|
+
const messageEl = this.clearMessage();
|
|
1498
|
+
append(messageEl, message);
|
|
1499
|
+
if (!completed) {
|
|
1500
|
+
const searchAgainButton = this.messageDisposables.add(( new SearchLinkButton(( localizeWithPath(
|
|
1501
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1502
|
+
'rerunSearch.message',
|
|
1503
|
+
"Search again"
|
|
1504
|
+
)), () => this.triggerQueryChange({ preserveFocus: false }))));
|
|
1505
|
+
append(messageEl, searchAgainButton.element);
|
|
1506
|
+
}
|
|
1507
|
+
else if (hasIncludes || hasExcludes) {
|
|
1508
|
+
const searchAgainButton = this.messageDisposables.add(( new SearchLinkButton(( localizeWithPath(
|
|
1509
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1510
|
+
'rerunSearchInAll.message',
|
|
1511
|
+
"Search again in all files"
|
|
1512
|
+
)), this.onSearchAgain.bind(this))));
|
|
1513
|
+
append(messageEl, searchAgainButton.element);
|
|
1525
1514
|
}
|
|
1526
1515
|
else {
|
|
1527
|
-
this.
|
|
1528
|
-
status(( localizeWithPath(
|
|
1516
|
+
const openSettingsButton = this.messageDisposables.add(( new SearchLinkButton(( localizeWithPath(
|
|
1529
1517
|
'vs/workbench/contrib/search/browser/searchView',
|
|
1530
|
-
'
|
|
1531
|
-
"
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1518
|
+
'openSettings.message',
|
|
1519
|
+
"Open Settings"
|
|
1520
|
+
)), this.onOpenSettings.bind(this))));
|
|
1521
|
+
append(messageEl, openSettingsButton.element);
|
|
1522
|
+
}
|
|
1523
|
+
if (completed) {
|
|
1524
|
+
append(messageEl, $('span', undefined, ' - '));
|
|
1525
|
+
const learnMoreButton = this.messageDisposables.add(( new SearchLinkButton(( localizeWithPath(
|
|
1538
1526
|
'vs/workbench/contrib/search/browser/searchView',
|
|
1539
|
-
'
|
|
1540
|
-
"
|
|
1541
|
-
))
|
|
1527
|
+
'openSettings.learnMore',
|
|
1528
|
+
"Learn More"
|
|
1529
|
+
)), this.onLearnMore.bind(this))));
|
|
1530
|
+
append(messageEl, learnMoreButton.element);
|
|
1542
1531
|
}
|
|
1543
|
-
if (
|
|
1544
|
-
|
|
1545
|
-
this.addMessage(message);
|
|
1546
|
-
}
|
|
1532
|
+
if (this.contextService.getWorkbenchState() === 1 ) {
|
|
1533
|
+
this.showSearchWithoutFolderMessage();
|
|
1547
1534
|
}
|
|
1548
1535
|
this.reLayout();
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1536
|
+
}
|
|
1537
|
+
else {
|
|
1538
|
+
this.viewModel.searchResult.toggleHighlights(this.isVisible());
|
|
1539
|
+
status(( localizeWithPath(
|
|
1540
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1541
|
+
'ariaSearchResultsStatus',
|
|
1542
|
+
"Search returned {0} results in {1} files",
|
|
1543
|
+
this.viewModel.searchResult.count(),
|
|
1544
|
+
this.viewModel.searchResult.fileCount()
|
|
1545
|
+
)));
|
|
1546
|
+
}
|
|
1547
|
+
if (completed && completed.limitHit) {
|
|
1548
|
+
completed.messages.push({ type: TextSearchCompleteMessageType.Warning, text: ( localizeWithPath(
|
|
1549
|
+
'vs/workbench/contrib/search/browser/searchView',
|
|
1550
|
+
'searchMaxResultsWarning',
|
|
1551
|
+
"The result set only contains a subset of all matches. Be more specific in your search to narrow down the results."
|
|
1552
|
+
)) });
|
|
1553
|
+
}
|
|
1554
|
+
if (completed && completed.messages) {
|
|
1555
|
+
for (const message of completed.messages) {
|
|
1556
|
+
this.addMessage(message);
|
|
1561
1557
|
}
|
|
1562
|
-
}
|
|
1558
|
+
}
|
|
1559
|
+
this.reLayout();
|
|
1560
|
+
}
|
|
1561
|
+
onSearchError(e, progressComplete, excludePatternText, includePatternText, completed) {
|
|
1562
|
+
this.state = SearchUIState.Idle;
|
|
1563
|
+
if (isCancellationError(e)) {
|
|
1564
|
+
return this.onSearchComplete(progressComplete, excludePatternText, includePatternText, completed);
|
|
1565
|
+
}
|
|
1566
|
+
else {
|
|
1567
|
+
progressComplete();
|
|
1568
|
+
this.searchWidget.searchInput?.showMessage({ content: e.message, type: 3 });
|
|
1569
|
+
this.viewModel.searchResult.clear();
|
|
1570
|
+
return Promise.resolve();
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
doSearch(query, excludePatternText, includePatternText, triggeredOnType) {
|
|
1574
|
+
let progressComplete;
|
|
1575
|
+
this.progressService.withProgress({ location: this.getProgressLocation(), delay: triggeredOnType ? 300 : 0 }, _progress => {
|
|
1576
|
+
return ( new Promise(resolve => progressComplete = resolve));
|
|
1577
|
+
});
|
|
1578
|
+
this.searchWidget.searchInput?.clearMessage();
|
|
1579
|
+
this.state = SearchUIState.Searching;
|
|
1580
|
+
this.showEmptyStage();
|
|
1581
|
+
const slowTimer = setTimeout(() => {
|
|
1582
|
+
this.state = SearchUIState.SlowSearch;
|
|
1583
|
+
}, 2000);
|
|
1563
1584
|
this._visibleMatches = 0;
|
|
1564
1585
|
this._refreshResultsScheduler.schedule();
|
|
1565
1586
|
this.searchWidget.setReplaceAllActionState(false);
|
|
1566
1587
|
this.tree.setSelection([]);
|
|
1567
1588
|
this.tree.setFocus([]);
|
|
1589
|
+
this.viewModel.replaceString = this.searchWidget.getReplaceValue();
|
|
1568
1590
|
const result = this.viewModel.search(query);
|
|
1569
|
-
return result.asyncResults.then(
|
|
1591
|
+
return result.asyncResults.then((complete) => {
|
|
1592
|
+
clearTimeout(slowTimer);
|
|
1593
|
+
this.onSearchComplete(progressComplete, excludePatternText, includePatternText, complete);
|
|
1594
|
+
}, (e) => {
|
|
1595
|
+
clearTimeout(slowTimer);
|
|
1596
|
+
this.onSearchError(e, progressComplete, excludePatternText, includePatternText);
|
|
1597
|
+
});
|
|
1570
1598
|
}
|
|
1571
1599
|
onOpenSettings(e) {
|
|
1572
1600
|
EventHelper.stop(e, false);
|
|
@@ -1974,7 +2002,7 @@ SearchView = SearchView_1 = ( __decorate([
|
|
|
1974
2002
|
( __param(25, ITelemetryService)),
|
|
1975
2003
|
( __param(26, INotebookService)),
|
|
1976
2004
|
( __param(27, ILogService)),
|
|
1977
|
-
( __param(28,
|
|
2005
|
+
( __param(28, IAudioCueService))
|
|
1978
2006
|
], SearchView));
|
|
1979
2007
|
class SearchLinkButton extends Disposable {
|
|
1980
2008
|
constructor(label, handler, tooltip) {
|
|
@@ -22,7 +22,7 @@ import { ReplaceActiveKey, SearchInputBoxFocusedKey, ReplaceInputBoxFocusedKey,
|
|
|
22
22
|
import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
23
23
|
import { isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
24
24
|
import { Toggle } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
|
|
25
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
25
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
26
26
|
import { searchReplaceAllIcon, searchHideReplaceIcon, searchShowContextIcon, searchShowReplaceIcon } from './searchIcons.js';
|
|
27
27
|
import { ToggleSearchEditorContextLinesCommandId } from 'vscode/vscode/vs/workbench/contrib/searchEditor/browser/constants';
|
|
28
28
|
import { showHistoryKeybindingHint } from 'vscode/vscode/vs/platform/history/browser/historyWidgetKeybindingHint';
|
|
@@ -2,7 +2,7 @@ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.e
|
|
|
2
2
|
import { extname, isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
3
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
4
|
import { ToggleCaseSensitiveKeybinding, ToggleWholeWordKeybinding, ToggleRegexKeybinding } from 'vscode/vscode/vs/editor/contrib/find/browser/findModel';
|
|
5
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
5
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
6
6
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
7
|
import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
8
8
|
import { IContextKeyService, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
@@ -13,7 +13,7 @@ import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor'
|
|
|
13
13
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
14
14
|
import { EditorExtensions, DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
|
|
15
15
|
import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
16
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
16
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
17
17
|
import { getSearchView } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchActionsBase';
|
|
18
18
|
import { searchRefreshIcon, searchNewEditorIcon } from '../../search/browser/searchIcons.js';
|
|
19
19
|
import { HasSearchResults, SearchViewFocusedKey, SearchInputBoxFocusedKey } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
@@ -121,11 +121,11 @@ CommandsRegistry.registerCommand(CleanSearchEditorStateCommandId, (accessor) =>
|
|
|
121
121
|
activeEditorPane.cleanState();
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const category =
|
|
124
|
+
const category = ( localize2WithPath(
|
|
125
125
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
126
126
|
'search',
|
|
127
|
-
|
|
128
|
-
))
|
|
127
|
+
'Search Editor'
|
|
128
|
+
));
|
|
129
129
|
const translateLegacyConfig = (legacyConfig = {}) => {
|
|
130
130
|
const config = {};
|
|
131
131
|
const overrides = {
|
|
@@ -167,11 +167,11 @@ registerAction2(class extends Action2 {
|
|
|
167
167
|
constructor() {
|
|
168
168
|
super({
|
|
169
169
|
id: 'search.searchEditor.action.deleteFileResults',
|
|
170
|
-
title:
|
|
170
|
+
title: ( localize2WithPath(
|
|
171
171
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
172
172
|
'searchEditor.deleteResultBlock',
|
|
173
|
-
|
|
174
|
-
)),
|
|
173
|
+
'Delete File Results'
|
|
174
|
+
)),
|
|
175
175
|
keybinding: {
|
|
176
176
|
weight: 100 ,
|
|
177
177
|
primary: 2048 | 1024 | 1 ,
|
|
@@ -192,11 +192,11 @@ registerAction2(class extends Action2 {
|
|
|
192
192
|
constructor() {
|
|
193
193
|
super({
|
|
194
194
|
id: OpenNewEditorCommandId,
|
|
195
|
-
title:
|
|
195
|
+
title: ( localize2WithPath(
|
|
196
196
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
197
197
|
'search.openNewSearchEditor',
|
|
198
|
-
|
|
199
|
-
)),
|
|
198
|
+
'New Search Editor'
|
|
199
|
+
)),
|
|
200
200
|
category,
|
|
201
201
|
f1: true,
|
|
202
202
|
metadata: openArgMetadata
|
|
@@ -210,11 +210,11 @@ registerAction2(class extends Action2 {
|
|
|
210
210
|
constructor() {
|
|
211
211
|
super({
|
|
212
212
|
id: OpenEditorCommandId,
|
|
213
|
-
title:
|
|
213
|
+
title: ( localize2WithPath(
|
|
214
214
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
215
215
|
'search.openSearchEditor',
|
|
216
|
-
|
|
217
|
-
)),
|
|
216
|
+
'Open Search Editor'
|
|
217
|
+
)),
|
|
218
218
|
category,
|
|
219
219
|
f1: true,
|
|
220
220
|
metadata: openArgMetadata
|
|
@@ -228,11 +228,11 @@ registerAction2(class extends Action2 {
|
|
|
228
228
|
constructor() {
|
|
229
229
|
super({
|
|
230
230
|
id: OpenNewEditorToSideCommandId,
|
|
231
|
-
title:
|
|
231
|
+
title: ( localize2WithPath(
|
|
232
232
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
233
233
|
'search.openNewEditorToSide',
|
|
234
|
-
|
|
235
|
-
)),
|
|
234
|
+
'Open New Search Editor to the Side'
|
|
235
|
+
)),
|
|
236
236
|
category,
|
|
237
237
|
f1: true,
|
|
238
238
|
metadata: openArgMetadata
|
|
@@ -246,11 +246,11 @@ registerAction2(class extends Action2 {
|
|
|
246
246
|
constructor() {
|
|
247
247
|
super({
|
|
248
248
|
id: OpenInEditorCommandId,
|
|
249
|
-
title:
|
|
249
|
+
title: ( localize2WithPath(
|
|
250
250
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
251
251
|
'search.openResultsInEditor',
|
|
252
|
-
|
|
253
|
-
)),
|
|
252
|
+
'Open Results in Editor'
|
|
253
|
+
)),
|
|
254
254
|
category,
|
|
255
255
|
f1: true,
|
|
256
256
|
keybinding: {
|
|
@@ -276,11 +276,11 @@ registerAction2(class extends Action2 {
|
|
|
276
276
|
constructor() {
|
|
277
277
|
super({
|
|
278
278
|
id: RerunSearchEditorSearchCommandId,
|
|
279
|
-
title:
|
|
279
|
+
title: ( localize2WithPath(
|
|
280
280
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
281
281
|
'search.rerunSearchInEditor',
|
|
282
|
-
|
|
283
|
-
)),
|
|
282
|
+
'Search Again'
|
|
283
|
+
)),
|
|
284
284
|
category,
|
|
285
285
|
keybinding: {
|
|
286
286
|
primary: 2048 | 1024 | 48 ,
|
|
@@ -311,11 +311,11 @@ registerAction2(class extends Action2 {
|
|
|
311
311
|
constructor() {
|
|
312
312
|
super({
|
|
313
313
|
id: FocusQueryEditorWidgetCommandId,
|
|
314
|
-
title:
|
|
314
|
+
title: ( localize2WithPath(
|
|
315
315
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
316
316
|
'search.action.focusQueryEditorWidget',
|
|
317
|
-
|
|
318
|
-
)),
|
|
317
|
+
'Focus Search Editor Input'
|
|
318
|
+
)),
|
|
319
319
|
category,
|
|
320
320
|
f1: true,
|
|
321
321
|
precondition: InSearchEditor,
|
|
@@ -337,11 +337,11 @@ registerAction2(class extends Action2 {
|
|
|
337
337
|
constructor() {
|
|
338
338
|
super({
|
|
339
339
|
id: FocusQueryEditorFilesToIncludeCommandId,
|
|
340
|
-
title:
|
|
340
|
+
title: ( localize2WithPath(
|
|
341
341
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
342
342
|
'search.action.focusFilesToInclude',
|
|
343
|
-
|
|
344
|
-
)),
|
|
343
|
+
'Focus Search Editor Files to Include'
|
|
344
|
+
)),
|
|
345
345
|
category,
|
|
346
346
|
f1: true,
|
|
347
347
|
precondition: InSearchEditor,
|
|
@@ -359,11 +359,11 @@ registerAction2(class extends Action2 {
|
|
|
359
359
|
constructor() {
|
|
360
360
|
super({
|
|
361
361
|
id: FocusQueryEditorFilesToExcludeCommandId,
|
|
362
|
-
title:
|
|
362
|
+
title: ( localize2WithPath(
|
|
363
363
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
364
364
|
'search.action.focusFilesToExclude',
|
|
365
|
-
|
|
366
|
-
)),
|
|
365
|
+
'Focus Search Editor Files to Exclude'
|
|
366
|
+
)),
|
|
367
367
|
category,
|
|
368
368
|
f1: true,
|
|
369
369
|
precondition: InSearchEditor,
|
|
@@ -381,11 +381,11 @@ registerAction2(class extends Action2 {
|
|
|
381
381
|
constructor() {
|
|
382
382
|
super({
|
|
383
383
|
id: ToggleSearchEditorCaseSensitiveCommandId,
|
|
384
|
-
title:
|
|
384
|
+
title: ( localize2WithPath(
|
|
385
385
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
386
386
|
'searchEditor.action.toggleSearchEditorCaseSensitive',
|
|
387
|
-
|
|
388
|
-
)),
|
|
387
|
+
'Toggle Match Case'
|
|
388
|
+
)),
|
|
389
389
|
category,
|
|
390
390
|
f1: true,
|
|
391
391
|
precondition: InSearchEditor,
|
|
@@ -403,11 +403,11 @@ registerAction2(class extends Action2 {
|
|
|
403
403
|
constructor() {
|
|
404
404
|
super({
|
|
405
405
|
id: ToggleSearchEditorWholeWordCommandId,
|
|
406
|
-
title:
|
|
406
|
+
title: ( localize2WithPath(
|
|
407
407
|
'vs/workbench/contrib/searchEditor/browser/searchEditor.contribution',
|
|
408
408
|
'searchEditor.action.toggleSearchEditorWholeWord',
|
|
409
|
-
|
|
410
|
-
)),
|
|
409
|
+
'Toggle Match Whole Word'
|
|
410
|
+
)),
|
|
411
411
|
category,
|
|
412
412
|
f1: true,
|
|
413
413
|
precondition: InSearchEditor,
|
|
@@ -6,7 +6,7 @@ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/c
|
|
|
6
6
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
7
7
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
8
8
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
9
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/common/
|
|
9
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
10
10
|
import { getSearchView } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchActionsBase';
|
|
11
11
|
import { SearchEditorInput, getOrMakeSearchEditorInput } from './searchEditorInput.js';
|
|
12
12
|
import { serializeSearchResultForEditor } from './searchEditorSerialization.js';
|
|
@@ -21,10 +21,17 @@ import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/working
|
|
|
21
21
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
22
22
|
import { bufferToReadable, VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
23
23
|
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
24
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
25
|
+
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
24
26
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
25
27
|
|
|
26
28
|
var SearchEditorInput_1;
|
|
27
29
|
const SEARCH_EDITOR_EXT = '.code-search';
|
|
30
|
+
const SearchEditorIcon = registerIcon('search-editor-label-icon', Codicon.search, ( localizeWithPath(
|
|
31
|
+
'vs/workbench/contrib/searchEditor/browser/searchEditorInput',
|
|
32
|
+
'searchEditorLabelIcon',
|
|
33
|
+
'Icon of the search editor label.'
|
|
34
|
+
)));
|
|
28
35
|
let SearchEditorInput = class SearchEditorInput extends EditorInput {
|
|
29
36
|
static { SearchEditorInput_1 = this; }
|
|
30
37
|
static { this.ID = SearchEditorInputTypeId; }
|
|
@@ -34,6 +41,9 @@ let SearchEditorInput = class SearchEditorInput extends EditorInput {
|
|
|
34
41
|
get editorId() {
|
|
35
42
|
return this.typeId;
|
|
36
43
|
}
|
|
44
|
+
getIcon() {
|
|
45
|
+
return SearchEditorIcon;
|
|
46
|
+
}
|
|
37
47
|
get capabilities() {
|
|
38
48
|
let capabilities = 8 ;
|
|
39
49
|
if (!this.backingUri) {
|