UNPKG

@eclipse-glsp/vscode-integration

Version:

Glue code to integrate GLSP diagrams in VSCode extensions (extension part)

70 lines 3.99 kB
/******************************************************************************** * Copyright (c) 2023-2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { ActionMessage, ClientState, Deferred, Disposable, DisposableCollection, DisposeClientSessionParameters, GLSPClient, InitializeClientSessionParameters, InitializeParameters, InitializeResult } from '@eclipse-glsp/protocol'; import * as vscode from 'vscode'; import { Messenger } from 'vscode-messenger'; import { MessageParticipant, NotificationType, RequestType } from 'vscode-messenger-common'; import { GLSPDiagramIdentifier } from '../types'; export interface WebviewEndpointOptions { webviewPanel: vscode.WebviewPanel; messenger?: Messenger; diagramIdentifier: GLSPDiagramIdentifier; } export declare const WebviewReadyNotification: NotificationType<void>; export declare const InitializeNotification: NotificationType<GLSPDiagramIdentifier>; export declare const ActionMessageNotification: NotificationType<ActionMessage>; export declare const ClientStateChangeNotification: NotificationType<ClientState>; export declare const StartRequest: RequestType<undefined, void>; export declare const InitializeServerRequest: RequestType<InitializeParameters, InitializeResult>; export declare const InitializeClientSessionRequest: RequestType<InitializeClientSessionParameters, void>; export declare const DisposeClientSessionRequest: RequestType<DisposeClientSessionParameters, void>; export declare const ShutdownServerNotification: NotificationType<void>; export declare const StopRequest: RequestType<undefined, void>; /** * Wrapper class around a {@link vscode.WebviewPanel}. Takes care * of the communication between the webview and the host extension. * It's main responsibility is sending {@link ActionMessages} to the webview * and handling of action messages received from the webview. */ export declare class WebviewEndpoint implements Disposable { readonly webviewPanel: vscode.WebviewPanel; readonly messenger: Messenger; readonly messageParticipant: MessageParticipant; readonly diagramIdentifier: GLSPDiagramIdentifier; protected _readyDeferred: Deferred<void>; protected toDispose: DisposableCollection; protected onActionMessageEmitter: vscode.EventEmitter<ActionMessage<import("@eclipse-glsp/protocol").Action>>; get onActionMessage(): vscode.Event<ActionMessage>; protected _serverActions?: string[]; get serverActions(): string[] | undefined; protected _clientActions?: string[]; get clientActions(): string[] | undefined; constructor(options: WebviewEndpointOptions); protected sendDiagramIdentifier(): Promise<void>; /** * Hooks up a {@link GLSPClient} with the underlying webview and send the `initialize` message to the webview * (once its ready) * The GLSP client is called remotely from the webview context via the `vscode-messenger` RPC * protocol. * @param glspClient The client that should be connected * @returns A {@link Disposable} to dispose the remote connection and all attached listeners */ initialize(glspClient: GLSPClient): Disposable; sendMessage(actionMessage: ActionMessage): void; get ready(): Promise<void>; dispose(): void; } //# sourceMappingURL=webview-endpoint.d.ts.map