diff --git a/packages/core/src/v1/config/lsp.ts b/packages/core/src/v1/config/lsp.ts index 89a58b5b2c9b..1b15f2bf3a66 100644 --- a/packages/core/src/v1/config/lsp.ts +++ b/packages/core/src/v1/config/lsp.ts @@ -58,6 +58,7 @@ export const builtinServerIds = [ "tinymist", "haskell-language-server", "julials", + "taplo", ] export const requiresExtensionsForCustomServers = Schema.makeFilter< diff --git a/packages/opencode/src/lsp/language.ts b/packages/opencode/src/lsp/language.ts index 07a2e97231e8..d46d542f2130 100644 --- a/packages/opencode/src/lsp/language.ts +++ b/packages/opencode/src/lsp/language.ts @@ -118,4 +118,5 @@ export const LANGUAGE_EXTENSIONS: Record = { ".nix": "nix", ".typ": "typst", ".typc": "typst", + ".toml": "toml", } as const diff --git a/packages/opencode/src/lsp/server.ts b/packages/opencode/src/lsp/server.ts index 2be68aa5a92d..ec9f661a38d8 100644 --- a/packages/opencode/src/lsp/server.ts +++ b/packages/opencode/src/lsp/server.ts @@ -1981,3 +1981,20 @@ export const JuliaLS: Info = { } }, } + +export const Taplo: Info = { + id: "taplo", + extensions: [".toml"], + root: NearestRoot(["taplo.toml", ".taplo.toml", ".git"]), + async spawn(root) { + const bin = which("taplo") + if (!bin) { + return + } + return { + process: spawn(bin, ["lsp", "stdio"], { + cwd: root, + }), + } + }, +} diff --git a/packages/web/src/content/docs/lsp.mdx b/packages/web/src/content/docs/lsp.mdx index b9428e5b2d30..f980fd8c0789 100644 --- a/packages/web/src/content/docs/lsp.mdx +++ b/packages/web/src/content/docs/lsp.mdx @@ -42,6 +42,7 @@ OpenCode comes with several built-in LSP servers for popular languages: | sourcekit-lsp | .swift, .objc, .objcpp | `swift` installed (`xcode` on macOS) | | svelte | .svelte | Auto-installs for Svelte projects | | terraform | .tf, .tfvars | Auto-installs from GitHub releases | +| taplo | .toml | `taplo` command available | | tinymist | .typ, .typc | Auto-installs from GitHub releases | | typescript | .ts, .tsx, .js, .jsx, .mjs, .cjs, .mts, .cts | `typescript` dependency in project | | vue | .vue | Auto-installs for Vue projects |