[FEATURE]:FSharp LSP
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:
-
dotnet tool install fsautocomplete -g - 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.
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.
working on this
did start to work, have to do some additional testing
do we also want to add a tree-sitter parser ? [WARN] 'TSWorker:': no parser found for injection language: fsharp
I think here is the scm: https://raw.githubusercontent.com/ionide/tree-sitter-fsharp/refs/heads/main/queries/highlights.scm
requires a wasm file as well, can't find that
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
Should we have added the wasm before closing this?
it got auto closed by the merging of pr but yeah prolly good idea there
that's for the syntax highlighting tho
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