diff options
| author | Dax Raad <[email protected]> | 2025-05-26 13:39:16 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-26 13:39:16 -0400 |
| commit | e1ec815d1b6ad239f1e43258d760ecd48525daf2 (patch) | |
| tree | 7a502657d17464e98e596f1444b29cd6fac0edae | |
| parent | 2ed17f4877478e20022a0d68bb9f6e3b4f726bb1 (diff) | |
| download | opencode-e1ec815d1b6ad239f1e43258d760ecd48525daf2.tar.gz opencode-e1ec815d1b6ad239f1e43258d760ecd48525daf2.zip | |
sync
| -rw-r--r-- | js/src/lsp/index.ts | 27 | ||||
| -rw-r--r-- | js/src/lsp/language.ts | 4 | ||||
| -rw-r--r-- | js/src/tool/util/file-times.ts | 2 |
3 files changed, 30 insertions, 3 deletions
diff --git a/js/src/lsp/index.ts b/js/src/lsp/index.ts index ac200fc51..f20a15e70 100644 --- a/js/src/lsp/index.ts +++ b/js/src/lsp/index.ts @@ -8,6 +8,7 @@ export namespace LSP { 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({ @@ -28,4 +29,30 @@ export namespace LSP { const tasks = clients.map((x) => input(x)); return Promise.all(tasks); } + + const AUTO: { + command: string[]; + extensions: string[]; + install?: () => Promise<void>; + }[] = [ + { + command: ["bun", "x", "typescript-language-server", "--stdio"], + extensions: [ + "ts", + "tsx", + "js", + "jsx", + "mjs", + "cjs", + "mts", + "cts", + "mtsx", + "ctsx", + ], + }, + { + command: ["gopls"], + extensions: ["go"], + }, + ]; } diff --git a/js/src/lsp/language.ts b/js/src/lsp/language.ts index 0a9bc0f7f..964ebc803 100644 --- a/js/src/lsp/language.ts +++ b/js/src/lsp/language.ts @@ -1,4 +1,4 @@ -export const LANGUAGE_EXTENSIONS: Record<string, string> = { +export const LANGUAGE_EXTENSIONS = { ".abap": "abap", ".bat": "bat", ".bib": "bibtex", @@ -80,4 +80,4 @@ export const LANGUAGE_EXTENSIONS: Record<string, string> = { ".xsl": "xsl", ".yaml": "yaml", ".yml": "yaml", -}; +} as const; diff --git a/js/src/tool/util/file-times.ts b/js/src/tool/util/file-times.ts index d07c5264c..aab562dd4 100644 --- a/js/src/tool/util/file-times.ts +++ b/js/src/tool/util/file-times.ts @@ -1,7 +1,7 @@ import { App } from "../../app"; export namespace FileTimes { - export const state = App.state("tool.edit", () => ({ + export const state = App.state("tool.filetimes", () => ({ read: new Map<string, Date>(), write: new Map<string, Date>(), })); |
