@codingame/monaco-vscode-search-service-override 3.2.3 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/search.js +4 -4
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/override/vs/platform/dialogs/common/dialogs.js +0 -8
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +0 -776
- package/vscode/src/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/search/browser/media/searchview.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +0 -231
- package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +0 -342
- package/vscode/src/vs/workbench/contrib/search/browser/replaceContributions.js +0 -8
- package/vscode/src/vs/workbench/contrib/search/browser/replaceService.js +0 -232
- package/vscode/src/vs/workbench/contrib/search/browser/search.contribution.js +0 -621
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +0 -209
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +0 -511
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +0 -374
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsSymbol.js +0 -43
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +0 -44
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +0 -323
- package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +0 -47
- package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +0 -96
- package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +0 -66
- package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +0 -434
- package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +0 -2096
- package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +0 -667
- package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +0 -234
- package/vscode/src/vs/workbench/contrib/search/common/cacheState.js +0 -87
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +0 -586
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.js +0 -736
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +0 -189
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +0 -320
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +0 -138
- package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +0 -293
- package/vscode/src/vs/workbench/services/search/common/searchService.js +0 -372
|
@@ -1,434 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { append, $ } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { CountBadge } from 'vscode/vscode/vs/base/browser/ui/countBadge/countBadge';
|
|
4
|
-
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { dirname } from 'vscode/vscode/vs/base/common/path';
|
|
6
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
7
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
-
import { FileKind } from 'vscode/vscode/vs/platform/files/common/files';
|
|
9
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
10
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
11
|
-
import { FolderMatchWorkspaceRoot, FolderMatchNoRoot, MatchInNotebook, FolderMatch, FileMatch, Match } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
12
|
-
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
13
|
-
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
14
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
-
import { MenuWorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
16
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
17
|
-
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
18
|
-
import { defaultCountBadgeStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
|
|
19
|
-
import { SearchContext } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
20
|
-
|
|
21
|
-
var FolderMatchRenderer_1, FileMatchRenderer_1, MatchRenderer_1;
|
|
22
|
-
class SearchDelegate {
|
|
23
|
-
static { this.ITEM_HEIGHT = 22; }
|
|
24
|
-
getHeight(element) {
|
|
25
|
-
return SearchDelegate.ITEM_HEIGHT;
|
|
26
|
-
}
|
|
27
|
-
getTemplateId(element) {
|
|
28
|
-
if (element instanceof FolderMatch) {
|
|
29
|
-
return FolderMatchRenderer.TEMPLATE_ID;
|
|
30
|
-
}
|
|
31
|
-
else if (element instanceof FileMatch) {
|
|
32
|
-
return FileMatchRenderer.TEMPLATE_ID;
|
|
33
|
-
}
|
|
34
|
-
else if (element instanceof Match) {
|
|
35
|
-
return MatchRenderer.TEMPLATE_ID;
|
|
36
|
-
}
|
|
37
|
-
console.error('Invalid search tree element', element);
|
|
38
|
-
throw new Error('Invalid search tree element');
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
let FolderMatchRenderer = class FolderMatchRenderer extends Disposable {
|
|
42
|
-
static { FolderMatchRenderer_1 = this; }
|
|
43
|
-
static { this.TEMPLATE_ID = 'folderMatch'; }
|
|
44
|
-
constructor(searchView, labels, contextService, labelService, instantiationService, contextKeyService) {
|
|
45
|
-
super();
|
|
46
|
-
this.searchView = searchView;
|
|
47
|
-
this.labels = labels;
|
|
48
|
-
this.contextService = contextService;
|
|
49
|
-
this.labelService = labelService;
|
|
50
|
-
this.instantiationService = instantiationService;
|
|
51
|
-
this.contextKeyService = contextKeyService;
|
|
52
|
-
this.templateId = FolderMatchRenderer_1.TEMPLATE_ID;
|
|
53
|
-
}
|
|
54
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
55
|
-
const compressed = node.element;
|
|
56
|
-
const folder = compressed.elements[compressed.elements.length - 1];
|
|
57
|
-
const label = ( compressed.elements.map(e => e.name()));
|
|
58
|
-
if (folder.resource) {
|
|
59
|
-
const fileKind = (folder instanceof FolderMatchWorkspaceRoot) ? FileKind.ROOT_FOLDER : FileKind.FOLDER;
|
|
60
|
-
templateData.label.setResource({ resource: folder.resource, name: label }, {
|
|
61
|
-
fileKind,
|
|
62
|
-
separator: this.labelService.getSeparator(folder.resource.scheme),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
templateData.label.setLabel(( localizeWithPath(
|
|
67
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
68
|
-
'searchFolderMatch.other.label',
|
|
69
|
-
"Other files"
|
|
70
|
-
)));
|
|
71
|
-
}
|
|
72
|
-
this.renderFolderDetails(folder, templateData);
|
|
73
|
-
}
|
|
74
|
-
renderTemplate(container) {
|
|
75
|
-
const disposables = ( new DisposableStore());
|
|
76
|
-
const folderMatchElement = append(container, $('.foldermatch'));
|
|
77
|
-
const label = this.labels.create(folderMatchElement, { supportDescriptionHighlights: true, supportHighlights: true });
|
|
78
|
-
disposables.add(label);
|
|
79
|
-
const badge = ( new CountBadge(
|
|
80
|
-
append(folderMatchElement, $('.badge')),
|
|
81
|
-
{},
|
|
82
|
-
defaultCountBadgeStyles
|
|
83
|
-
));
|
|
84
|
-
const actionBarContainer = append(folderMatchElement, $('.actionBarContainer'));
|
|
85
|
-
const elementDisposables = ( new DisposableStore());
|
|
86
|
-
disposables.add(elementDisposables);
|
|
87
|
-
const contextKeyServiceMain = disposables.add(this.contextKeyService.createScoped(container));
|
|
88
|
-
SearchContext.MatchFocusKey.bindTo(contextKeyServiceMain).set(false);
|
|
89
|
-
SearchContext.FileFocusKey.bindTo(contextKeyServiceMain).set(false);
|
|
90
|
-
SearchContext.FolderFocusKey.bindTo(contextKeyServiceMain).set(true);
|
|
91
|
-
const instantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, contextKeyServiceMain])));
|
|
92
|
-
const actions = disposables.add(instantiationService.createInstance(MenuWorkbenchToolBar, actionBarContainer, MenuId.SearchActionMenu, {
|
|
93
|
-
menuOptions: {
|
|
94
|
-
shouldForwardArgs: true
|
|
95
|
-
},
|
|
96
|
-
hiddenItemStrategy: 0 ,
|
|
97
|
-
toolbarOptions: {
|
|
98
|
-
primaryGroup: (g) => /^inline/.test(g),
|
|
99
|
-
},
|
|
100
|
-
}));
|
|
101
|
-
return {
|
|
102
|
-
label,
|
|
103
|
-
badge,
|
|
104
|
-
actions,
|
|
105
|
-
disposables,
|
|
106
|
-
elementDisposables,
|
|
107
|
-
contextKeyService: contextKeyServiceMain
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
renderElement(node, index, templateData) {
|
|
111
|
-
const folderMatch = node.element;
|
|
112
|
-
if (folderMatch.resource) {
|
|
113
|
-
const workspaceFolder = this.contextService.getWorkspaceFolder(folderMatch.resource);
|
|
114
|
-
if (workspaceFolder && isEqual(workspaceFolder.uri, folderMatch.resource)) {
|
|
115
|
-
templateData.label.setFile(folderMatch.resource, { fileKind: FileKind.ROOT_FOLDER, hidePath: true });
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
templateData.label.setFile(folderMatch.resource, { fileKind: FileKind.FOLDER, hidePath: this.searchView.isTreeLayoutViewVisible });
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
templateData.label.setLabel(( localizeWithPath(
|
|
123
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
124
|
-
'searchFolderMatch.other.label',
|
|
125
|
-
"Other files"
|
|
126
|
-
)));
|
|
127
|
-
}
|
|
128
|
-
SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!folderMatch.hasOnlyReadOnlyMatches());
|
|
129
|
-
templateData.elementDisposables.add(folderMatch.onChange(() => {
|
|
130
|
-
SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!folderMatch.hasOnlyReadOnlyMatches());
|
|
131
|
-
}));
|
|
132
|
-
this.renderFolderDetails(folderMatch, templateData);
|
|
133
|
-
}
|
|
134
|
-
disposeElement(element, index, templateData) {
|
|
135
|
-
templateData.elementDisposables.clear();
|
|
136
|
-
}
|
|
137
|
-
disposeCompressedElements(node, index, templateData, height) {
|
|
138
|
-
templateData.elementDisposables.clear();
|
|
139
|
-
}
|
|
140
|
-
disposeTemplate(templateData) {
|
|
141
|
-
templateData.disposables.dispose();
|
|
142
|
-
}
|
|
143
|
-
renderFolderDetails(folder, templateData) {
|
|
144
|
-
const count = folder.recursiveMatchCount();
|
|
145
|
-
templateData.badge.setCount(count);
|
|
146
|
-
templateData.badge.setTitleFormat(count > 1 ? ( localizeWithPath(
|
|
147
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
148
|
-
'searchFileMatches',
|
|
149
|
-
"{0} files found",
|
|
150
|
-
count
|
|
151
|
-
)) : ( localizeWithPath(
|
|
152
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
153
|
-
'searchFileMatch',
|
|
154
|
-
"{0} file found",
|
|
155
|
-
count
|
|
156
|
-
)));
|
|
157
|
-
templateData.actions.context = { viewer: this.searchView.getControl(), element: folder };
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
FolderMatchRenderer = FolderMatchRenderer_1 = ( __decorate([
|
|
161
|
-
( __param(2, IWorkspaceContextService)),
|
|
162
|
-
( __param(3, ILabelService)),
|
|
163
|
-
( __param(4, IInstantiationService)),
|
|
164
|
-
( __param(5, IContextKeyService))
|
|
165
|
-
], FolderMatchRenderer));
|
|
166
|
-
let FileMatchRenderer = class FileMatchRenderer extends Disposable {
|
|
167
|
-
static { FileMatchRenderer_1 = this; }
|
|
168
|
-
static { this.TEMPLATE_ID = 'fileMatch'; }
|
|
169
|
-
constructor(searchView, labels, contextService, configurationService, instantiationService, contextKeyService) {
|
|
170
|
-
super();
|
|
171
|
-
this.searchView = searchView;
|
|
172
|
-
this.labels = labels;
|
|
173
|
-
this.contextService = contextService;
|
|
174
|
-
this.configurationService = configurationService;
|
|
175
|
-
this.instantiationService = instantiationService;
|
|
176
|
-
this.contextKeyService = contextKeyService;
|
|
177
|
-
this.templateId = FileMatchRenderer_1.TEMPLATE_ID;
|
|
178
|
-
}
|
|
179
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
180
|
-
throw new Error('Should never happen since node is incompressible.');
|
|
181
|
-
}
|
|
182
|
-
renderTemplate(container) {
|
|
183
|
-
const disposables = ( new DisposableStore());
|
|
184
|
-
const elementDisposables = ( new DisposableStore());
|
|
185
|
-
disposables.add(elementDisposables);
|
|
186
|
-
const fileMatchElement = append(container, $('.filematch'));
|
|
187
|
-
const label = this.labels.create(fileMatchElement);
|
|
188
|
-
disposables.add(label);
|
|
189
|
-
const badge = ( new CountBadge(append(fileMatchElement, $('.badge')), {}, defaultCountBadgeStyles));
|
|
190
|
-
const actionBarContainer = append(fileMatchElement, $('.actionBarContainer'));
|
|
191
|
-
const contextKeyServiceMain = disposables.add(this.contextKeyService.createScoped(container));
|
|
192
|
-
SearchContext.MatchFocusKey.bindTo(contextKeyServiceMain).set(false);
|
|
193
|
-
SearchContext.FileFocusKey.bindTo(contextKeyServiceMain).set(true);
|
|
194
|
-
SearchContext.FolderFocusKey.bindTo(contextKeyServiceMain).set(false);
|
|
195
|
-
const instantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, contextKeyServiceMain])));
|
|
196
|
-
const actions = disposables.add(instantiationService.createInstance(MenuWorkbenchToolBar, actionBarContainer, MenuId.SearchActionMenu, {
|
|
197
|
-
menuOptions: {
|
|
198
|
-
shouldForwardArgs: true
|
|
199
|
-
},
|
|
200
|
-
hiddenItemStrategy: 0 ,
|
|
201
|
-
toolbarOptions: {
|
|
202
|
-
primaryGroup: (g) => /^inline/.test(g),
|
|
203
|
-
},
|
|
204
|
-
}));
|
|
205
|
-
return {
|
|
206
|
-
el: fileMatchElement,
|
|
207
|
-
label,
|
|
208
|
-
badge,
|
|
209
|
-
actions,
|
|
210
|
-
disposables,
|
|
211
|
-
elementDisposables,
|
|
212
|
-
contextKeyService: contextKeyServiceMain
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
renderElement(node, index, templateData) {
|
|
216
|
-
const fileMatch = node.element;
|
|
217
|
-
templateData.el.setAttribute('data-resource', ( fileMatch.resource.toString()));
|
|
218
|
-
const decorationConfig = this.configurationService.getValue('search').decorations;
|
|
219
|
-
templateData.label.setFile(fileMatch.resource, { hidePath: this.searchView.isTreeLayoutViewVisible && !(fileMatch.parent() instanceof FolderMatchNoRoot), hideIcon: false, fileDecorations: { colors: decorationConfig.colors, badges: decorationConfig.badges } });
|
|
220
|
-
const count = fileMatch.count();
|
|
221
|
-
templateData.badge.setCount(count);
|
|
222
|
-
templateData.badge.setTitleFormat(count > 1 ? ( localizeWithPath(
|
|
223
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
224
|
-
'searchMatches',
|
|
225
|
-
"{0} matches found",
|
|
226
|
-
count
|
|
227
|
-
)) : ( localizeWithPath(
|
|
228
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
229
|
-
'searchMatch',
|
|
230
|
-
"{0} match found",
|
|
231
|
-
count
|
|
232
|
-
)));
|
|
233
|
-
templateData.actions.context = { viewer: this.searchView.getControl(), element: fileMatch };
|
|
234
|
-
SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!fileMatch.hasOnlyReadOnlyMatches());
|
|
235
|
-
templateData.elementDisposables.add(fileMatch.onChange(() => {
|
|
236
|
-
SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!fileMatch.hasOnlyReadOnlyMatches());
|
|
237
|
-
}));
|
|
238
|
-
const twistieContainer = templateData.el.parentElement?.parentElement?.querySelector('.monaco-tl-twistie');
|
|
239
|
-
twistieContainer?.classList.add('force-twistie');
|
|
240
|
-
}
|
|
241
|
-
disposeElement(element, index, templateData) {
|
|
242
|
-
templateData.elementDisposables.clear();
|
|
243
|
-
}
|
|
244
|
-
disposeTemplate(templateData) {
|
|
245
|
-
templateData.disposables.dispose();
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
FileMatchRenderer = FileMatchRenderer_1 = ( __decorate([
|
|
249
|
-
( __param(2, IWorkspaceContextService)),
|
|
250
|
-
( __param(3, IConfigurationService)),
|
|
251
|
-
( __param(4, IInstantiationService)),
|
|
252
|
-
( __param(5, IContextKeyService))
|
|
253
|
-
], FileMatchRenderer));
|
|
254
|
-
let MatchRenderer = class MatchRenderer extends Disposable {
|
|
255
|
-
static { MatchRenderer_1 = this; }
|
|
256
|
-
static { this.TEMPLATE_ID = 'match'; }
|
|
257
|
-
constructor(searchView, contextService, configurationService, instantiationService, contextKeyService) {
|
|
258
|
-
super();
|
|
259
|
-
this.searchView = searchView;
|
|
260
|
-
this.contextService = contextService;
|
|
261
|
-
this.configurationService = configurationService;
|
|
262
|
-
this.instantiationService = instantiationService;
|
|
263
|
-
this.contextKeyService = contextKeyService;
|
|
264
|
-
this.templateId = MatchRenderer_1.TEMPLATE_ID;
|
|
265
|
-
}
|
|
266
|
-
renderCompressedElements(node, index, templateData, height) {
|
|
267
|
-
throw new Error('Should never happen since node is incompressible.');
|
|
268
|
-
}
|
|
269
|
-
renderTemplate(container) {
|
|
270
|
-
container.classList.add('linematch');
|
|
271
|
-
const lineNumber = append(container, $('span.matchLineNum'));
|
|
272
|
-
const parent = append(container, $('a.plain.match'));
|
|
273
|
-
const before = append(parent, $('span'));
|
|
274
|
-
const match = append(parent, $('span.findInFileMatch'));
|
|
275
|
-
const replace = append(parent, $('span.replaceMatch'));
|
|
276
|
-
const after = append(parent, $('span'));
|
|
277
|
-
const actionBarContainer = append(container, $('span.actionBarContainer'));
|
|
278
|
-
const disposables = ( new DisposableStore());
|
|
279
|
-
const contextKeyServiceMain = disposables.add(this.contextKeyService.createScoped(container));
|
|
280
|
-
SearchContext.MatchFocusKey.bindTo(contextKeyServiceMain).set(true);
|
|
281
|
-
SearchContext.FileFocusKey.bindTo(contextKeyServiceMain).set(false);
|
|
282
|
-
SearchContext.FolderFocusKey.bindTo(contextKeyServiceMain).set(false);
|
|
283
|
-
const instantiationService = this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, contextKeyServiceMain])));
|
|
284
|
-
const actions = disposables.add(instantiationService.createInstance(MenuWorkbenchToolBar, actionBarContainer, MenuId.SearchActionMenu, {
|
|
285
|
-
menuOptions: {
|
|
286
|
-
shouldForwardArgs: true
|
|
287
|
-
},
|
|
288
|
-
hiddenItemStrategy: 0 ,
|
|
289
|
-
toolbarOptions: {
|
|
290
|
-
primaryGroup: (g) => /^inline/.test(g),
|
|
291
|
-
},
|
|
292
|
-
}));
|
|
293
|
-
return {
|
|
294
|
-
parent,
|
|
295
|
-
before,
|
|
296
|
-
match,
|
|
297
|
-
replace,
|
|
298
|
-
after,
|
|
299
|
-
lineNumber,
|
|
300
|
-
actions,
|
|
301
|
-
disposables,
|
|
302
|
-
contextKeyService: contextKeyServiceMain
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
renderElement(node, index, templateData) {
|
|
306
|
-
const match = node.element;
|
|
307
|
-
const preview = match.preview();
|
|
308
|
-
const replace = this.searchView.model.isReplaceActive() &&
|
|
309
|
-
!!this.searchView.model.replaceString &&
|
|
310
|
-
!(match instanceof MatchInNotebook && match.isReadonly());
|
|
311
|
-
templateData.before.textContent = preview.before;
|
|
312
|
-
templateData.match.textContent = preview.inside;
|
|
313
|
-
templateData.match.classList.toggle('replace', replace);
|
|
314
|
-
templateData.replace.textContent = replace ? match.replaceString : '';
|
|
315
|
-
templateData.after.textContent = preview.after;
|
|
316
|
-
templateData.parent.title = (preview.fullBefore + (replace ? match.replaceString : preview.inside) + preview.after).trim().substr(0, 999);
|
|
317
|
-
SearchContext.IsEditableItemKey.bindTo(templateData.contextKeyService).set(!(match instanceof MatchInNotebook && match.isReadonly()));
|
|
318
|
-
const numLines = match.range().endLineNumber - match.range().startLineNumber;
|
|
319
|
-
const extraLinesStr = numLines > 0 ? `+${numLines}` : '';
|
|
320
|
-
const showLineNumbers = this.configurationService.getValue('search').showLineNumbers;
|
|
321
|
-
const lineNumberStr = showLineNumbers ? `${match.range().startLineNumber}:` : '';
|
|
322
|
-
templateData.lineNumber.classList.toggle('show', (numLines > 0) || showLineNumbers);
|
|
323
|
-
templateData.lineNumber.textContent = lineNumberStr + extraLinesStr;
|
|
324
|
-
templateData.lineNumber.setAttribute('title', this.getMatchTitle(match, showLineNumbers));
|
|
325
|
-
templateData.actions.context = { viewer: this.searchView.getControl(), element: match };
|
|
326
|
-
}
|
|
327
|
-
disposeTemplate(templateData) {
|
|
328
|
-
templateData.disposables.dispose();
|
|
329
|
-
}
|
|
330
|
-
getMatchTitle(match, showLineNumbers) {
|
|
331
|
-
const startLine = match.range().startLineNumber;
|
|
332
|
-
const numLines = match.range().endLineNumber - match.range().startLineNumber;
|
|
333
|
-
const lineNumStr = showLineNumbers ?
|
|
334
|
-
( localizeWithPath(
|
|
335
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
336
|
-
'lineNumStr',
|
|
337
|
-
"From line {0}",
|
|
338
|
-
startLine,
|
|
339
|
-
numLines
|
|
340
|
-
)) + ' ' :
|
|
341
|
-
'';
|
|
342
|
-
const numLinesStr = numLines > 0 ?
|
|
343
|
-
'+ ' + ( localizeWithPath(
|
|
344
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
345
|
-
'numLinesStr',
|
|
346
|
-
"{0} more lines",
|
|
347
|
-
numLines
|
|
348
|
-
)) :
|
|
349
|
-
'';
|
|
350
|
-
return lineNumStr + numLinesStr;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
MatchRenderer = MatchRenderer_1 = ( __decorate([
|
|
354
|
-
( __param(1, IWorkspaceContextService)),
|
|
355
|
-
( __param(2, IConfigurationService)),
|
|
356
|
-
( __param(3, IInstantiationService)),
|
|
357
|
-
( __param(4, IContextKeyService))
|
|
358
|
-
], MatchRenderer));
|
|
359
|
-
let SearchAccessibilityProvider = class SearchAccessibilityProvider {
|
|
360
|
-
constructor(searchView, labelService) {
|
|
361
|
-
this.searchView = searchView;
|
|
362
|
-
this.labelService = labelService;
|
|
363
|
-
}
|
|
364
|
-
getWidgetAriaLabel() {
|
|
365
|
-
return ( localizeWithPath(
|
|
366
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
367
|
-
'search',
|
|
368
|
-
"Search"
|
|
369
|
-
));
|
|
370
|
-
}
|
|
371
|
-
getAriaLabel(element) {
|
|
372
|
-
if (element instanceof FolderMatch) {
|
|
373
|
-
const count = element.allDownstreamFileMatches().reduce((total, current) => total + current.count(), 0);
|
|
374
|
-
return element.resource ?
|
|
375
|
-
( localizeWithPath(
|
|
376
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
377
|
-
'folderMatchAriaLabel',
|
|
378
|
-
"{0} matches in folder root {1}, Search result",
|
|
379
|
-
count,
|
|
380
|
-
element.name()
|
|
381
|
-
)) :
|
|
382
|
-
( localizeWithPath(
|
|
383
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
384
|
-
'otherFilesAriaLabel',
|
|
385
|
-
"{0} matches outside of the workspace, Search result",
|
|
386
|
-
count
|
|
387
|
-
));
|
|
388
|
-
}
|
|
389
|
-
if (element instanceof FileMatch) {
|
|
390
|
-
const path = this.labelService.getUriLabel(element.resource, { relative: true }) || element.resource.fsPath;
|
|
391
|
-
return ( localizeWithPath(
|
|
392
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
393
|
-
'fileMatchAriaLabel',
|
|
394
|
-
"{0} matches in file {1} of folder {2}, Search result",
|
|
395
|
-
element.count(),
|
|
396
|
-
element.name(),
|
|
397
|
-
dirname(path)
|
|
398
|
-
));
|
|
399
|
-
}
|
|
400
|
-
if (element instanceof Match) {
|
|
401
|
-
const match = element;
|
|
402
|
-
const searchModel = this.searchView.model;
|
|
403
|
-
const replace = searchModel.isReplaceActive() && !!searchModel.replaceString;
|
|
404
|
-
const matchString = match.getMatchString();
|
|
405
|
-
const range = match.range();
|
|
406
|
-
const matchText = match.text().substr(0, range.endColumn + 150);
|
|
407
|
-
if (replace) {
|
|
408
|
-
return ( localizeWithPath(
|
|
409
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
410
|
-
'replacePreviewResultAria',
|
|
411
|
-
"'{0}' at column {1} replace {2} with {3}",
|
|
412
|
-
matchText,
|
|
413
|
-
range.startColumn,
|
|
414
|
-
matchString,
|
|
415
|
-
match.replaceString
|
|
416
|
-
));
|
|
417
|
-
}
|
|
418
|
-
return ( localizeWithPath(
|
|
419
|
-
'vs/workbench/contrib/search/browser/searchResultsView',
|
|
420
|
-
'searchResultAria',
|
|
421
|
-
"'{0}' at column {1} found {2}",
|
|
422
|
-
matchText,
|
|
423
|
-
range.startColumn,
|
|
424
|
-
matchString
|
|
425
|
-
));
|
|
426
|
-
}
|
|
427
|
-
return null;
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
SearchAccessibilityProvider = ( __decorate([
|
|
431
|
-
( __param(1, ILabelService))
|
|
432
|
-
], SearchAccessibilityProvider));
|
|
433
|
-
|
|
434
|
-
export { FileMatchRenderer, FolderMatchRenderer, MatchRenderer, SearchAccessibilityProvider, SearchDelegate };
|