opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]:FSharp LSP

Open Thorium opened this issue 1 month ago • 10 comments

Feature hasn't been suggested before.

  • [x] I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I see that "fsharp" language files are defined in the Opencode configs *.fs, *.fsx and *.fsi but the F# LSP is not installed by default.

LSP for F# is very simple to setup:

  1. dotnet tool install fsautocomplete -g
  2. Add the following section to the opencode.json:
  "lsp": {
    "fsharp": {
      "command": ["fsautocomplete"],
      "extensions": [".fs", ".fsx", ".fsi"]
    }
  }

...and it works! It would be nice to have this enabled by default in the installation.

Image

Thorium avatar Dec 14 '25 20:12 Thorium

This issue might be a duplicate of existing issues. Please check:

  • #1808: C# language server (csharp-ls) doesn't work - This is a similar language support request within the .NET ecosystem. Understanding how C# LSP support is being addressed may provide insights for F# LSP implementation.

Additionally, you may want to reference other language LSP support requests:

  • #3116: Kotlin LSP support - A similar feature request for adding LSP support for another language

Feel free to ignore if your specific case differs from these.

github-actions[bot] avatar Dec 14 '25 20:12 github-actions[bot]

working on this

nalin-singh avatar Dec 15 '25 05:12 nalin-singh

did start to work, have to do some additional testing

Image

nalin-singh avatar Dec 15 '25 05:12 nalin-singh

do we also want to add a tree-sitter parser ? [WARN] 'TSWorker:': no parser found for injection language: fsharp

nalin-singh avatar Dec 15 '25 05:12 nalin-singh

I think here is the scm: https://raw.githubusercontent.com/ionide/tree-sitter-fsharp/refs/heads/main/queries/highlights.scm

Thorium avatar Dec 15 '25 07:12 Thorium

requires a wasm file as well, can't find that

Image

nalin-singh avatar Dec 15 '25 07:12 nalin-singh

PR created to put the binaries to repo, but not merged yet. Would bring the wasm to the repo https://github.com/Thorium/tree-sitter-fsharp/raw/8ec2ff6f7c0ce3da6ef9a4e5b73a6b48d90fb3d4/wasm/tree-sitter-fsharp.wasm

Thorium avatar Dec 15 '25 13:12 Thorium

Should we have added the wasm before closing this?

Thorium avatar Dec 15 '25 16:12 Thorium

it got auto closed by the merging of pr but yeah prolly good idea there

rekram1-node avatar Dec 15 '25 17:12 rekram1-node

that's for the syntax highlighting tho

rekram1-node avatar Dec 15 '25 17:12 rekram1-node

I'm also looking how to support fantomas as formatter:

https://github.com/sst/opencode/blob/dev/packages/opencode/src/format/formatter.ts

export const fantomas: Info = {
  name: "fantomas",
  command: ["dotnet", "fantomas", "$FILE"],
  extensions: [".fs", ".fsx", ".fsi"],
  async enabled() {
    return Bun.which("dotnet") !== null
  },
}

...but having bun which dotnet is enough to check the availability, it should also somehow check that fantomas is listed in the list when you run dotnet tool list fantomas

Thorium avatar Dec 19 '25 10:12 Thorium