Skip to content

Commit

Permalink
code: Automatically launch lsp-devtools tui if appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Sep 8, 2023
1 parent e75e704 commit 1008514
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions code/src/node/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export class EsbonioClient {

private client?: LanguageClient

private devtools?: vscode.TaskExecution

private handlers: Map<string, any[]>

constructor(
Expand Down Expand Up @@ -145,6 +147,7 @@ export class EsbonioClient {

let config = vscode.workspace.getConfiguration("esbonio")
if (config.get<boolean>('server.enableDevTools')) {
await this.startDevtools(command[0], ...command.slice(1), "-m", "lsp_devtools", "tui")
command.push("-m", "lsp_devtools", "agent", "--", ...command)
}

Expand Down Expand Up @@ -301,4 +304,28 @@ export class EsbonioClient {
}
})
}

private async startDevtools(command: string, ...args: string[]) {

if (this.devtools) {
return
}

const task = new vscode.Task(
{ type: 'esbonio-devtools' },
vscode.TaskScope.Workspace,
"lsp-devtools",
"esbonio",
new vscode.ProcessExecution(
command,
args,
{
env: {
PYTHONPATH: join(this.context.extensionPath, "bundled", "libs")
}
}
),
)
this.devtools = await vscode.tasks.executeTask(task)
}
}

0 comments on commit 1008514

Please sign in to comment.