Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async runOnServer(uri: vscode.Uri, mode?: string): Promise {
if (!this.explorer) {
return Promise.reject('Runtime Server Protocol (RSP) Server is starting, please try again later.');
}
const rsp = await this.selectRSP('Select RSP provider you want to retrieve servers');
if (!rsp || !rsp.id) return;
const serverId = await this.selectServer(rsp.id, 'Select server you want to retrieve info about');
if (!serverId) return;
const context = this.explorer.getServerStateById(rsp.id, serverId);
await this.explorer.addDeployment([uri], context);
const isAsync = vscode.workspace.getConfiguration('rsp-ui').get(`enableAsyncPublish`);
await this.explorer.publish(rsp.id, context.server, ServerState.PUBLISH_FULL, isAsync);
if (context.state === ServerState.STOPPED ||
context.state === ServerState.UNKNOWN) {
if (mode === ServerState.RUN_MODE_RUN) {
await this.startServer(mode, context);
} else {
await this.debugServer(context);
}
} else if (context.state === ServerState.STARTED) {
if (!(context.runMode === ServerState.RUN_MODE_RUN &&
mode === ServerState.RUN_MODE_RUN)) {
await this.restartServer(mode, context);
}
} else {
return Promise.reject(`Unable to add deployment and run it on server ${context.server.id}. Stop/start the server and try again.`);
}
}
context => executeCommand(commandHandler.publishServer, commandHandler, ServerState.PUBLISH_FULL, context, errorMessage.replace('%ACTION%', 'publish (Full) to'))),
vscode.commands.registerCommand('server.publishIncremental',