Skip to content

Commit

Permalink
code: Ensure lsp-devtools can be relaunched when closed
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Sep 12, 2023
1 parent c0552bd commit 598bf4c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion code/src/node/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ export class EsbonioClient {
) {
this.handlers = new Map()

// Restart server implementation
context.subscriptions.push(
vscode.commands.registerCommand(Commands.RESTART_SERVER, async () => await this.restartServer())
)

// Unset devtools task when it finishes.
context.subscriptions.push(
vscode.tasks.onDidEndTask((event) => {
if (event.execution === this.devtools) {
this.devtools = undefined
}
})
)
}

public addHandler(event: string, handler: any) {
Expand Down Expand Up @@ -146,8 +156,14 @@ export class EsbonioClient {
command.push("-S")

let config = vscode.workspace.getConfiguration("esbonio")
if (config.get<boolean>('server.enableDevTools')) {
let serverDevtools = config.get<boolean>('server.enableDevTools')
let sphinxDevtools = config.get<boolean>('sphinx.enableDevTools')

if (serverDevtools || sphinxDevtools) {
await this.startDevtools(command[0], ...command.slice(1), "-m", "lsp_devtools", "tui")
}

if (serverDevtools) {
command.push("-m", "lsp_devtools", "agent", "--", ...command)
}

Expand Down

0 comments on commit 598bf4c

Please sign in to comment.