From d2e4216ca490e78a7ac4bbbd9c4751c0d60f9255 Mon Sep 17 00:00:00 2001 From: HeeJae Chang Date: Fri, 30 Sep 2022 16:23:55 -0700 Subject: [PATCH] changed API format --- src/client/activation/node/languageServerProxy.ts | 12 +++++++----- src/client/browser/extension.ts | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/client/activation/node/languageServerProxy.ts b/src/client/activation/node/languageServerProxy.ts index 890274921ea65..f26ea8cce7036 100644 --- a/src/client/activation/node/languageServerProxy.ts +++ b/src/client/activation/node/languageServerProxy.ts @@ -48,8 +48,10 @@ namespace GetExperimentValue { } interface PylanceApi { - startClient?(): Promise; - stopClient?(): Promise; + client?: { + start(): Promise; + stop(): Promise; + }; } export class NodeLanguageServerProxy implements ILanguageServerProxy { @@ -101,9 +103,9 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { const extension = await this.getPylanceExtension(); this.lsVersion = extension?.packageJSON.version || '0'; - if (extension && (extension.exports as PylanceApi).startClient) { + if (extension && (extension.exports as PylanceApi).client) { this.pylanceApi = extension.exports as PylanceApi; - await this.pylanceApi.startClient!(); + await this.pylanceApi.client!.start(); return; } @@ -126,7 +128,7 @@ export class NodeLanguageServerProxy implements ILanguageServerProxy { @traceDecoratorVerbose('Disposing language server') public async stop(): Promise { if (this.pylanceApi) { - this.pylanceApi.stopClient!(); + this.pylanceApi.client!.stop(); this.pylanceApi = undefined; return; diff --git a/src/client/browser/extension.ts b/src/client/browser/extension.ts index 91b217f2fb5db..f9a3e4d34908e 100644 --- a/src/client/browser/extension.ts +++ b/src/client/browser/extension.ts @@ -17,8 +17,10 @@ interface BrowserConfig { } interface PylanceApi { - startClient?(): Promise; - stopClient?(): Promise; + client?: { + start(): Promise; + stop(): Promise; + }; } let languageClient: LanguageClient | undefined; @@ -44,7 +46,7 @@ export async function deactivate(): Promise { const api = pylanceApi; pylanceApi = undefined; - await api?.stopClient!(); + await api?.client!.stop(); const client = languageClient; languageClient = undefined; @@ -60,9 +62,9 @@ async function runPylance( context.subscriptions.push(createStatusItem()); pylanceExtension = await getActivatedExtension(pylanceExtension); - if ((pylanceExtension.exports as PylanceApi).startClient) { + if ((pylanceExtension.exports as PylanceApi).client) { pylanceApi = pylanceExtension.exports as PylanceApi; - await pylanceApi.startClient!(); + await pylanceApi.client!.start(); return; }