@codingame/monaco-vscode-notebook-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/notebook.js +13 -13
- package/package.json +2 -2
- 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/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -389
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -488
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -91
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -118
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -59
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -148
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -383
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -511
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -565
- 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/notebook/browser/controller/executeActions.js +0 -707
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -267
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -45
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -108
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -890
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -393
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -175
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1174
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -509
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -80
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1003
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -202
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -376
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
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 };
|
package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
-
import { Disposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
-
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
5
|
-
import { Promises } from 'vscode/vscode/vs/base/common/async';
|
|
6
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
7
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
8
|
-
import { IWorkingCopyBackupService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup';
|
|
9
|
-
|
|
10
|
-
let BaseFileWorkingCopyManager = class BaseFileWorkingCopyManager extends Disposable {
|
|
11
|
-
constructor(fileService, logService, workingCopyBackupService) {
|
|
12
|
-
super();
|
|
13
|
-
this.fileService = fileService;
|
|
14
|
-
this.logService = logService;
|
|
15
|
-
this.workingCopyBackupService = workingCopyBackupService;
|
|
16
|
-
this._onDidCreate = this._register(( new Emitter()));
|
|
17
|
-
this.onDidCreate = this._onDidCreate.event;
|
|
18
|
-
this.mapResourceToWorkingCopy = ( new ResourceMap());
|
|
19
|
-
this.mapResourceToDisposeListener = ( new ResourceMap());
|
|
20
|
-
}
|
|
21
|
-
has(resource) {
|
|
22
|
-
return ( this.mapResourceToWorkingCopy.has(resource));
|
|
23
|
-
}
|
|
24
|
-
add(resource, workingCopy) {
|
|
25
|
-
const knownWorkingCopy = this.get(resource);
|
|
26
|
-
if (knownWorkingCopy === workingCopy) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
this.mapResourceToWorkingCopy.set(resource, workingCopy);
|
|
30
|
-
this.mapResourceToDisposeListener.get(resource)?.dispose();
|
|
31
|
-
this.mapResourceToDisposeListener.set(resource, workingCopy.onWillDispose(() => this.remove(resource)));
|
|
32
|
-
this._onDidCreate.fire(workingCopy);
|
|
33
|
-
}
|
|
34
|
-
remove(resource) {
|
|
35
|
-
const disposeListener = this.mapResourceToDisposeListener.get(resource);
|
|
36
|
-
if (disposeListener) {
|
|
37
|
-
dispose(disposeListener);
|
|
38
|
-
this.mapResourceToDisposeListener.delete(resource);
|
|
39
|
-
}
|
|
40
|
-
return this.mapResourceToWorkingCopy.delete(resource);
|
|
41
|
-
}
|
|
42
|
-
get workingCopies() {
|
|
43
|
-
return [...( this.mapResourceToWorkingCopy.values())];
|
|
44
|
-
}
|
|
45
|
-
get(resource) {
|
|
46
|
-
return this.mapResourceToWorkingCopy.get(resource);
|
|
47
|
-
}
|
|
48
|
-
dispose() {
|
|
49
|
-
super.dispose();
|
|
50
|
-
this.mapResourceToWorkingCopy.clear();
|
|
51
|
-
dispose(( this.mapResourceToDisposeListener.values()));
|
|
52
|
-
this.mapResourceToDisposeListener.clear();
|
|
53
|
-
}
|
|
54
|
-
async destroy() {
|
|
55
|
-
try {
|
|
56
|
-
await Promises.settled(( this.workingCopies.map(async (workingCopy) => {
|
|
57
|
-
if (workingCopy.isDirty()) {
|
|
58
|
-
await this.saveWithFallback(workingCopy);
|
|
59
|
-
}
|
|
60
|
-
})));
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
this.logService.error(error);
|
|
64
|
-
}
|
|
65
|
-
dispose(( this.mapResourceToWorkingCopy.values()));
|
|
66
|
-
this.dispose();
|
|
67
|
-
}
|
|
68
|
-
async saveWithFallback(workingCopy) {
|
|
69
|
-
let saveSuccess = false;
|
|
70
|
-
try {
|
|
71
|
-
saveSuccess = await workingCopy.save();
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
}
|
|
75
|
-
if (!saveSuccess || workingCopy.isDirty()) {
|
|
76
|
-
const backup = await this.workingCopyBackupService.resolve(workingCopy);
|
|
77
|
-
if (backup) {
|
|
78
|
-
await this.fileService.writeFile(workingCopy.resource, backup.value, { unlock: true });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
BaseFileWorkingCopyManager = ( __decorate([
|
|
84
|
-
( __param(0, IFileService)),
|
|
85
|
-
( __param(1, ILogService)),
|
|
86
|
-
( __param(2, IWorkingCopyBackupService))
|
|
87
|
-
], BaseFileWorkingCopyManager));
|
|
88
|
-
|
|
89
|
-
export { BaseFileWorkingCopyManager };
|