@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.
Files changed (80) hide show
  1. package/notebook.js +13 -13
  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 -8
  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 -389
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -488
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -91
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -118
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -59
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -148
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -383
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -511
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -565
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -707
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -267
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -45
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -108
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -890
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -393
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -175
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1174
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -509
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  69. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -80
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1003
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -202
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  75. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
  76. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  77. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -376
  78. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  79. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  80. 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,202 +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, 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 model = this._instantiationService.createInstance(SimpleNotebookEditorModel, uri, hasAssociatedFilePath, viewType, workingCopyManager);
58
- const result = await model.load({ limits });
59
- let onDirtyAutoReference;
60
- this._modelListener.set(result, combinedDisposable(result.onDidSave(() => this._onDidSaveNotebook.fire(result.resource)), result.onDidChangeDirty(() => {
61
- const isDirty = result.isDirty();
62
- this._dirtyStates.set(result.resource, isDirty);
63
- if (isDirty && !onDirtyAutoReference) {
64
- onDirtyAutoReference = this.acquire(key, viewType);
65
- }
66
- else if (onDirtyAutoReference) {
67
- onDirtyAutoReference.dispose();
68
- onDirtyAutoReference = undefined;
69
- }
70
- this._onDidChangeDirty.fire(result);
71
- }), toDisposable(() => onDirtyAutoReference?.dispose())));
72
- return result;
73
- }
74
- destroyReferencedObject(key, object) {
75
- this.modelsToDispose.add(key);
76
- (async () => {
77
- try {
78
- const model = await object;
79
- if (!( this.modelsToDispose.has(key))) {
80
- return;
81
- }
82
- if (model instanceof SimpleNotebookEditorModel) {
83
- await model.canDispose();
84
- }
85
- if (!( this.modelsToDispose.has(key))) {
86
- return;
87
- }
88
- this._modelListener.get(model)?.dispose();
89
- this._modelListener.delete(model);
90
- model.dispose();
91
- }
92
- catch (err) {
93
- this._logService.error('FAILED to destory notebook', err);
94
- }
95
- finally {
96
- this.modelsToDispose.delete(key);
97
- }
98
- })();
99
- }
100
- };
101
- NotebookModelReferenceCollection = ( __decorate([
102
- ( __param(0, IInstantiationService)),
103
- ( __param(1, INotebookService)),
104
- ( __param(2, ILogService)),
105
- ( __param(3, IConfigurationService))
106
- ], NotebookModelReferenceCollection));
107
- let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
108
- constructor(instantiationService, _notebookService, _extensionService, _uriIdentService) {
109
- this._notebookService = _notebookService;
110
- this._extensionService = _extensionService;
111
- this._uriIdentService = _uriIdentService;
112
- this._onWillFailWithConflict = ( new AsyncEmitter());
113
- this.onWillFailWithConflict = this._onWillFailWithConflict.event;
114
- this._data = instantiationService.createInstance(NotebookModelReferenceCollection);
115
- this.onDidSaveNotebook = this._data.onDidSaveNotebook;
116
- this.onDidChangeDirty = this._data.onDidChangeDirty;
117
- }
118
- dispose() {
119
- this._data.dispose();
120
- }
121
- isDirty(resource) {
122
- return this._data.isDirty(resource);
123
- }
124
- async resolve(arg0, viewType, limits) {
125
- let resource;
126
- let hasAssociatedFilePath = false;
127
- if (URI.isUri(arg0)) {
128
- resource = arg0;
129
- }
130
- else {
131
- if (!arg0.untitledResource) {
132
- const info = this._notebookService.getContributedNotebookType(assertIsDefined(viewType));
133
- if (!info) {
134
- throw new Error('UNKNOWN view type: ' + viewType);
135
- }
136
- const suffix = NotebookProviderInfo.possibleFileEnding(info.selectors) ?? '';
137
- for (let counter = 1;; counter++) {
138
- const candidate = ( URI.from(
139
- { scheme: Schemas.untitled, path: `Untitled-${counter}${suffix}`, query: viewType }
140
- ));
141
- if (!this._notebookService.getNotebookTextModel(candidate)) {
142
- resource = candidate;
143
- break;
144
- }
145
- }
146
- }
147
- else if (arg0.untitledResource.scheme === Schemas.untitled) {
148
- resource = arg0.untitledResource;
149
- }
150
- else {
151
- resource = arg0.untitledResource.with({ scheme: Schemas.untitled });
152
- hasAssociatedFilePath = true;
153
- }
154
- }
155
- if (resource.scheme === CellUri.scheme) {
156
- throw new Error(`CANNOT open a cell-uri as notebook. Tried with ${resource.toString()}`);
157
- }
158
- resource = this._uriIdentService.asCanonicalUri(resource);
159
- const existingViewType = this._notebookService.getNotebookTextModel(resource)?.viewType;
160
- if (!viewType) {
161
- if (existingViewType) {
162
- viewType = existingViewType;
163
- }
164
- else {
165
- await this._extensionService.whenInstalledExtensionsRegistered();
166
- const providers = this._notebookService.getContributedNotebookTypes(resource);
167
- const exclusiveProvider = providers.find(provider => provider.exclusive);
168
- viewType = exclusiveProvider?.id || providers[0]?.id;
169
- }
170
- }
171
- if (!viewType) {
172
- throw new Error(`Missing viewType for '${resource}'`);
173
- }
174
- if (existingViewType && existingViewType !== viewType) {
175
- await this._onWillFailWithConflict.fireAsync({ resource, viewType }, CancellationToken.None);
176
- const existingViewType2 = this._notebookService.getNotebookTextModel(resource)?.viewType;
177
- if (existingViewType2 && existingViewType2 !== viewType) {
178
- throw new Error(`A notebook with view type '${existingViewType2}' already exists for '${resource}', CANNOT create another notebook with view type ${viewType}`);
179
- }
180
- }
181
- const reference = this._data.acquire(( resource.toString()), viewType, hasAssociatedFilePath, limits);
182
- try {
183
- const model = await reference.object;
184
- return {
185
- object: model,
186
- dispose() { reference.dispose(); }
187
- };
188
- }
189
- catch (err) {
190
- reference.dispose();
191
- throw err;
192
- }
193
- }
194
- };
195
- NotebookModelResolverServiceImpl = ( __decorate([
196
- ( __param(0, IInstantiationService)),
197
- ( __param(1, INotebookService)),
198
- ( __param(2, IExtensionService)),
199
- ( __param(3, IUriIdentityService))
200
- ], NotebookModelResolverServiceImpl));
201
-
202
- 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 };