@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
53 lines • 3.37 kB
TypeScript
/********************************************************************************
* Copyright (c) 2023-2024 STMicroelectronics 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 { GLSPServer } from '@eclipse-glsp/protocol';
import { ContainerConfiguration } from '@eclipse-glsp/protocol/lib/di';
import { Channel, Disposable, MaybePromise } from '@theia/core';
import { Container, ContainerModule } from '@theia/core/shared/inversify';
import { MessageConnection } from 'vscode-jsonrpc';
import { BaseGLSPServerContribution, GLSPServerContributionOptions } from './glsp-server-contribution';
export declare const ServerContainerFactory: unique symbol;
/**
* An injectable factory used to create the baseline server DI container for a new GLSP Server
* (when used as direct integration in a node backed).
* The default factory simply creates a child container from the main Theia DI container.
*/
export type ServerContainerFactory = () => Container;
/**
* A reusable base implementation for {@link GLSPServerContribution}s that are running in a node backed and directly
* communicate with a Node GLSP Server
**/
export declare abstract class GLSPNodeServerContribution extends BaseGLSPServerContribution {
protected serverContainerFactory: ServerContainerFactory;
protected abstract createServerModules(): ContainerModule[];
createContributionOptions(): Partial<GLSPServerContributionOptions>;
doConnect(clientChannel: Channel): MaybePromise<Disposable>;
protected createContainer(...additionalConfiguration: ContainerConfiguration): Container;
protected createConnectionModule(clientConnection: MessageConnection): ContainerModule;
protected configureClientConnection(clientConnection: MessageConnection, server: GLSPServer): void;
protected createMessageConnection(clientChannel: Channel): MessageConnection;
}
/**
* Initializes a container with the given {@link ContainerConfiguration}. The container configuration
* consists of the set of {@link ContainerModule}s that should be loaded in the container and/or
* In addition, for more fine-grained control {@link ModuleConfiguration}s can be passed as part fo the container configuration
* Module loading is distinct,this means each module will only get loaded once even if it is configured multiple times.
@param containerConfiguration
* Custom modules to be loaded in addition to the default modules and/or default modules that should be excluded.
@returns The initialized container.
*/
export declare function configureServerContainer(container: Container, ...containerConfiguration: ContainerConfiguration): Container;
//# sourceMappingURL=glsp-node-server-contribution.d.ts.map