@codingame/monaco-vscode-notebook-service-override 4.0.0 → 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 (77) hide show
  1. package/notebook.js +12 -12
  2. package/package.json +2 -2
  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 -10
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -391
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -544
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -101
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -120
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -60
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -150
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -656
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -517
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -652
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -721
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -315
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +0 -199
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -47
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -115
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -911
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -395
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -185
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1187
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -510
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  67. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -90
  68. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1002
  69. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  70. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -203
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  73. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  74. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -386
  75. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  76. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  77. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
@@ -1,103 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { isResourceDiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
3
- import { EditorModel } from 'vscode/vscode/vs/workbench/common/editor/editorModel';
4
- import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
5
- import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
6
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
7
-
8
- var NotebookDiffEditorInput_1;
9
- class NotebookDiffEditorModel extends EditorModel {
10
- constructor(original, modified) {
11
- super();
12
- this.original = original;
13
- this.modified = modified;
14
- }
15
- }
16
- let NotebookDiffEditorInput = class NotebookDiffEditorInput extends DiffEditorInput {
17
- static { NotebookDiffEditorInput_1 = this; }
18
- static create(instantiationService, resource, name, description, originalResource, viewType) {
19
- const original = NotebookEditorInput.getOrCreate(instantiationService, originalResource, undefined, viewType);
20
- const modified = NotebookEditorInput.getOrCreate(instantiationService, resource, undefined, viewType);
21
- return instantiationService.createInstance(NotebookDiffEditorInput_1, name, description, original, modified, viewType);
22
- }
23
- static { this.ID = 'workbench.input.diffNotebookInput'; }
24
- get resource() {
25
- return this.modified.resource;
26
- }
27
- get editorId() {
28
- return this.viewType;
29
- }
30
- constructor(name, description, original, modified, viewType, editorService) {
31
- super(name, description, original, modified, undefined, editorService);
32
- this.original = original;
33
- this.modified = modified;
34
- this.viewType = viewType;
35
- this._modifiedTextModel = null;
36
- this._originalTextModel = null;
37
- this._cachedModel = undefined;
38
- }
39
- get typeId() {
40
- return NotebookDiffEditorInput_1.ID;
41
- }
42
- async resolve() {
43
- const [originalEditorModel, modifiedEditorModel] = await Promise.all([
44
- this.original.resolve(),
45
- this.modified.resolve(),
46
- ]);
47
- this._cachedModel?.dispose();
48
- if (!modifiedEditorModel) {
49
- throw new Error(`Fail to resolve modified editor model for resource ${this.modified.resource} with notebookType ${this.viewType}`);
50
- }
51
- if (!originalEditorModel) {
52
- throw new Error(`Fail to resolve original editor model for resource ${this.original.resource} with notebookType ${this.viewType}`);
53
- }
54
- this._originalTextModel = originalEditorModel;
55
- this._modifiedTextModel = modifiedEditorModel;
56
- this._cachedModel = ( new NotebookDiffEditorModel(this._originalTextModel, this._modifiedTextModel));
57
- return this._cachedModel;
58
- }
59
- toUntyped() {
60
- const original = { resource: this.original.resource };
61
- const modified = { resource: this.resource };
62
- return {
63
- original,
64
- modified,
65
- primary: modified,
66
- secondary: original,
67
- options: {
68
- override: this.viewType
69
- }
70
- };
71
- }
72
- matches(otherInput) {
73
- if (this === otherInput) {
74
- return true;
75
- }
76
- if (otherInput instanceof NotebookDiffEditorInput_1) {
77
- return this.modified.matches(otherInput.modified)
78
- && this.original.matches(otherInput.original)
79
- && this.viewType === otherInput.viewType;
80
- }
81
- if (isResourceDiffEditorInput(otherInput)) {
82
- return this.modified.matches(otherInput.modified)
83
- && this.original.matches(otherInput.original)
84
- && this.editorId !== undefined
85
- && (this.editorId === otherInput.options?.override || otherInput.options?.override === undefined);
86
- }
87
- return false;
88
- }
89
- dispose() {
90
- super.dispose();
91
- this._cachedModel?.dispose();
92
- this._cachedModel = undefined;
93
- this.original.dispose();
94
- this.modified.dispose();
95
- this._originalTextModel = null;
96
- this._modifiedTextModel = null;
97
- }
98
- };
99
- NotebookDiffEditorInput = NotebookDiffEditorInput_1 = ( __decorate([
100
- ( __param(5, IEditorService))
101
- ], NotebookDiffEditorInput));
102
-
103
- export { NotebookDiffEditorInput };
@@ -1,203 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
3
- import { URI } from 'vscode/vscode/vs/base/common/uri';
4
- import { NotebookWorkingCopyTypeIdentifier, NotebookSetting, CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
5
- import { NotebookFileWorkingCopyModelFactory, SimpleNotebookEditorModel } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModel';
6
- import { ReferenceCollection, DisposableStore, dispose, combinedDisposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
- import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
8
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
9
- import { Emitter, AsyncEmitter } from 'vscode/vscode/vs/base/common/event';
10
- import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
11
- import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
12
- import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
13
- import { FileWorkingCopyManager } from '../../../services/workingCopy/common/fileWorkingCopyManager.js';
14
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
15
- import { NotebookProviderInfo } from './notebookProvider.js';
16
- import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
17
- import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
18
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
19
-
20
- let NotebookModelReferenceCollection = class NotebookModelReferenceCollection extends ReferenceCollection {
21
- constructor(_instantiationService, _notebookService, _logService, _configurationService) {
22
- super();
23
- this._instantiationService = _instantiationService;
24
- this._notebookService = _notebookService;
25
- this._logService = _logService;
26
- this._configurationService = _configurationService;
27
- this._disposables = ( new DisposableStore());
28
- this._workingCopyManagers = ( new Map());
29
- this._modelListener = ( new Map());
30
- this._onDidSaveNotebook = ( new Emitter());
31
- this.onDidSaveNotebook = this._onDidSaveNotebook.event;
32
- this._onDidChangeDirty = ( new Emitter());
33
- this.onDidChangeDirty = this._onDidChangeDirty.event;
34
- this._dirtyStates = ( new ResourceMap());
35
- this.modelsToDispose = ( new Set());
36
- }
37
- dispose() {
38
- this._disposables.dispose();
39
- this._onDidSaveNotebook.dispose();
40
- this._onDidChangeDirty.dispose();
41
- dispose(( this._modelListener.values()));
42
- dispose(( this._workingCopyManagers.values()));
43
- }
44
- isDirty(resource) {
45
- return this._dirtyStates.get(resource) ?? false;
46
- }
47
- async createReferencedObject(key, viewType, hasAssociatedFilePath, limits) {
48
- this.modelsToDispose.delete(key);
49
- const uri = ( URI.parse(key));
50
- const workingCopyTypeId = NotebookWorkingCopyTypeIdentifier.create(viewType);
51
- let workingCopyManager = this._workingCopyManagers.get(workingCopyTypeId);
52
- if (!workingCopyManager) {
53
- const factory = ( new NotebookFileWorkingCopyModelFactory(viewType, this._notebookService, this._configurationService));
54
- workingCopyManager = this._instantiationService.createInstance(FileWorkingCopyManager, workingCopyTypeId, factory, factory);
55
- this._workingCopyManagers.set(workingCopyTypeId, workingCopyManager);
56
- }
57
- const scratchPad = viewType === 'interactive' && this._configurationService.getValue(NotebookSetting.InteractiveWindowPromptToSave) !== true;
58
- const model = this._instantiationService.createInstance(SimpleNotebookEditorModel, uri, hasAssociatedFilePath, viewType, workingCopyManager, scratchPad);
59
- const result = await model.load({ limits });
60
- let onDirtyAutoReference;
61
- this._modelListener.set(result, combinedDisposable(result.onDidSave(() => this._onDidSaveNotebook.fire(result.resource)), result.onDidChangeDirty(() => {
62
- const isDirty = result.isDirty();
63
- this._dirtyStates.set(result.resource, isDirty);
64
- if (isDirty && !onDirtyAutoReference) {
65
- onDirtyAutoReference = this.acquire(key, viewType);
66
- }
67
- else if (onDirtyAutoReference) {
68
- onDirtyAutoReference.dispose();
69
- onDirtyAutoReference = undefined;
70
- }
71
- this._onDidChangeDirty.fire(result);
72
- }), toDisposable(() => onDirtyAutoReference?.dispose())));
73
- return result;
74
- }
75
- destroyReferencedObject(key, object) {
76
- this.modelsToDispose.add(key);
77
- (async () => {
78
- try {
79
- const model = await object;
80
- if (!( this.modelsToDispose.has(key))) {
81
- return;
82
- }
83
- if (model instanceof SimpleNotebookEditorModel) {
84
- await model.canDispose();
85
- }
86
- if (!( this.modelsToDispose.has(key))) {
87
- return;
88
- }
89
- this._modelListener.get(model)?.dispose();
90
- this._modelListener.delete(model);
91
- model.dispose();
92
- }
93
- catch (err) {
94
- this._logService.error('FAILED to destory notebook', err);
95
- }
96
- finally {
97
- this.modelsToDispose.delete(key);
98
- }
99
- })();
100
- }
101
- };
102
- NotebookModelReferenceCollection = ( __decorate([
103
- ( __param(0, IInstantiationService)),
104
- ( __param(1, INotebookService)),
105
- ( __param(2, ILogService)),
106
- ( __param(3, IConfigurationService))
107
- ], NotebookModelReferenceCollection));
108
- let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
109
- constructor(instantiationService, _notebookService, _extensionService, _uriIdentService) {
110
- this._notebookService = _notebookService;
111
- this._extensionService = _extensionService;
112
- this._uriIdentService = _uriIdentService;
113
- this._onWillFailWithConflict = ( new AsyncEmitter());
114
- this.onWillFailWithConflict = this._onWillFailWithConflict.event;
115
- this._data = instantiationService.createInstance(NotebookModelReferenceCollection);
116
- this.onDidSaveNotebook = this._data.onDidSaveNotebook;
117
- this.onDidChangeDirty = this._data.onDidChangeDirty;
118
- }
119
- dispose() {
120
- this._data.dispose();
121
- }
122
- isDirty(resource) {
123
- return this._data.isDirty(resource);
124
- }
125
- async resolve(arg0, viewType, limits) {
126
- let resource;
127
- let hasAssociatedFilePath = false;
128
- if (URI.isUri(arg0)) {
129
- resource = arg0;
130
- }
131
- else {
132
- if (!arg0.untitledResource) {
133
- const info = this._notebookService.getContributedNotebookType(assertIsDefined(viewType));
134
- if (!info) {
135
- throw new Error('UNKNOWN view type: ' + viewType);
136
- }
137
- const suffix = NotebookProviderInfo.possibleFileEnding(info.selectors) ?? '';
138
- for (let counter = 1;; counter++) {
139
- const candidate = ( URI.from(
140
- { scheme: Schemas.untitled, path: `Untitled-${counter}${suffix}`, query: viewType }
141
- ));
142
- if (!this._notebookService.getNotebookTextModel(candidate)) {
143
- resource = candidate;
144
- break;
145
- }
146
- }
147
- }
148
- else if (arg0.untitledResource.scheme === Schemas.untitled) {
149
- resource = arg0.untitledResource;
150
- }
151
- else {
152
- resource = arg0.untitledResource.with({ scheme: Schemas.untitled });
153
- hasAssociatedFilePath = true;
154
- }
155
- }
156
- if (resource.scheme === CellUri.scheme) {
157
- throw new Error(`CANNOT open a cell-uri as notebook. Tried with ${resource.toString()}`);
158
- }
159
- resource = this._uriIdentService.asCanonicalUri(resource);
160
- const existingViewType = this._notebookService.getNotebookTextModel(resource)?.viewType;
161
- if (!viewType) {
162
- if (existingViewType) {
163
- viewType = existingViewType;
164
- }
165
- else {
166
- await this._extensionService.whenInstalledExtensionsRegistered();
167
- const providers = this._notebookService.getContributedNotebookTypes(resource);
168
- const exclusiveProvider = providers.find(provider => provider.exclusive);
169
- viewType = exclusiveProvider?.id || providers[0]?.id;
170
- }
171
- }
172
- if (!viewType) {
173
- throw new Error(`Missing viewType for '${resource}'`);
174
- }
175
- if (existingViewType && existingViewType !== viewType) {
176
- await this._onWillFailWithConflict.fireAsync({ resource, viewType }, CancellationToken.None);
177
- const existingViewType2 = this._notebookService.getNotebookTextModel(resource)?.viewType;
178
- if (existingViewType2 && existingViewType2 !== viewType) {
179
- throw new Error(`A notebook with view type '${existingViewType2}' already exists for '${resource}', CANNOT create another notebook with view type ${viewType}`);
180
- }
181
- }
182
- const reference = this._data.acquire(( resource.toString()), viewType, hasAssociatedFilePath, limits);
183
- try {
184
- const model = await reference.object;
185
- return {
186
- object: model,
187
- dispose() { reference.dispose(); }
188
- };
189
- }
190
- catch (err) {
191
- reference.dispose();
192
- throw err;
193
- }
194
- }
195
- };
196
- NotebookModelResolverServiceImpl = ( __decorate([
197
- ( __param(0, IInstantiationService)),
198
- ( __param(1, INotebookService)),
199
- ( __param(2, IExtensionService)),
200
- ( __param(3, IUriIdentityService))
201
- ], NotebookModelResolverServiceImpl));
202
-
203
- export { NotebookModelResolverServiceImpl };
@@ -1,80 +0,0 @@
1
- import { parse } from 'vscode/vscode/vs/base/common/glob';
2
- import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
3
- import { joinPath } from 'vscode/vscode/vs/base/common/resources';
4
-
5
- class DependencyList {
6
- constructor(value) {
7
- this.value = ( new Set(value));
8
- this.defined = this.value.size > 0;
9
- }
10
- matches(available) {
11
- return ( available.some(v => ( this.value.has(v))));
12
- }
13
- }
14
- class NotebookOutputRendererInfo {
15
- constructor(descriptor) {
16
- this.id = descriptor.id;
17
- this.extensionId = descriptor.extension.identifier;
18
- this.extensionLocation = descriptor.extension.extensionLocation;
19
- this.isBuiltin = descriptor.extension.isBuiltin;
20
- if (typeof descriptor.entrypoint === 'string') {
21
- this.entrypoint = {
22
- extends: undefined,
23
- path: joinPath(this.extensionLocation, descriptor.entrypoint)
24
- };
25
- }
26
- else {
27
- this.entrypoint = {
28
- extends: descriptor.entrypoint.extends,
29
- path: joinPath(this.extensionLocation, descriptor.entrypoint.path)
30
- };
31
- }
32
- this.displayName = descriptor.displayName;
33
- this.mimeTypes = descriptor.mimeTypes;
34
- this.mimeTypeGlobs = ( this.mimeTypes.map(pattern => parse(pattern)));
35
- this.hardDependencies = ( new DependencyList(descriptor.dependencies ?? Iterable.empty()));
36
- this.optionalDependencies = ( new DependencyList(descriptor.optionalDependencies ?? Iterable.empty()));
37
- this.messaging = descriptor.requiresMessaging ?? "never" ;
38
- }
39
- matchesWithoutKernel(mimeType) {
40
- if (!this.matchesMimeTypeOnly(mimeType)) {
41
- return 3 ;
42
- }
43
- if (this.hardDependencies.defined) {
44
- return 0 ;
45
- }
46
- if (this.optionalDependencies.defined) {
47
- return 1 ;
48
- }
49
- return 2 ;
50
- }
51
- matches(mimeType, kernelProvides) {
52
- if (!this.matchesMimeTypeOnly(mimeType)) {
53
- return 3 ;
54
- }
55
- if (this.hardDependencies.defined) {
56
- return this.hardDependencies.matches(kernelProvides)
57
- ? 0
58
- : 3 ;
59
- }
60
- return this.optionalDependencies.matches(kernelProvides)
61
- ? 1
62
- : 2 ;
63
- }
64
- matchesMimeTypeOnly(mimeType) {
65
- if (this.entrypoint.extends) {
66
- return false;
67
- }
68
- return ( this.mimeTypeGlobs.some(pattern => pattern(mimeType))) || ( this.mimeTypes.some(pattern => pattern === mimeType));
69
- }
70
- }
71
- class NotebookStaticPreloadInfo {
72
- constructor(descriptor) {
73
- this.type = descriptor.type;
74
- this.entrypoint = joinPath(descriptor.extension.extensionLocation, descriptor.entrypoint);
75
- this.extensionLocation = descriptor.extension.extensionLocation;
76
- this.localResourceRoots = ( descriptor.localResourceRoots.map(root => joinPath(descriptor.extension.extensionLocation, root)));
77
- }
78
- }
79
-
80
- export { NotebookOutputRendererInfo, NotebookStaticPreloadInfo };
@@ -1,98 +0,0 @@
1
- import { match, isRelativePattern } from 'vscode/vscode/vs/base/common/glob';
2
- import { basename } from 'vscode/vscode/vs/base/common/path';
3
- import { isDocumentExcludePattern } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
4
-
5
- class NotebookProviderInfo {
6
- get selectors() {
7
- return this._selectors;
8
- }
9
- get options() {
10
- return this._options;
11
- }
12
- constructor(descriptor) {
13
- this.extension = descriptor.extension;
14
- this.id = descriptor.id;
15
- this.displayName = descriptor.displayName;
16
- this._selectors = descriptor.selectors?.map(selector => ({
17
- include: selector.filenamePattern,
18
- exclude: selector.excludeFileNamePattern || ''
19
- })) || [];
20
- this.priority = descriptor.priority;
21
- this.providerDisplayName = descriptor.providerDisplayName;
22
- this.exclusive = descriptor.exclusive;
23
- this._options = {
24
- transientCellMetadata: {},
25
- transientDocumentMetadata: {},
26
- transientOutputs: false,
27
- cellContentMetadata: {}
28
- };
29
- }
30
- update(args) {
31
- if (args.selectors) {
32
- this._selectors = args.selectors;
33
- }
34
- if (args.options) {
35
- this._options = args.options;
36
- }
37
- }
38
- matches(resource) {
39
- return this.selectors?.some(selector => NotebookProviderInfo.selectorMatches(selector, resource));
40
- }
41
- static selectorMatches(selector, resource) {
42
- if (typeof selector === 'string') {
43
- if (match(selector.toLowerCase(), basename(resource.fsPath).toLowerCase())) {
44
- return true;
45
- }
46
- }
47
- if (isRelativePattern(selector)) {
48
- if (match(selector, basename(resource.fsPath).toLowerCase())) {
49
- return true;
50
- }
51
- }
52
- if (!isDocumentExcludePattern(selector)) {
53
- return false;
54
- }
55
- const filenamePattern = selector.include;
56
- const excludeFilenamePattern = selector.exclude;
57
- if (match(filenamePattern, basename(resource.fsPath).toLowerCase())) {
58
- if (excludeFilenamePattern) {
59
- if (match(excludeFilenamePattern, basename(resource.fsPath).toLowerCase())) {
60
- return false;
61
- }
62
- }
63
- return true;
64
- }
65
- return false;
66
- }
67
- static possibleFileEnding(selectors) {
68
- for (const selector of selectors) {
69
- const ending = NotebookProviderInfo._possibleFileEnding(selector);
70
- if (ending) {
71
- return ending;
72
- }
73
- }
74
- return undefined;
75
- }
76
- static _possibleFileEnding(selector) {
77
- const pattern = /^.*(\.[a-zA-Z0-9_-]+)$/;
78
- let candidate;
79
- if (typeof selector === 'string') {
80
- candidate = selector;
81
- }
82
- else if (isRelativePattern(selector)) {
83
- candidate = selector.pattern;
84
- }
85
- else if (selector.include) {
86
- return NotebookProviderInfo._possibleFileEnding(selector.include);
87
- }
88
- if (candidate) {
89
- const match = pattern.exec(candidate);
90
- if (match) {
91
- return match[1];
92
- }
93
- }
94
- return undefined;
95
- }
96
- }
97
-
98
- export { NotebookProviderInfo };
@@ -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 };