Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

Commit 632104f

Browse files
ortaacao
authored andcommitted
Do the disposable dance
1 parent 8acee96 commit 632104f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/extension.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ export function activate(context: ExtensionContext) {
102102
debug,
103103
)
104104

105-
const disposableClient = client.start()
106-
context.subscriptions.push(disposableClient)
105+
let clientLSPDisposable = client.start()
106+
context.subscriptions.push(clientLSPDisposable)
107107

108108
const commandIsDebugging = commands.registerCommand(
109109
"vscode-graphql.isDebugging",
@@ -180,8 +180,12 @@ export function activate(context: ExtensionContext) {
180180
commands.registerCommand("vscode-graphql.restart", async () => {
181181
outputChannel.appendLine(`Stopping GraphQL LSP`)
182182
await client.stop()
183+
clientLSPDisposable.dispose()
184+
183185
outputChannel.appendLine(`Restarting GraphQL LSP`)
184-
await client.start()
186+
clientLSPDisposable = await client.start()
187+
context.subscriptions.push(clientLSPDisposable)
188+
185189
outputChannel.appendLine(`GraphQL LSP restarted`)
186190
})
187191
}

0 commit comments

Comments
 (0)