mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
shutdown
This commit is contained in:
@@ -5,22 +5,30 @@ import { LSPClient } from "./client";
|
||||
export namespace LSP {
|
||||
const log = Log.create({ service: "lsp" });
|
||||
|
||||
const state = App.state("lsp", async () => {
|
||||
const clients = new Map<string, LSPClient.Info>();
|
||||
const state = App.state(
|
||||
"lsp",
|
||||
async () => {
|
||||
const clients = new Map<string, LSPClient.Info>();
|
||||
|
||||
// QUESTION: how lazy should lsp auto discovery be? should it not initialize until a file is opened?
|
||||
clients.set(
|
||||
"typescript",
|
||||
await LSPClient.create({
|
||||
cmd: ["bun", "x", "typescript-language-server", "--stdio"],
|
||||
}),
|
||||
);
|
||||
// QUESTION: how lazy should lsp auto discovery be? should it not initialize until a file is opened?
|
||||
clients.set(
|
||||
"typescript",
|
||||
await LSPClient.create({
|
||||
cmd: ["bun", "x", "typescript-language-server", "--stdio"],
|
||||
}),
|
||||
);
|
||||
|
||||
return {
|
||||
clients,
|
||||
diagnostics: new Map<string, any>(),
|
||||
};
|
||||
});
|
||||
return {
|
||||
clients,
|
||||
diagnostics: new Map<string, any>(),
|
||||
};
|
||||
},
|
||||
async (state) => {
|
||||
for (const client of state.clients.values()) {
|
||||
await client.shutdown();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export async function run<T>(
|
||||
input: (client: LSPClient.Info) => Promise<T>,
|
||||
|
||||
Reference in New Issue
Block a user