@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,209 +0,0 @@
|
|
|
1
|
-
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
-
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
|
|
3
|
-
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
4
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
5
|
-
import { SearchContext } from 'vscode/vscode/vs/workbench/contrib/search/common/constants';
|
|
6
|
-
import { FileMatch, FolderMatchWithResource, Match, FolderMatch, searchMatchComparer } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchModel';
|
|
7
|
-
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
8
|
-
import { category, getSearchView } from 'vscode/vscode/vs/workbench/contrib/search/browser/searchActionsBase';
|
|
9
|
-
import { isWindows } from 'vscode/vscode/vs/base/common/platform';
|
|
10
|
-
|
|
11
|
-
registerAction2(class CopyMatchCommandAction extends Action2 {
|
|
12
|
-
constructor() {
|
|
13
|
-
super({
|
|
14
|
-
id: "search.action.copyMatch" ,
|
|
15
|
-
title: ( localize2WithPath(
|
|
16
|
-
'vs/workbench/contrib/search/browser/searchActionsCopy',
|
|
17
|
-
'copyMatchLabel',
|
|
18
|
-
"Copy"
|
|
19
|
-
)),
|
|
20
|
-
category,
|
|
21
|
-
keybinding: {
|
|
22
|
-
weight: 200 ,
|
|
23
|
-
when: SearchContext.FileMatchOrMatchFocusKey,
|
|
24
|
-
primary: 2048 | 33 ,
|
|
25
|
-
},
|
|
26
|
-
menu: [{
|
|
27
|
-
id: MenuId.SearchContext,
|
|
28
|
-
when: SearchContext.FileMatchOrMatchFocusKey,
|
|
29
|
-
group: 'search_2',
|
|
30
|
-
order: 1
|
|
31
|
-
}]
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
async run(accessor, match) {
|
|
35
|
-
await copyMatchCommand(accessor, match);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
registerAction2(class CopyPathCommandAction extends Action2 {
|
|
39
|
-
constructor() {
|
|
40
|
-
super({
|
|
41
|
-
id: "search.action.copyPath" ,
|
|
42
|
-
title: ( localize2WithPath(
|
|
43
|
-
'vs/workbench/contrib/search/browser/searchActionsCopy',
|
|
44
|
-
'copyPathLabel',
|
|
45
|
-
"Copy Path"
|
|
46
|
-
)),
|
|
47
|
-
category,
|
|
48
|
-
keybinding: {
|
|
49
|
-
weight: 200 ,
|
|
50
|
-
when: SearchContext.FileMatchOrFolderMatchWithResourceFocusKey,
|
|
51
|
-
primary: 2048 | 512 | 33 ,
|
|
52
|
-
win: {
|
|
53
|
-
primary: 1024 | 512 | 33
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
menu: [{
|
|
57
|
-
id: MenuId.SearchContext,
|
|
58
|
-
when: SearchContext.FileMatchOrFolderMatchWithResourceFocusKey,
|
|
59
|
-
group: 'search_2',
|
|
60
|
-
order: 2
|
|
61
|
-
}]
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
async run(accessor, fileMatch) {
|
|
65
|
-
await copyPathCommand(accessor, fileMatch);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
registerAction2(class CopyAllCommandAction extends Action2 {
|
|
69
|
-
constructor() {
|
|
70
|
-
super({
|
|
71
|
-
id: "search.action.copyAll" ,
|
|
72
|
-
title: ( localize2WithPath(
|
|
73
|
-
'vs/workbench/contrib/search/browser/searchActionsCopy',
|
|
74
|
-
'copyAllLabel',
|
|
75
|
-
"Copy All"
|
|
76
|
-
)),
|
|
77
|
-
category,
|
|
78
|
-
menu: [{
|
|
79
|
-
id: MenuId.SearchContext,
|
|
80
|
-
when: SearchContext.HasSearchResults,
|
|
81
|
-
group: 'search_2',
|
|
82
|
-
order: 3
|
|
83
|
-
}]
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
async run(accessor) {
|
|
87
|
-
await copyAllCommand(accessor);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
const lineDelimiter = isWindows ? '\r\n' : '\n';
|
|
91
|
-
async function copyPathCommand(accessor, fileMatch) {
|
|
92
|
-
if (!fileMatch) {
|
|
93
|
-
const selection = getSelectedRow(accessor);
|
|
94
|
-
if (!(selection instanceof FileMatch || selection instanceof FolderMatchWithResource)) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
fileMatch = selection;
|
|
98
|
-
}
|
|
99
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
100
|
-
const labelService = accessor.get(ILabelService);
|
|
101
|
-
const text = labelService.getUriLabel(fileMatch.resource, { noPrefix: true });
|
|
102
|
-
await clipboardService.writeText(text);
|
|
103
|
-
}
|
|
104
|
-
async function copyMatchCommand(accessor, match) {
|
|
105
|
-
if (!match) {
|
|
106
|
-
const selection = getSelectedRow(accessor);
|
|
107
|
-
if (!selection) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
match = selection;
|
|
111
|
-
}
|
|
112
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
113
|
-
const labelService = accessor.get(ILabelService);
|
|
114
|
-
let text;
|
|
115
|
-
if (match instanceof Match) {
|
|
116
|
-
text = matchToString(match);
|
|
117
|
-
}
|
|
118
|
-
else if (match instanceof FileMatch) {
|
|
119
|
-
text = fileMatchToString(match, labelService).text;
|
|
120
|
-
}
|
|
121
|
-
else if (match instanceof FolderMatch) {
|
|
122
|
-
text = folderMatchToString(match, labelService).text;
|
|
123
|
-
}
|
|
124
|
-
if (text) {
|
|
125
|
-
await clipboardService.writeText(text);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function copyAllCommand(accessor) {
|
|
129
|
-
const viewsService = accessor.get(IViewsService);
|
|
130
|
-
const clipboardService = accessor.get(IClipboardService);
|
|
131
|
-
const labelService = accessor.get(ILabelService);
|
|
132
|
-
const searchView = getSearchView(viewsService);
|
|
133
|
-
if (searchView) {
|
|
134
|
-
const root = searchView.searchResult;
|
|
135
|
-
const text = allFolderMatchesToString(root.folderMatches(), labelService);
|
|
136
|
-
await clipboardService.writeText(text);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function matchToString(match, indent = 0) {
|
|
140
|
-
const getFirstLinePrefix = () => `${match.range().startLineNumber},${match.range().startColumn}`;
|
|
141
|
-
const getOtherLinePrefix = (i) => match.range().startLineNumber + i + '';
|
|
142
|
-
const fullMatchLines = match.fullPreviewLines();
|
|
143
|
-
const largestPrefixSize = fullMatchLines.reduce((largest, _, i) => {
|
|
144
|
-
const thisSize = i === 0 ?
|
|
145
|
-
getFirstLinePrefix().length :
|
|
146
|
-
getOtherLinePrefix(i).length;
|
|
147
|
-
return Math.max(thisSize, largest);
|
|
148
|
-
}, 0);
|
|
149
|
-
const formattedLines = ( fullMatchLines
|
|
150
|
-
.map((line, i) => {
|
|
151
|
-
const prefix = i === 0 ?
|
|
152
|
-
getFirstLinePrefix() :
|
|
153
|
-
getOtherLinePrefix(i);
|
|
154
|
-
const paddingStr = ' '.repeat(largestPrefixSize - prefix.length);
|
|
155
|
-
const indentStr = ' '.repeat(indent);
|
|
156
|
-
return `${indentStr}${prefix}: ${paddingStr}${line}`;
|
|
157
|
-
}));
|
|
158
|
-
return formattedLines.join('\n');
|
|
159
|
-
}
|
|
160
|
-
function fileFolderMatchToString(match, labelService) {
|
|
161
|
-
if (match instanceof FileMatch) {
|
|
162
|
-
return fileMatchToString(match, labelService);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
return folderMatchToString(match, labelService);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function fileMatchToString(fileMatch, labelService) {
|
|
169
|
-
const matchTextRows = ( fileMatch.matches()
|
|
170
|
-
.sort(searchMatchComparer)
|
|
171
|
-
.map(match => matchToString(match, 2)));
|
|
172
|
-
const uriString = labelService.getUriLabel(fileMatch.resource, { noPrefix: true });
|
|
173
|
-
return {
|
|
174
|
-
text: `${uriString}${lineDelimiter}${matchTextRows.join(lineDelimiter)}`,
|
|
175
|
-
count: matchTextRows.length
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
function folderMatchToString(folderMatch, labelService) {
|
|
179
|
-
const results = [];
|
|
180
|
-
let numMatches = 0;
|
|
181
|
-
const matches = folderMatch.matches().sort(searchMatchComparer);
|
|
182
|
-
matches.forEach(match => {
|
|
183
|
-
const result = fileFolderMatchToString(match, labelService);
|
|
184
|
-
numMatches += result.count;
|
|
185
|
-
results.push(result.text);
|
|
186
|
-
});
|
|
187
|
-
return {
|
|
188
|
-
text: results.join(lineDelimiter + lineDelimiter),
|
|
189
|
-
count: numMatches
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function allFolderMatchesToString(folderMatches, labelService) {
|
|
193
|
-
const folderResults = [];
|
|
194
|
-
folderMatches = folderMatches.sort(searchMatchComparer);
|
|
195
|
-
for (let i = 0; i < folderMatches.length; i++) {
|
|
196
|
-
const folderResult = folderMatchToString(folderMatches[i], labelService);
|
|
197
|
-
if (folderResult.count) {
|
|
198
|
-
folderResults.push(folderResult.text);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return folderResults.join(lineDelimiter + lineDelimiter);
|
|
202
|
-
}
|
|
203
|
-
function getSelectedRow(accessor) {
|
|
204
|
-
const viewsService = accessor.get(IViewsService);
|
|
205
|
-
const searchView = getSearchView(viewsService);
|
|
206
|
-
return searchView?.getControl().getSelection()[0];
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export { lineDelimiter };
|