From 80a980ab00a871777c37ec3f0db9c394509b2465 Mon Sep 17 00:00:00 2001
From: Christoph Schmidpeter
<3390179+ChristophSchmidpeter@users.noreply.github.com>
Date: Mon, 20 Oct 2025 08:02:50 +0200
Subject: [PATCH] feat(lang/fsharp): add F# support to omnisharp extra (#6538)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Description
Extend the existing C#/VB setup to support F# development with
formatting, LSP, and debugging integration.
- Extend recommended filetypes and roots to include F#
- Ensure Treesitter installs the `fsharp` parser
- Add Fantomas formatter in none-ls and Conform
- Ensure Mason installs fsautocomplete and fantomas
- Extend DAP configurations to include `fsharp`
⚠️ For debugging/neotest to work, this PR should be merged together with
[#6540](https://github.com/LazyVim/LazyVim/pull/6540),
which switches Omnisharp extras from `neotest-dotnet` to
`neotest-vstest`.
## Related Issue(s)
N/A
## Screenshots
### Without PR
Sample code:
### With PR
`:ConformInfo`
`:NullLsInfo`
Sample code before formatting:
Sample code after formatting (using Fantomas formatter):
DAP/Neotest debugging the sample code:
## Attachments
[Sample Project ZIP
Archive](https://github.com/user-attachments/files/22576868/FsSample.zip)
```
sudo pacman -S --needed curl unzip dotnet-sdk # or whatever package manger is on system
curl -O -L "https://github.com/user-attachments/files/22576868/FsSample.zip"
unzip FsSample.zip
cd FsSample
dotnet build # restoring/building fixes LSP errors
```
## Checklist
- [X] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
Co-authored-by: Christoph Schmidpeter
---
lua/lazyvim/plugins/extras/lang/omnisharp.lua | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lua/lazyvim/plugins/extras/lang/omnisharp.lua b/lua/lazyvim/plugins/extras/lang/omnisharp.lua
index 63bbd486..af2daed6 100644
--- a/lua/lazyvim/plugins/extras/lang/omnisharp.lua
+++ b/lua/lazyvim/plugins/extras/lang/omnisharp.lua
@@ -1,15 +1,15 @@
return {
recommended = function()
return LazyVim.extras.wants({
- ft = { "cs", "vb" },
- root = { "*.sln", "*.csproj", "omnisharp.json", "function.json" },
+ ft = { "cs", "vb", "fsharp" },
+ root = { "*.sln", "*.csproj", "*.fsproj", "omnisharp.json", "function.json", "paket.dependencies", "paket.lock" },
})
end,
{ "Hoffs/omnisharp-extended-lsp.nvim", lazy = true },
{
"nvim-treesitter/nvim-treesitter",
- opts = { ensure_installed = { "c_sharp" } },
+ opts = { ensure_installed = { "c_sharp", "fsharp" } },
},
{
"nvimtools/none-ls.nvim",
@@ -18,6 +18,7 @@ return {
local nls = require("null-ls")
opts.sources = opts.sources or {}
table.insert(opts.sources, nls.builtins.formatting.csharpier)
+ table.insert(opts.sources, nls.builtins.formatting.fantomas)
end,
},
{
@@ -26,12 +27,13 @@ return {
opts = {
formatters_by_ft = {
cs = { "csharpier" },
+ fsharp = { "fantomas" },
},
},
},
{
"mason-org/mason.nvim",
- opts = { ensure_installed = { "csharpier", "netcoredbg" } },
+ opts = { ensure_installed = { "csharpier", "netcoredbg", "fsautocomplete", "fantomas" } },
},
{
"neovim/nvim-lspconfig",