@theia/notebook 1.53.0-next.5 → 1.53.0-next.55

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 (88) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/contributions/notebook-actions-contribution.d.ts +1 -0
  3. package/lib/browser/contributions/notebook-actions-contribution.d.ts.map +1 -1
  4. package/lib/browser/contributions/notebook-actions-contribution.js +31 -5
  5. package/lib/browser/contributions/notebook-actions-contribution.js.map +1 -1
  6. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts +2 -0
  7. package/lib/browser/contributions/notebook-cell-actions-contribution.d.ts.map +1 -1
  8. package/lib/browser/contributions/notebook-cell-actions-contribution.js +41 -7
  9. package/lib/browser/contributions/notebook-cell-actions-contribution.js.map +1 -1
  10. package/lib/browser/contributions/notebook-status-bar-contribution.d.ts +14 -0
  11. package/lib/browser/contributions/notebook-status-bar-contribution.d.ts.map +1 -0
  12. package/lib/browser/contributions/notebook-status-bar-contribution.js +75 -0
  13. package/lib/browser/contributions/notebook-status-bar-contribution.js.map +1 -0
  14. package/lib/browser/notebook-editor-widget.d.ts.map +1 -1
  15. package/lib/browser/notebook-editor-widget.js +3 -5
  16. package/lib/browser/notebook-editor-widget.js.map +1 -1
  17. package/lib/browser/notebook-frontend-module.d.ts.map +1 -1
  18. package/lib/browser/notebook-frontend-module.js +3 -0
  19. package/lib/browser/notebook-frontend-module.js.map +1 -1
  20. package/lib/browser/notebook-open-handler.d.ts +3 -2
  21. package/lib/browser/notebook-open-handler.d.ts.map +1 -1
  22. package/lib/browser/notebook-open-handler.js +12 -5
  23. package/lib/browser/notebook-open-handler.js.map +1 -1
  24. package/lib/browser/view/notebook-cell-editor.d.ts +1 -0
  25. package/lib/browser/view/notebook-cell-editor.d.ts.map +1 -1
  26. package/lib/browser/view/notebook-cell-editor.js +30 -16
  27. package/lib/browser/view/notebook-cell-editor.js.map +1 -1
  28. package/lib/browser/view/notebook-cell-list-view.d.ts +6 -4
  29. package/lib/browser/view/notebook-cell-list-view.d.ts.map +1 -1
  30. package/lib/browser/view/notebook-cell-list-view.js +20 -13
  31. package/lib/browser/view/notebook-cell-list-view.js.map +1 -1
  32. package/lib/browser/view-model/notebook-cell-model.d.ts +3 -0
  33. package/lib/browser/view-model/notebook-cell-model.d.ts.map +1 -1
  34. package/lib/browser/view-model/notebook-cell-model.js +5 -0
  35. package/lib/browser/view-model/notebook-cell-model.js.map +1 -1
  36. package/package.json +8 -8
  37. package/src/browser/contributions/cell-operations.ts +44 -44
  38. package/src/browser/contributions/notebook-actions-contribution.ts +379 -350
  39. package/src/browser/contributions/notebook-cell-actions-contribution.ts +525 -487
  40. package/src/browser/contributions/notebook-color-contribution.ts +268 -268
  41. package/src/browser/contributions/notebook-context-keys.ts +113 -113
  42. package/src/browser/contributions/notebook-label-provider-contribution.ts +85 -85
  43. package/src/browser/contributions/notebook-outline-contribution.ts +114 -114
  44. package/src/browser/contributions/notebook-output-action-contribution.ts +82 -82
  45. package/src/browser/contributions/notebook-preferences.ts +92 -92
  46. package/src/browser/contributions/notebook-status-bar-contribution.ts +77 -0
  47. package/src/browser/contributions/notebook-undo-redo-handler.ts +41 -41
  48. package/src/browser/index.ts +27 -27
  49. package/src/browser/notebook-cell-resource-resolver.ts +130 -130
  50. package/src/browser/notebook-editor-widget-factory.ts +82 -82
  51. package/src/browser/notebook-editor-widget.tsx +330 -331
  52. package/src/browser/notebook-frontend-module.ts +119 -115
  53. package/src/browser/notebook-open-handler.ts +120 -114
  54. package/src/browser/notebook-output-utils.ts +119 -119
  55. package/src/browser/notebook-renderer-registry.ts +85 -85
  56. package/src/browser/notebook-type-registry.ts +54 -54
  57. package/src/browser/notebook-types.ts +186 -186
  58. package/src/browser/renderers/cell-output-webview.ts +33 -33
  59. package/src/browser/service/notebook-clipboard-service.ts +43 -43
  60. package/src/browser/service/notebook-context-manager.ts +162 -162
  61. package/src/browser/service/notebook-editor-widget-service.ts +101 -101
  62. package/src/browser/service/notebook-execution-service.ts +139 -139
  63. package/src/browser/service/notebook-execution-state-service.ts +311 -311
  64. package/src/browser/service/notebook-kernel-history-service.ts +124 -124
  65. package/src/browser/service/notebook-kernel-quick-pick-service.ts +479 -479
  66. package/src/browser/service/notebook-kernel-service.ts +357 -357
  67. package/src/browser/service/notebook-model-resolver-service.ts +160 -160
  68. package/src/browser/service/notebook-monaco-text-model-service.ts +48 -48
  69. package/src/browser/service/notebook-options.ts +155 -155
  70. package/src/browser/service/notebook-renderer-messaging-service.ts +121 -121
  71. package/src/browser/service/notebook-service.ts +215 -215
  72. package/src/browser/style/index.css +483 -471
  73. package/src/browser/view/notebook-cell-editor.tsx +263 -247
  74. package/src/browser/view/notebook-cell-list-view.tsx +279 -262
  75. package/src/browser/view/notebook-cell-toolbar-factory.tsx +102 -102
  76. package/src/browser/view/notebook-cell-toolbar.tsx +74 -74
  77. package/src/browser/view/notebook-code-cell-view.tsx +350 -350
  78. package/src/browser/view/notebook-find-widget.tsx +335 -335
  79. package/src/browser/view/notebook-main-toolbar.tsx +235 -235
  80. package/src/browser/view/notebook-markdown-cell-view.tsx +208 -208
  81. package/src/browser/view/notebook-viewport-service.ts +61 -61
  82. package/src/browser/view-model/notebook-cell-model.ts +473 -466
  83. package/src/browser/view-model/notebook-cell-output-model.ts +100 -100
  84. package/src/browser/view-model/notebook-model.ts +550 -550
  85. package/src/common/index.ts +18 -18
  86. package/src/common/notebook-common.ts +337 -337
  87. package/src/common/notebook-protocol.ts +35 -35
  88. package/src/common/notebook-range.ts +30 -30
@@ -1,160 +1,160 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2023 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { Emitter, Resource, ResourceProvider, UNTITLED_SCHEME, URI } from '@theia/core';
18
- import { inject, injectable } from '@theia/core/shared/inversify';
19
- import { UriComponents } from '@theia/core/lib/common/uri';
20
- import { FileService } from '@theia/filesystem/lib/browser/file-service';
21
- import { NotebookData } from '../../common';
22
- import { NotebookModel } from '../view-model/notebook-model';
23
- import { NotebookService } from './notebook-service';
24
- import { NotebookTypeRegistry } from '../notebook-type-registry';
25
- import { NotebookFileSelector } from '../../common/notebook-protocol';
26
- import { match } from '@theia/core/lib/common/glob';
27
-
28
- export interface UntitledResource {
29
- untitledResource: URI | undefined
30
- }
31
-
32
- @injectable()
33
- export class NotebookModelResolverService {
34
-
35
- @inject(FileService)
36
- protected fileService: FileService;
37
-
38
- @inject(ResourceProvider)
39
- protected resourceProvider: ResourceProvider;
40
-
41
- @inject(NotebookService)
42
- protected notebookService: NotebookService;
43
-
44
- @inject(NotebookTypeRegistry)
45
- protected notebookTypeRegistry: NotebookTypeRegistry;
46
-
47
- protected onDidChangeDirtyEmitter = new Emitter<NotebookModel>();
48
- readonly onDidChangeDirty = this.onDidChangeDirtyEmitter.event;
49
- protected onDidSaveNotebookEmitter = new Emitter<UriComponents>();
50
- readonly onDidSaveNotebook = this.onDidSaveNotebookEmitter.event;
51
-
52
- async resolve(resource: URI, viewType?: string): Promise<NotebookModel> {
53
- const existingModel = this.notebookService.getNotebookEditorModel(resource);
54
- if (!viewType) {
55
- if (existingModel) {
56
- return existingModel;
57
- } else {
58
- viewType = this.findViewTypeForResource(resource);
59
- }
60
- } else if (existingModel?.viewType === viewType) {
61
- return existingModel;
62
- }
63
-
64
- if (!viewType) {
65
- throw new Error(`Missing viewType for '${resource}'`);
66
- }
67
-
68
- const actualResource = await this.resourceProvider(resource);
69
- const notebookData = await this.resolveExistingNotebookData(actualResource, viewType!);
70
- const notebookModel = await this.notebookService.createNotebookModel(notebookData, viewType, actualResource);
71
-
72
- notebookModel.onDirtyChanged(() => this.onDidChangeDirtyEmitter.fire(notebookModel));
73
- notebookModel.onDidSaveNotebook(() => this.onDidSaveNotebookEmitter.fire(notebookModel.uri.toComponents()));
74
-
75
- return notebookModel;
76
- }
77
-
78
- async resolveUntitledResource(arg: UntitledResource, viewType: string): Promise<NotebookModel> {
79
- let resource: URI;
80
- // let hasAssociatedFilePath = false;
81
- arg = arg as UntitledResource;
82
- if (!arg.untitledResource) {
83
- const notebookTypeInfo = this.notebookTypeRegistry.notebookTypes.find(info => info.type === viewType);
84
- if (!notebookTypeInfo) {
85
- throw new Error('UNKNOWN view type: ' + viewType);
86
- }
87
-
88
- const suffix = this.getPossibleFileEnding(notebookTypeInfo.selector ?? []) ?? '';
89
- for (let counter = 1; ; counter++) {
90
- const candidate = new URI()
91
- .withScheme(UNTITLED_SCHEME)
92
- .withPath(`Untitled-notebook-${counter}${suffix}`)
93
- .withQuery(viewType);
94
- if (!this.notebookService.getNotebookEditorModel(candidate)) {
95
- resource = candidate;
96
- break;
97
- }
98
- }
99
- } else if (arg.untitledResource.scheme === UNTITLED_SCHEME) {
100
- resource = arg.untitledResource;
101
- } else {
102
- throw new Error('Invalid untitled resource: ' + arg.untitledResource.toString() + ' untitled resources with associated file path are not supported yet');
103
- // TODO implement associated file path support
104
- // resource = arg.untitledResource.withScheme('untitled');
105
- // hasAssociatedFilePath = true;
106
- }
107
-
108
- return this.resolve(resource, viewType);
109
- }
110
-
111
- async resolveExistingNotebookData(resource: Resource, viewType: string): Promise<NotebookData> {
112
- if (resource.uri.scheme === 'untitled') {
113
- return {
114
- cells: [],
115
- metadata: {}
116
- };
117
- } else {
118
- const [dataProvider, contents] = await Promise.all([
119
- this.notebookService.getNotebookDataProvider(viewType),
120
- this.fileService.readFile(resource.uri)
121
- ]);
122
- const notebook = await dataProvider.serializer.toNotebook(contents.value);
123
-
124
- return notebook;
125
- }
126
- }
127
-
128
- protected getPossibleFileEnding(selectors: readonly NotebookFileSelector[]): string | undefined {
129
- for (const selector of selectors) {
130
- const ending = this.possibleFileEnding(selector);
131
- if (ending) {
132
- return ending;
133
- }
134
- }
135
- return undefined;
136
- }
137
-
138
- protected possibleFileEnding(selector: NotebookFileSelector): string | undefined {
139
-
140
- const pattern = /^.*(\.[a-zA-Z0-9_-]+)$/;
141
-
142
- const candidate = typeof selector === 'string' ? selector : selector.filenamePattern;
143
-
144
- if (candidate) {
145
- const matches = pattern.exec(candidate);
146
- if (matches) {
147
- return matches[1];
148
- }
149
- }
150
-
151
- return undefined;
152
- }
153
-
154
- protected findViewTypeForResource(resource: URI): string | undefined {
155
- return this.notebookTypeRegistry.notebookTypes.find(info =>
156
- info.selector?.some(selector => selector.filenamePattern && match(selector.filenamePattern, resource.path.name + resource.path.ext))
157
- )?.type;
158
- }
159
-
160
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Emitter, Resource, ResourceProvider, UNTITLED_SCHEME, URI } from '@theia/core';
18
+ import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { UriComponents } from '@theia/core/lib/common/uri';
20
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
21
+ import { NotebookData } from '../../common';
22
+ import { NotebookModel } from '../view-model/notebook-model';
23
+ import { NotebookService } from './notebook-service';
24
+ import { NotebookTypeRegistry } from '../notebook-type-registry';
25
+ import { NotebookFileSelector } from '../../common/notebook-protocol';
26
+ import { match } from '@theia/core/lib/common/glob';
27
+
28
+ export interface UntitledResource {
29
+ untitledResource: URI | undefined
30
+ }
31
+
32
+ @injectable()
33
+ export class NotebookModelResolverService {
34
+
35
+ @inject(FileService)
36
+ protected fileService: FileService;
37
+
38
+ @inject(ResourceProvider)
39
+ protected resourceProvider: ResourceProvider;
40
+
41
+ @inject(NotebookService)
42
+ protected notebookService: NotebookService;
43
+
44
+ @inject(NotebookTypeRegistry)
45
+ protected notebookTypeRegistry: NotebookTypeRegistry;
46
+
47
+ protected onDidChangeDirtyEmitter = new Emitter<NotebookModel>();
48
+ readonly onDidChangeDirty = this.onDidChangeDirtyEmitter.event;
49
+ protected onDidSaveNotebookEmitter = new Emitter<UriComponents>();
50
+ readonly onDidSaveNotebook = this.onDidSaveNotebookEmitter.event;
51
+
52
+ async resolve(resource: URI, viewType?: string): Promise<NotebookModel> {
53
+ const existingModel = this.notebookService.getNotebookEditorModel(resource);
54
+ if (!viewType) {
55
+ if (existingModel) {
56
+ return existingModel;
57
+ } else {
58
+ viewType = this.findViewTypeForResource(resource);
59
+ }
60
+ } else if (existingModel?.viewType === viewType) {
61
+ return existingModel;
62
+ }
63
+
64
+ if (!viewType) {
65
+ throw new Error(`Missing viewType for '${resource}'`);
66
+ }
67
+
68
+ const actualResource = await this.resourceProvider(resource);
69
+ const notebookData = await this.resolveExistingNotebookData(actualResource, viewType!);
70
+ const notebookModel = await this.notebookService.createNotebookModel(notebookData, viewType, actualResource);
71
+
72
+ notebookModel.onDirtyChanged(() => this.onDidChangeDirtyEmitter.fire(notebookModel));
73
+ notebookModel.onDidSaveNotebook(() => this.onDidSaveNotebookEmitter.fire(notebookModel.uri.toComponents()));
74
+
75
+ return notebookModel;
76
+ }
77
+
78
+ async resolveUntitledResource(arg: UntitledResource, viewType: string): Promise<NotebookModel> {
79
+ let resource: URI;
80
+ // let hasAssociatedFilePath = false;
81
+ arg = arg as UntitledResource;
82
+ if (!arg.untitledResource) {
83
+ const notebookTypeInfo = this.notebookTypeRegistry.notebookTypes.find(info => info.type === viewType);
84
+ if (!notebookTypeInfo) {
85
+ throw new Error('UNKNOWN view type: ' + viewType);
86
+ }
87
+
88
+ const suffix = this.getPossibleFileEnding(notebookTypeInfo.selector ?? []) ?? '';
89
+ for (let counter = 1; ; counter++) {
90
+ const candidate = new URI()
91
+ .withScheme(UNTITLED_SCHEME)
92
+ .withPath(`Untitled-notebook-${counter}${suffix}`)
93
+ .withQuery(viewType);
94
+ if (!this.notebookService.getNotebookEditorModel(candidate)) {
95
+ resource = candidate;
96
+ break;
97
+ }
98
+ }
99
+ } else if (arg.untitledResource.scheme === UNTITLED_SCHEME) {
100
+ resource = arg.untitledResource;
101
+ } else {
102
+ throw new Error('Invalid untitled resource: ' + arg.untitledResource.toString() + ' untitled resources with associated file path are not supported yet');
103
+ // TODO implement associated file path support
104
+ // resource = arg.untitledResource.withScheme('untitled');
105
+ // hasAssociatedFilePath = true;
106
+ }
107
+
108
+ return this.resolve(resource, viewType);
109
+ }
110
+
111
+ async resolveExistingNotebookData(resource: Resource, viewType: string): Promise<NotebookData> {
112
+ if (resource.uri.scheme === 'untitled') {
113
+ return {
114
+ cells: [],
115
+ metadata: {}
116
+ };
117
+ } else {
118
+ const [dataProvider, contents] = await Promise.all([
119
+ this.notebookService.getNotebookDataProvider(viewType),
120
+ this.fileService.readFile(resource.uri)
121
+ ]);
122
+ const notebook = await dataProvider.serializer.toNotebook(contents.value);
123
+
124
+ return notebook;
125
+ }
126
+ }
127
+
128
+ protected getPossibleFileEnding(selectors: readonly NotebookFileSelector[]): string | undefined {
129
+ for (const selector of selectors) {
130
+ const ending = this.possibleFileEnding(selector);
131
+ if (ending) {
132
+ return ending;
133
+ }
134
+ }
135
+ return undefined;
136
+ }
137
+
138
+ protected possibleFileEnding(selector: NotebookFileSelector): string | undefined {
139
+
140
+ const pattern = /^.*(\.[a-zA-Z0-9_-]+)$/;
141
+
142
+ const candidate = typeof selector === 'string' ? selector : selector.filenamePattern;
143
+
144
+ if (candidate) {
145
+ const matches = pattern.exec(candidate);
146
+ if (matches) {
147
+ return matches[1];
148
+ }
149
+ }
150
+
151
+ return undefined;
152
+ }
153
+
154
+ protected findViewTypeForResource(resource: URI): string | undefined {
155
+ return this.notebookTypeRegistry.notebookTypes.find(info =>
156
+ info.selector?.some(selector => selector.filenamePattern && match(selector.filenamePattern, resource.path.name + resource.path.ext))
157
+ )?.type;
158
+ }
159
+
160
+ }
@@ -1,48 +1,48 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2024 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { ReferenceCollection, URI, Reference, Event } from '@theia/core';
18
- import { inject, injectable } from '@theia/core/shared/inversify';
19
- import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
20
- import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
21
- import { NotebookModel } from '../view-model/notebook-model';
22
-
23
- /**
24
- * special service for creating monaco textmodels for notebook cells.
25
- * Its for optimization purposes since there is alot of overhead otherwise with calling the backend to create a document for each cell and other smaller things.
26
- */
27
- @injectable()
28
- export class NotebookMonacoTextModelService {
29
-
30
- @inject(MonacoTextModelService)
31
- protected readonly monacoTextModelService: MonacoTextModelService;
32
-
33
- protected readonly cellmodels = new ReferenceCollection<string, MonacoEditorModel>(
34
- uri => this.monacoTextModelService.createUnmanagedModel(new URI(uri))
35
- );
36
-
37
- getOrCreateNotebookCellModelReference(uri: URI): Promise<Reference<MonacoEditorModel>> {
38
- return this.cellmodels.acquire(uri.toString());
39
- }
40
-
41
- async createTextModelsForNotebook(notebook: NotebookModel): Promise<void> {
42
- await Promise.all(notebook.cells.map(cell => cell.resolveTextModel()));
43
- }
44
-
45
- get onDidCreateNotebookCellModel(): Event<MonacoEditorModel> {
46
- return this.cellmodels.onDidCreate;
47
- }
48
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2024 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { ReferenceCollection, URI, Reference, Event } from '@theia/core';
18
+ import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
20
+ import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
21
+ import { NotebookModel } from '../view-model/notebook-model';
22
+
23
+ /**
24
+ * special service for creating monaco textmodels for notebook cells.
25
+ * Its for optimization purposes since there is alot of overhead otherwise with calling the backend to create a document for each cell and other smaller things.
26
+ */
27
+ @injectable()
28
+ export class NotebookMonacoTextModelService {
29
+
30
+ @inject(MonacoTextModelService)
31
+ protected readonly monacoTextModelService: MonacoTextModelService;
32
+
33
+ protected readonly cellmodels = new ReferenceCollection<string, MonacoEditorModel>(
34
+ uri => this.monacoTextModelService.createUnmanagedModel(new URI(uri))
35
+ );
36
+
37
+ getOrCreateNotebookCellModelReference(uri: URI): Promise<Reference<MonacoEditorModel>> {
38
+ return this.cellmodels.acquire(uri.toString());
39
+ }
40
+
41
+ async createTextModelsForNotebook(notebook: NotebookModel): Promise<void> {
42
+ await Promise.all(notebook.cells.map(cell => cell.resolveTextModel()));
43
+ }
44
+
45
+ get onDidCreateNotebookCellModel(): Event<MonacoEditorModel> {
46
+ return this.cellmodels.onDidCreate;
47
+ }
48
+ }