Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/opencode/src/format/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,12 @@ export const latexindent: Info = {
return Bun.which("latexindent") !== null
},
}

export const gleam: Info = {
name: "gleam",
command: ["gleam", "format", "$FILE"],
extensions: [".gleam"],
async enabled() {
return Bun.which("gleam") !== null
},
}
1 change: 1 addition & 0 deletions packages/opencode/src/lsp/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const LANGUAGE_EXTENSIONS: Record<string, string> = {
".gitrebase": "git-rebase",
".go": "go",
".groovy": "groovy",
".gleam": "gleam",
".hbs": "handlebars",
".handlebars": "handlebars",
".hs": "haskell",
Expand Down
18 changes: 18 additions & 0 deletions packages/opencode/src/lsp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1509,4 +1509,22 @@ export namespace LSPServer {
}
},
}

export const Gleam: Info = {
id: "gleam",
extensions: [".gleam"],
root: NearestRoot(["gleam.toml"]),
async spawn(root) {
const gleam = Bun.which("gleam")
if (!gleam) {
log.info("gleam not found, please install gleam first")
return
}
return {
process: spawn(gleam, ["lsp"], {
cwd: root,
}),
}
},
}
}
1 change: 1 addition & 0 deletions packages/web/src/content/docs/formatters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ OpenCode comes with several built-in formatters for popular languages and framew
| dart | .dart | `dart` command available |
| ocamlformat | .ml, .mli | `ocamlformat` command available and `.ocamlformat` config file |
| terraform | .tf, .tfvars | `terraform` command available |
| gleam | .gleam | `gleam` command available |

So if your project has `prettier` in your `package.json`, OpenCode will automatically use it.

Expand Down
1 change: 1 addition & 0 deletions packages/web/src/content/docs/lsp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ OpenCode comes with several built-in LSP servers for popular languages:
| ocaml-lsp | .ml, .mli | `ocamllsp` command available |
| terraform | .tf, .tfvars | Auto-installs from GitHub releases |
| bash | .sh, .bash, .zsh, .ksh | Auto-installs bash-language-server |
| gleam | .gleam | `gleam` command available |

LSP servers are automatically enabled when one of the above file extensions are detected and the requirements are met.

Expand Down