Explorar o código

feat(opencode): ormolu code formatter for haskell (#10274)

Ondřej Súkup hai 2 semanas
pai
achega
52006c2fd9

+ 9 - 0
packages/opencode/src/format/formatter.ts

@@ -355,3 +355,12 @@ export const pint: Info = {
     return false
   },
 }
+
+export const ormolu: Info = {
+  name: "ormolu",
+  command: ["ormolu", "-i", "$FILE"],
+  extensions: [".hs"],
+  async enabled() {
+    return Bun.which("ormolu") !== null
+  },
+}

+ 1 - 0
packages/web/src/content/docs/formatters.mdx

@@ -36,6 +36,7 @@ OpenCode comes with several built-in formatters for popular languages and framew
 | shfmt                | .sh, .bash                                                                                               | `shfmt` command available                                                                             |
 | pint                 | .php                                                                                                     | `laravel/pint` dependency in `composer.json`                                                          |
 | oxfmt (Experimental) | .js, .jsx, .ts, .tsx                                                                                     | `oxfmt` dependency in `package.json` and an [experimental env variable flag](/docs/cli/#experimental) |
+| ormolu               | .hs                                                                                                      | `ormolu` command available                                                                            |
 
 So if your project has `prettier` in your `package.json`, OpenCode will automatically use it.
 

+ 1 - 0
packages/web/src/content/docs/lsp.mdx

@@ -25,6 +25,7 @@ OpenCode comes with several built-in LSP servers for popular languages:
 | fsharp             | .fs, .fsi, .fsx, .fsscript                                          | `.NET SDK` installed                                         |
 | gleam              | .gleam                                                              | `gleam` command available                                    |
 | gopls              | .go                                                                 | `go` command available                                       |
+| hls                | .hs, .lhs                                                           | `haskell-language-server-wrapper` command available
 | jdtls              | .java                                                               | `Java SDK (version 21+)` installed                           |
 | kotlin-ls          | .kt, .kts                                                           | Auto-installs for Kotlin projects                            |
 | lua-ls             | .lua                                                                | Auto-installs for Lua projects                               |