How to use the rsp-client.ServerState.STARTING function in rsp-client

To help you get started, we’ve selected a few rsp-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github redhat-developer / vscode-rsp-ui / src / serverExplorer.ts View on Github external
public updateServer(rspId: string, event: Protocol.ServerState): void {
        const indexServer: number = this.RSPServersStatus.get(rspId).state.serverStates.
                                            findIndex(state => state.server.id === event.server.id);
        const serverNode: ServerStateNode = this.convertToServerStateNode(rspId, event);
        this.RSPServersStatus.get(rspId).state.serverStates[indexServer] = serverNode;
        this.refresh();
        const channel: OutputChannel = this.serverOutputChannels.get(event.server.id);
        if (event.state === ServerState.STARTING && channel) {
            channel.clear();
        }
    }
github redhat-developer / vscode-rsp-ui / src / extensionApi.ts View on Github external
public async stopServer(forced: boolean, context?: ServerStateNode): Promise {
        if (context === undefined) {
            const rsp = await this.selectRSP('Select RSP provider you want to retrieve servers');
            if (!rsp || !rsp.id) return null;
            const serverFilter = server => server.state === ServerState.STARTED;
            const serverId = await this.selectServer(rsp.id, 'Select server to stop.', serverFilter);
            if (!serverId) return null;
            context = this.explorer.getServerStateById(rsp.id, serverId);
        }

        const serverState = this.explorer.getServerStateById(context.rsp, context.server.id).state;
        if ((!forced && serverState === ServerState.STARTED)
            || (forced && (serverState === ServerState.STARTING
                            || serverState === ServerState.STOPPING))) {
            const client: RSPClient = this.explorer.getClientByRSP(context.rsp);
            if (!client) {
                return Promise.reject('Failed to contact the RSP server.');
            }
            const status = await client.getOutgoingHandler().stopServerAsync(
                { id: context.server.id, force: forced }
            );
            if (this.debugSession.isDebuggerStarted()) {
                await this.debugSession.stop();
            }
            if (!StatusSeverity.isOk(status)) {
                return Promise.reject(status.message);
            }
            return status;
        } else {