@codingame/monaco-vscode-notebook-service-override 3.2.2 → 4.0.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/notebook.js +1 -1
- package/override/vs/platform/dialogs/common/dialogs.js +2 -0
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +61 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +11 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +9 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +3 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +293 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +16 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +107 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +15 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +48 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +2 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +7 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +47 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +6 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +11 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +20 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +1 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +15 -5
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +54 -55
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +3 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +11 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
3
|
-
import { ResourceSet, ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
4
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
5
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
6
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
7
|
-
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
8
|
-
import { contentMatchesToTextSearchMatches, webviewMatchesToTextSearchMatches } from 'vscode/vscode/vs/workbench/contrib/search/browser/notebookSearch/searchNotebookHelpers';
|
|
9
|
-
import { pathIncludedInQuery, ISearchService } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
10
|
-
import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
|
|
11
|
-
import { isNumber } from 'vscode/vscode/vs/base/common/types';
|
|
12
|
-
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
13
|
-
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
|
|
14
|
-
import { QueryBuilder } from 'vscode/vscode/vs/workbench/services/search/common/queryBuilder';
|
|
15
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
|
-
|
|
17
|
-
let NotebookSearchService = class NotebookSearchService {
|
|
18
|
-
constructor(uriIdentityService, notebookEditorService, logService, notebookService, configurationService, editorResolverService, searchService, instantiationService) {
|
|
19
|
-
this.uriIdentityService = uriIdentityService;
|
|
20
|
-
this.notebookEditorService = notebookEditorService;
|
|
21
|
-
this.logService = logService;
|
|
22
|
-
this.notebookService = notebookService;
|
|
23
|
-
this.configurationService = configurationService;
|
|
24
|
-
this.editorResolverService = editorResolverService;
|
|
25
|
-
this.searchService = searchService;
|
|
26
|
-
this.queryBuilder = instantiationService.createInstance(QueryBuilder);
|
|
27
|
-
}
|
|
28
|
-
notebookSearch(query, token, searchInstanceID, onProgress) {
|
|
29
|
-
if (query.type !== 2 ) {
|
|
30
|
-
return {
|
|
31
|
-
openFilesToScan: ( new ResourceSet()),
|
|
32
|
-
completeData: Promise.resolve({
|
|
33
|
-
messages: [],
|
|
34
|
-
limitHit: false,
|
|
35
|
-
results: [],
|
|
36
|
-
}),
|
|
37
|
-
allScannedFiles: Promise.resolve(( new ResourceSet())),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const localNotebookWidgets = this.getLocalNotebookWidgets();
|
|
41
|
-
const localNotebookFiles = ( localNotebookWidgets.map(widget => widget.viewModel.uri));
|
|
42
|
-
const getAllResults = () => {
|
|
43
|
-
const searchStart = Date.now();
|
|
44
|
-
const localResultPromise = this.getLocalNotebookResults(query, token ?? CancellationToken.None, localNotebookWidgets, searchInstanceID);
|
|
45
|
-
const searchLocalEnd = Date.now();
|
|
46
|
-
const experimentalNotebooksEnabled = this.configurationService.getValue('search').experimental?.closedNotebookRichContentResults ?? false;
|
|
47
|
-
let closedResultsPromise = Promise.resolve(undefined);
|
|
48
|
-
if (experimentalNotebooksEnabled) {
|
|
49
|
-
closedResultsPromise = this.getClosedNotebookResults(query, ( new ResourceSet(
|
|
50
|
-
localNotebookFiles,
|
|
51
|
-
uri => this.uriIdentityService.extUri.getComparisonKey(uri)
|
|
52
|
-
)), token ?? CancellationToken.None);
|
|
53
|
-
}
|
|
54
|
-
const promise = Promise.all([localResultPromise, closedResultsPromise]);
|
|
55
|
-
return {
|
|
56
|
-
completeData: promise.then((resolvedPromise) => {
|
|
57
|
-
const openNotebookResult = resolvedPromise[0];
|
|
58
|
-
const closedNotebookResult = resolvedPromise[1];
|
|
59
|
-
const resolved = resolvedPromise.filter((e) => !!e);
|
|
60
|
-
const resultArray = [...( openNotebookResult.results.values()), ...(closedNotebookResult?.results.values() ?? [])];
|
|
61
|
-
const results = coalesce(resultArray);
|
|
62
|
-
if (onProgress) {
|
|
63
|
-
results.forEach(onProgress);
|
|
64
|
-
}
|
|
65
|
-
this.logService.trace(`local notebook search time | ${searchLocalEnd - searchStart}ms`);
|
|
66
|
-
return {
|
|
67
|
-
messages: [],
|
|
68
|
-
limitHit: resolved.reduce((prev, cur) => prev || cur.limitHit, false),
|
|
69
|
-
results,
|
|
70
|
-
};
|
|
71
|
-
}),
|
|
72
|
-
allScannedFiles: promise.then(resolvedPromise => {
|
|
73
|
-
const openNotebookResults = resolvedPromise[0];
|
|
74
|
-
const closedNotebookResults = resolvedPromise[1];
|
|
75
|
-
const results = coalesce([...( openNotebookResults.results.keys()), ...(closedNotebookResults?.results.keys() ?? [])]);
|
|
76
|
-
return ( new ResourceSet(results, uri => this.uriIdentityService.extUri.getComparisonKey(uri)));
|
|
77
|
-
})
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
const promiseResults = getAllResults();
|
|
81
|
-
return {
|
|
82
|
-
openFilesToScan: ( new ResourceSet(localNotebookFiles)),
|
|
83
|
-
completeData: promiseResults.completeData,
|
|
84
|
-
allScannedFiles: promiseResults.allScannedFiles
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
async doesFileExist(includes, folderQueries, token) {
|
|
88
|
-
const promises = ( includes.map(async (includePattern) => {
|
|
89
|
-
const query = this.queryBuilder.file(( folderQueries.map(e => e.folder)), {
|
|
90
|
-
includePattern: includePattern.startsWith('/') ? includePattern : '**/' + includePattern,
|
|
91
|
-
exists: true
|
|
92
|
-
});
|
|
93
|
-
return this.searchService.fileSearch(query, token).then((ret) => {
|
|
94
|
-
if (!ret.limitHit) {
|
|
95
|
-
throw Error('File not found');
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}));
|
|
99
|
-
return Promise.any(promises).then(() => true).catch(() => false);
|
|
100
|
-
}
|
|
101
|
-
async getClosedNotebookResults(textQuery, scannedFiles, token) {
|
|
102
|
-
const userAssociations = this.editorResolverService.getAllUserAssociations();
|
|
103
|
-
const allPriorityInfo = ( new Map());
|
|
104
|
-
const contributedNotebookTypes = this.notebookService.getContributedNotebookTypes();
|
|
105
|
-
userAssociations.forEach(association => {
|
|
106
|
-
if (!association.filenamePattern) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const info = {
|
|
110
|
-
isFromSettings: true,
|
|
111
|
-
filenamePatterns: [association.filenamePattern]
|
|
112
|
-
};
|
|
113
|
-
const existingEntry = allPriorityInfo.get(association.viewType);
|
|
114
|
-
if (existingEntry) {
|
|
115
|
-
allPriorityInfo.set(association.viewType, existingEntry.concat(info));
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
allPriorityInfo.set(association.viewType, [info]);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const promises = [];
|
|
122
|
-
contributedNotebookTypes.forEach((notebook) => {
|
|
123
|
-
if (notebook.selectors.length > 0) {
|
|
124
|
-
promises.push((async () => {
|
|
125
|
-
const includes = ( notebook.selectors.map((selector) => {
|
|
126
|
-
const globPattern = selector.include || selector;
|
|
127
|
-
return ( globPattern.toString());
|
|
128
|
-
}));
|
|
129
|
-
const isInWorkspace = await this.doesFileExist(includes, textQuery.folderQueries, token);
|
|
130
|
-
if (isInWorkspace) {
|
|
131
|
-
const canResolve = await this.notebookService.canResolve(notebook.id);
|
|
132
|
-
if (!canResolve) {
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
|
-
const serializer = (await this.notebookService.withNotebookDataProvider(notebook.id)).serializer;
|
|
136
|
-
return await serializer.searchInNotebooks(textQuery, token, allPriorityInfo);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
})());
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
const start = Date.now();
|
|
145
|
-
const searchComplete = coalesce(await Promise.all(promises));
|
|
146
|
-
const results = searchComplete.flatMap(e => e.results);
|
|
147
|
-
let limitHit = ( searchComplete.some(e => e.limitHit));
|
|
148
|
-
const uniqueResults = ( new ResourceMap(uri => this.uriIdentityService.extUri.getComparisonKey(uri)));
|
|
149
|
-
let numResults = 0;
|
|
150
|
-
for (const result of results) {
|
|
151
|
-
if (textQuery.maxResults && numResults >= textQuery.maxResults) {
|
|
152
|
-
limitHit = true;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
if (!( scannedFiles.has(result.resource)) && !( uniqueResults.has(result.resource))) {
|
|
156
|
-
uniqueResults.set(result.resource, result.cellResults.length > 0 ? result : null);
|
|
157
|
-
numResults++;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
const end = Date.now();
|
|
161
|
-
this.logService.trace(`query: ${textQuery.contentPattern.pattern}`);
|
|
162
|
-
this.logService.trace(`closed notebook search time | ${end - start}ms`);
|
|
163
|
-
return {
|
|
164
|
-
results: uniqueResults,
|
|
165
|
-
limitHit
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
async getLocalNotebookResults(query, token, widgets, searchID) {
|
|
169
|
-
const localResults = ( new ResourceMap(uri => this.uriIdentityService.extUri.getComparisonKey(uri)));
|
|
170
|
-
let limitHit = false;
|
|
171
|
-
for (const widget of widgets) {
|
|
172
|
-
if (!widget.hasModel()) {
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
const askMax = isNumber(query.maxResults) ? query.maxResults + 1 : Number.MAX_SAFE_INTEGER;
|
|
176
|
-
const uri = widget.viewModel.uri;
|
|
177
|
-
if (!pathIncludedInQuery(query, uri.fsPath)) {
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
let matches = await widget
|
|
181
|
-
.find(query.contentPattern.pattern, {
|
|
182
|
-
regex: query.contentPattern.isRegExp,
|
|
183
|
-
wholeWord: query.contentPattern.isWordMatch,
|
|
184
|
-
caseSensitive: query.contentPattern.isCaseSensitive,
|
|
185
|
-
includeMarkupInput: query.contentPattern.notebookInfo?.isInNotebookMarkdownInput ?? true,
|
|
186
|
-
includeMarkupPreview: query.contentPattern.notebookInfo?.isInNotebookMarkdownPreview ?? true,
|
|
187
|
-
includeCodeInput: query.contentPattern.notebookInfo?.isInNotebookCellInput ?? true,
|
|
188
|
-
includeOutput: query.contentPattern.notebookInfo?.isInNotebookCellOutput ?? true,
|
|
189
|
-
}, token, false, true, searchID);
|
|
190
|
-
if (matches.length) {
|
|
191
|
-
if (askMax && matches.length >= askMax) {
|
|
192
|
-
limitHit = true;
|
|
193
|
-
matches = matches.slice(0, askMax - 1);
|
|
194
|
-
}
|
|
195
|
-
const cellResults = ( matches.map(match => {
|
|
196
|
-
const contentResults = contentMatchesToTextSearchMatches(match.contentMatches, match.cell);
|
|
197
|
-
const webviewResults = webviewMatchesToTextSearchMatches(match.webviewMatches);
|
|
198
|
-
return {
|
|
199
|
-
cell: match.cell,
|
|
200
|
-
index: match.index,
|
|
201
|
-
contentResults: contentResults,
|
|
202
|
-
webviewResults: webviewResults,
|
|
203
|
-
};
|
|
204
|
-
}));
|
|
205
|
-
const fileMatch = {
|
|
206
|
-
resource: uri, cellResults: cellResults
|
|
207
|
-
};
|
|
208
|
-
localResults.set(uri, fileMatch);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
localResults.set(uri, null);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
results: localResults,
|
|
216
|
-
limitHit
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
getLocalNotebookWidgets() {
|
|
220
|
-
const notebookWidgets = this.notebookEditorService.retrieveAllExistingWidgets();
|
|
221
|
-
return ( notebookWidgets
|
|
222
|
-
.map(widget => widget.value))
|
|
223
|
-
.filter((val) => !!val && val.hasModel());
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
NotebookSearchService = ( __decorate([
|
|
227
|
-
( __param(0, IUriIdentityService)),
|
|
228
|
-
( __param(1, INotebookEditorService)),
|
|
229
|
-
( __param(2, ILogService)),
|
|
230
|
-
( __param(3, INotebookService)),
|
|
231
|
-
( __param(4, IConfigurationService)),
|
|
232
|
-
( __param(5, IEditorResolverService)),
|
|
233
|
-
( __param(6, ISearchService)),
|
|
234
|
-
( __param(7, IInstantiationService))
|
|
235
|
-
], NotebookSearchService));
|
|
236
|
-
|
|
237
|
-
export { NotebookSearchService };
|