Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/api/browser/mainThreadInteractive.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { DisposableStore } from '../../../base/common/lifecycle.js';
7
import { PLAINTEXT_LANGUAGE_ID } from '../../../editor/common/languages/modesRegistry.js';
8
import { ExtHostContext, ExtHostInteractiveShape, MainContext, MainThreadInteractiveShape } from '../common/extHost.protocol.js';
9
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
10
import { IInteractiveDocumentService } from '../../contrib/interactive/browser/interactiveDocumentService.js';
11
12
@extHostNamedCustomer(MainContext.MainThreadInteractive)
13
export class MainThreadInteractive implements MainThreadInteractiveShape {
14
private readonly _proxy: ExtHostInteractiveShape;
15
16
private readonly _disposables = new DisposableStore();
17
18
constructor(
19
extHostContext: IExtHostContext,
20
@IInteractiveDocumentService interactiveDocumentService: IInteractiveDocumentService
21
) {
22
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostInteractive);
23
24
this._disposables.add(interactiveDocumentService.onWillAddInteractiveDocument((e) => {
25
this._proxy.$willAddInteractiveDocument(e.inputUri, '\n', PLAINTEXT_LANGUAGE_ID, e.notebookUri);
26
}));
27
28
this._disposables.add(interactiveDocumentService.onWillRemoveInteractiveDocument((e) => {
29
this._proxy.$willRemoveInteractiveDocument(e.inputUri, e.notebookUri);
30
}));
31
}
32
33
dispose(): void {
34
this._disposables.dispose();
35
36
}
37
}
38
39