Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
fix: somethine server does not ready and send notify
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Mar 1, 2020
1 parent 6170e21 commit 271c9cd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Extension {
private tsAPI!: TypescriptAPI;
// LSP client
private client: LanguageClient | undefined;
private clientReady = false;
private configurationSection = "deno";
// status bar
private statusBar!: StatusBarItem;
Expand Down Expand Up @@ -180,6 +181,7 @@ class Extension {
if (this.client) {
await this.client.stop();
this.client = undefined;
this.clientReady = false;
}

// create server connection
Expand Down Expand Up @@ -275,6 +277,7 @@ class Extension {
this.context.subscriptions.push(client.start());

await client.onReady().then(() => {
this.clientReady = true;
console.log("Deno Language Server is ready!");
client.onNotification("init", (info: DenoInfo) => {
this.denoInfo = { ...this.denoInfo, ...info };
Expand Down Expand Up @@ -371,7 +374,9 @@ Executable ${this.denoInfo.executablePath}`;
}
// update diagnostic for a Document
private updateDiagnostic(uri: Uri) {
this.client?.sendNotification("updateDiagnostic", uri.toString());
if (this.client && this.clientReady) {
this.client.sendNotification("updateDiagnostic", uri.toString());
}
}
private sync(document?: TextDocument) {
if (document) {
Expand Down Expand Up @@ -591,11 +596,11 @@ Executable ${this.denoInfo.executablePath}`;
public async deactivate(context: ExtensionContext) {
this.context = context;

if (!this.client) {
return;
if (this.client) {
await this.client.stop();
this.client = undefined;
this.clientReady = false;
}

await this.client.stop();
}
}

Expand Down

0 comments on commit 271c9cd

Please sign in to comment.