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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +2 -2
  2. package/search.js +4 -4
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  6. package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +0 -776
  7. package/vscode/src/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +0 -6
  8. package/vscode/src/vs/workbench/contrib/search/browser/media/searchview.css.js +0 -6
  9. package/vscode/src/vs/workbench/contrib/search/browser/patternInputWidget.js +0 -231
  10. package/vscode/src/vs/workbench/contrib/search/browser/quickTextSearch/textSearchQuickAccess.js +0 -342
  11. package/vscode/src/vs/workbench/contrib/search/browser/replaceContributions.js +0 -8
  12. package/vscode/src/vs/workbench/contrib/search/browser/replaceService.js +0 -232
  13. package/vscode/src/vs/workbench/contrib/search/browser/search.contribution.js +0 -621
  14. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsCopy.js +0 -209
  15. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsNav.js +0 -511
  16. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsRemoveReplace.js +0 -374
  17. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsSymbol.js +0 -43
  18. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTextQuickAccess.js +0 -44
  19. package/vscode/src/vs/workbench/contrib/search/browser/searchActionsTopBar.js +0 -323
  20. package/vscode/src/vs/workbench/contrib/search/browser/searchFindInput.js +0 -47
  21. package/vscode/src/vs/workbench/contrib/search/browser/searchIcons.js +0 -96
  22. package/vscode/src/vs/workbench/contrib/search/browser/searchMessage.js +0 -66
  23. package/vscode/src/vs/workbench/contrib/search/browser/searchResultsView.js +0 -434
  24. package/vscode/src/vs/workbench/contrib/search/browser/searchView.js +0 -2096
  25. package/vscode/src/vs/workbench/contrib/search/browser/searchWidget.js +0 -667
  26. package/vscode/src/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +0 -234
  27. package/vscode/src/vs/workbench/contrib/search/common/cacheState.js +0 -87
  28. package/vscode/src/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +0 -6
  29. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +0 -586
  30. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditor.js +0 -736
  31. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +0 -189
  32. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +0 -320
  33. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +0 -138
  34. package/vscode/src/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +0 -293
  35. package/vscode/src/vs/workbench/services/search/common/searchService.js +0 -372
@@ -1,374 +0,0 @@
1
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
3
- import { getSelectionKeyboardEvent } from 'vscode/vscode/vs/platform/list/browser/listService';
4
- import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
5
- import { searchRemoveIcon, searchReplaceIcon } from './searchIcons.js';
6
- import { SearchContext } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
7
- import { IReplaceService } from 'vscode/vscode/vs/workbench/contrib/search/browser/replace';
8
- import { arrayContainsElementOrParent, SearchResult, Match, MatchInNotebook, FileMatch, FolderMatch } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
9
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
10
- import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
11
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
12
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
13
- import { category, getSearchView, getElementsToOperateOn, shouldRefocus } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchActionsBase';
14
- import { equals } from 'vscode/vscode/vs/base/common/arrays';
15
-
16
- registerAction2(class RemoveAction extends Action2 {
17
- constructor() {
18
- super({
19
- id: "search.action.remove" ,
20
- title: ( localize2WithPath(
21
- 'vs/workbench/contrib/search/browser/searchActionsRemoveReplace',
22
- 'RemoveAction.label',
23
- "Dismiss"
24
- )),
25
- category,
26
- icon: searchRemoveIcon,
27
- keybinding: {
28
- weight: 200 ,
29
- when: ( ContextKeyExpr.and(
30
- SearchContext.SearchViewVisibleKey,
31
- SearchContext.FileMatchOrMatchFocusKey
32
- )),
33
- primary: 20 ,
34
- mac: {
35
- primary: 2048 | 1 ,
36
- },
37
- },
38
- menu: [
39
- {
40
- id: MenuId.SearchContext,
41
- group: 'search',
42
- order: 2,
43
- },
44
- {
45
- id: MenuId.SearchActionMenu,
46
- group: 'inline',
47
- order: 2,
48
- },
49
- ]
50
- });
51
- }
52
- run(accessor, context) {
53
- const viewsService = accessor.get(IViewsService);
54
- const configurationService = accessor.get(IConfigurationService);
55
- const searchView = getSearchView(viewsService);
56
- if (!searchView) {
57
- return;
58
- }
59
- let element = context?.element;
60
- let viewer = context?.viewer;
61
- if (!viewer) {
62
- viewer = searchView.getControl();
63
- }
64
- if (!element) {
65
- element = viewer.getFocus()[0] ?? undefined;
66
- }
67
- const elementsToRemove = getElementsToOperateOn(viewer, element, configurationService.getValue('search'));
68
- let focusElement = viewer.getFocus()[0] ?? undefined;
69
- if (elementsToRemove.length === 0) {
70
- return;
71
- }
72
- if (!focusElement || (focusElement instanceof SearchResult)) {
73
- focusElement = element;
74
- }
75
- let nextFocusElement;
76
- const shouldRefocusMatch = shouldRefocus(elementsToRemove, focusElement);
77
- if (focusElement && shouldRefocusMatch) {
78
- nextFocusElement = getElementToFocusAfterRemoved(viewer, focusElement, elementsToRemove);
79
- }
80
- const searchResult = searchView.searchResult;
81
- if (searchResult) {
82
- searchResult.batchRemove(elementsToRemove);
83
- }
84
- if (focusElement && shouldRefocusMatch) {
85
- if (!nextFocusElement) {
86
- nextFocusElement = getLastNodeFromSameType(viewer, focusElement);
87
- }
88
- if (nextFocusElement && !arrayContainsElementOrParent(nextFocusElement, elementsToRemove)) {
89
- viewer.reveal(nextFocusElement);
90
- viewer.setFocus([nextFocusElement], getSelectionKeyboardEvent());
91
- viewer.setSelection([nextFocusElement], getSelectionKeyboardEvent());
92
- }
93
- }
94
- else if (!equals(viewer.getFocus(), viewer.getSelection())) {
95
- viewer.setSelection(viewer.getFocus());
96
- }
97
- viewer.domFocus();
98
- return;
99
- }
100
- });
101
- registerAction2(class ReplaceAction extends Action2 {
102
- constructor() {
103
- super({
104
- id: "search.action.replace" ,
105
- title: ( localize2WithPath(
106
- 'vs/workbench/contrib/search/browser/searchActionsRemoveReplace',
107
- 'match.replace.label',
108
- "Replace"
109
- )),
110
- category,
111
- keybinding: {
112
- weight: 200 ,
113
- when: ( ContextKeyExpr.and(
114
- SearchContext.SearchViewVisibleKey,
115
- SearchContext.ReplaceActiveKey,
116
- SearchContext.MatchFocusKey,
117
- SearchContext.IsEditableItemKey
118
- )),
119
- primary: 1024 | 2048 | 22 ,
120
- },
121
- icon: searchReplaceIcon,
122
- menu: [
123
- {
124
- id: MenuId.SearchContext,
125
- when: ( ContextKeyExpr.and(
126
- SearchContext.ReplaceActiveKey,
127
- SearchContext.MatchFocusKey,
128
- SearchContext.IsEditableItemKey
129
- )),
130
- group: 'search',
131
- order: 1
132
- },
133
- {
134
- id: MenuId.SearchActionMenu,
135
- when: ( ContextKeyExpr.and(
136
- SearchContext.ReplaceActiveKey,
137
- SearchContext.MatchFocusKey,
138
- SearchContext.IsEditableItemKey
139
- )),
140
- group: 'inline',
141
- order: 1
142
- }
143
- ]
144
- });
145
- }
146
- async run(accessor, context) {
147
- return performReplace(accessor, context);
148
- }
149
- });
150
- registerAction2(class ReplaceAllAction extends Action2 {
151
- constructor() {
152
- super({
153
- id: "search.action.replaceAllInFile" ,
154
- title: ( localize2WithPath(
155
- 'vs/workbench/contrib/search/browser/searchActionsRemoveReplace',
156
- 'file.replaceAll.label',
157
- "Replace All"
158
- )),
159
- category,
160
- keybinding: {
161
- weight: 200 ,
162
- when: ( ContextKeyExpr.and(
163
- SearchContext.SearchViewVisibleKey,
164
- SearchContext.ReplaceActiveKey,
165
- SearchContext.FileFocusKey,
166
- SearchContext.IsEditableItemKey
167
- )),
168
- primary: 1024 | 2048 | 22 ,
169
- secondary: [2048 | 1024 | 3 ],
170
- },
171
- icon: searchReplaceIcon,
172
- menu: [
173
- {
174
- id: MenuId.SearchContext,
175
- when: ( ContextKeyExpr.and(
176
- SearchContext.ReplaceActiveKey,
177
- SearchContext.FileFocusKey,
178
- SearchContext.IsEditableItemKey
179
- )),
180
- group: 'search',
181
- order: 1
182
- },
183
- {
184
- id: MenuId.SearchActionMenu,
185
- when: ( ContextKeyExpr.and(
186
- SearchContext.ReplaceActiveKey,
187
- SearchContext.FileFocusKey,
188
- SearchContext.IsEditableItemKey
189
- )),
190
- group: 'inline',
191
- order: 1
192
- }
193
- ]
194
- });
195
- }
196
- async run(accessor, context) {
197
- return performReplace(accessor, context);
198
- }
199
- });
200
- registerAction2(class ReplaceAllInFolderAction extends Action2 {
201
- constructor() {
202
- super({
203
- id: "search.action.replaceAllInFolder" ,
204
- title: ( localize2WithPath(
205
- 'vs/workbench/contrib/search/browser/searchActionsRemoveReplace',
206
- 'file.replaceAll.label',
207
- "Replace All"
208
- )),
209
- category,
210
- keybinding: {
211
- weight: 200 ,
212
- when: ( ContextKeyExpr.and(
213
- SearchContext.SearchViewVisibleKey,
214
- SearchContext.ReplaceActiveKey,
215
- SearchContext.FolderFocusKey,
216
- SearchContext.IsEditableItemKey
217
- )),
218
- primary: 1024 | 2048 | 22 ,
219
- secondary: [2048 | 1024 | 3 ],
220
- },
221
- icon: searchReplaceIcon,
222
- menu: [
223
- {
224
- id: MenuId.SearchContext,
225
- when: ( ContextKeyExpr.and(
226
- SearchContext.ReplaceActiveKey,
227
- SearchContext.FolderFocusKey,
228
- SearchContext.IsEditableItemKey
229
- )),
230
- group: 'search',
231
- order: 1
232
- },
233
- {
234
- id: MenuId.SearchActionMenu,
235
- when: ( ContextKeyExpr.and(
236
- SearchContext.ReplaceActiveKey,
237
- SearchContext.FolderFocusKey,
238
- SearchContext.IsEditableItemKey
239
- )),
240
- group: 'inline',
241
- order: 1
242
- }
243
- ]
244
- });
245
- }
246
- async run(accessor, context) {
247
- return performReplace(accessor, context);
248
- }
249
- });
250
- function performReplace(accessor, context) {
251
- const configurationService = accessor.get(IConfigurationService);
252
- const viewsService = accessor.get(IViewsService);
253
- const viewlet = getSearchView(viewsService);
254
- const viewer = context?.viewer ?? viewlet?.getControl();
255
- if (!viewer) {
256
- return;
257
- }
258
- const element = context?.element ?? viewer.getFocus()[0];
259
- const elementsToReplace = getElementsToOperateOn(viewer, element ?? undefined, configurationService.getValue('search'));
260
- let focusElement = viewer.getFocus()[0];
261
- if (!focusElement || (focusElement && !arrayContainsElementOrParent(focusElement, elementsToReplace)) || (focusElement instanceof SearchResult)) {
262
- focusElement = element;
263
- }
264
- if (elementsToReplace.length === 0) {
265
- return;
266
- }
267
- let nextFocusElement;
268
- if (focusElement) {
269
- nextFocusElement = getElementToFocusAfterRemoved(viewer, focusElement, elementsToReplace);
270
- }
271
- const searchResult = viewlet?.searchResult;
272
- if (searchResult) {
273
- searchResult.batchReplace(elementsToReplace);
274
- }
275
- if (focusElement) {
276
- if (!nextFocusElement) {
277
- nextFocusElement = getLastNodeFromSameType(viewer, focusElement);
278
- }
279
- if (nextFocusElement) {
280
- viewer.reveal(nextFocusElement);
281
- viewer.setFocus([nextFocusElement], getSelectionKeyboardEvent());
282
- viewer.setSelection([nextFocusElement], getSelectionKeyboardEvent());
283
- if (nextFocusElement instanceof Match) {
284
- const useReplacePreview = configurationService.getValue().search.useReplacePreview;
285
- if (!useReplacePreview || hasToOpenFile(accessor, nextFocusElement) || nextFocusElement instanceof MatchInNotebook) {
286
- viewlet?.open(nextFocusElement, true);
287
- }
288
- else {
289
- accessor.get(IReplaceService).openReplacePreview(nextFocusElement, true);
290
- }
291
- }
292
- else if (nextFocusElement instanceof FileMatch) {
293
- viewlet?.open(nextFocusElement, true);
294
- }
295
- }
296
- }
297
- viewer.domFocus();
298
- }
299
- function hasToOpenFile(accessor, currBottomElem) {
300
- if (!(currBottomElem instanceof Match)) {
301
- return false;
302
- }
303
- const activeEditor = accessor.get(IEditorService).activeEditor;
304
- const file = activeEditor?.resource;
305
- if (file) {
306
- return accessor.get(IUriIdentityService).extUri.isEqual(file, currBottomElem.parent().resource);
307
- }
308
- return false;
309
- }
310
- function compareLevels(elem1, elem2) {
311
- if (elem1 instanceof Match) {
312
- if (elem2 instanceof Match) {
313
- return 0;
314
- }
315
- else {
316
- return -1;
317
- }
318
- }
319
- else if (elem1 instanceof FileMatch) {
320
- if (elem2 instanceof Match) {
321
- return 1;
322
- }
323
- else if (elem2 instanceof FileMatch) {
324
- return 0;
325
- }
326
- else {
327
- return -1;
328
- }
329
- }
330
- else {
331
- if (elem2 instanceof FolderMatch) {
332
- return 0;
333
- }
334
- else {
335
- return 1;
336
- }
337
- }
338
- }
339
- function getElementToFocusAfterRemoved(viewer, element, elementsToRemove) {
340
- const navigator = viewer.navigate(element);
341
- if (element instanceof FolderMatch) {
342
- while (!!navigator.next() && (!(navigator.current() instanceof FolderMatch) || arrayContainsElementOrParent(navigator.current(), elementsToRemove))) { }
343
- }
344
- else if (element instanceof FileMatch) {
345
- while (!!navigator.next() && (!(navigator.current() instanceof FileMatch) || arrayContainsElementOrParent(navigator.current(), elementsToRemove))) {
346
- viewer.expand(navigator.current());
347
- }
348
- }
349
- else {
350
- while (navigator.next() && (!(navigator.current() instanceof Match) || arrayContainsElementOrParent(navigator.current(), elementsToRemove))) {
351
- viewer.expand(navigator.current());
352
- }
353
- }
354
- return navigator.current();
355
- }
356
- function getLastNodeFromSameType(viewer, element) {
357
- let lastElem = viewer.lastVisibleElement ?? null;
358
- while (lastElem) {
359
- const compareVal = compareLevels(element, lastElem);
360
- if (compareVal === -1) {
361
- viewer.expand(lastElem);
362
- lastElem = viewer.lastVisibleElement;
363
- }
364
- else if (compareVal === 1) {
365
- lastElem = viewer.getParentElement(lastElem);
366
- }
367
- else {
368
- return lastElem;
369
- }
370
- }
371
- return undefined;
372
- }
373
-
374
- export { getElementToFocusAfterRemoved, getLastNodeFromSameType };
@@ -1,43 +0,0 @@
1
- import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
4
-
5
- registerAction2(class ShowAllSymbolsAction extends Action2 {
6
- static { this.ID = 'workbench.action.showAllSymbols'; }
7
- static { this.LABEL = ( localizeWithPath(
8
- 'vs/workbench/contrib/search/browser/searchActionsSymbol',
9
- 'showTriggerActions',
10
- "Go to Symbol in Workspace..."
11
- )); }
12
- static { this.ALL_SYMBOLS_PREFIX = '#'; }
13
- constructor() {
14
- super({
15
- id: "workbench.action.showAllSymbols" ,
16
- title: {
17
- ...( localize2WithPath(
18
- 'vs/workbench/contrib/search/browser/searchActionsSymbol',
19
- 'showTriggerActions',
20
- "Go to Symbol in Workspace..."
21
- )),
22
- mnemonicTitle: ( localizeWithPath(
23
- 'vs/workbench/contrib/search/browser/searchActionsSymbol',
24
- { key: 'miGotoSymbolInWorkspace', comment: ['&& denotes a mnemonic'] },
25
- "Go to Symbol in &&Workspace..."
26
- )),
27
- },
28
- f1: true,
29
- keybinding: {
30
- weight: 200 ,
31
- primary: 2048 | 50
32
- },
33
- menu: {
34
- id: MenuId.MenubarGoMenu,
35
- group: '3_global_nav',
36
- order: 2
37
- }
38
- });
39
- }
40
- async run(accessor) {
41
- accessor.get(IQuickInputService).quickAccess.show(ShowAllSymbolsAction.ALL_SYMBOLS_PREFIX);
42
- }
43
- });
@@ -1,44 +0,0 @@
1
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { category } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchActionsBase';
4
- import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
5
- import { TEXT_SEARCH_QUICK_ACCESS_PREFIX } from './quickTextSearch/textSearchQuickAccess.js';
6
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
7
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
8
- import { getSelectionTextFromEditor } from './searchView.js';
9
-
10
- registerAction2(class TextSearchQuickAccessAction extends Action2 {
11
- constructor() {
12
- super({
13
- id: "workbench.action.experimental.quickTextSearch" ,
14
- title: ( localize2WithPath(
15
- 'vs/workbench/contrib/search/browser/searchActionsTextQuickAccess',
16
- 'quickTextSearch',
17
- "Quick Search (Experimental)"
18
- )),
19
- category,
20
- f1: true
21
- });
22
- }
23
- async run(accessor, match) {
24
- const quickInputService = accessor.get(IQuickInputService);
25
- const searchText = getSearchText(accessor) ?? '';
26
- quickInputService.quickAccess.show(TEXT_SEARCH_QUICK_ACCESS_PREFIX + searchText, { preserveValue: !!searchText });
27
- }
28
- });
29
- function getSearchText(accessor) {
30
- const editorService = accessor.get(IEditorService);
31
- const configurationService = accessor.get(IConfigurationService);
32
- const activeEditor = editorService.activeTextEditorControl;
33
- if (!activeEditor) {
34
- return null;
35
- }
36
- if (!activeEditor.hasTextFocus()) {
37
- return null;
38
- }
39
- const seedSearchStringFromSelection = configurationService.getValue('editor.find.seedSearchStringFromSelection');
40
- if (!seedSearchStringFromSelection) {
41
- return null;
42
- }
43
- return getSelectionTextFromEditor(false, activeEditor);
44
- }