nvim: after/ftplugin/cabal: Enable HLS on cabal files

Enabling HLS on cabal files allows us to format them using gq. HLS
just uses the internal cabal-fmt plugin.
https://haskell-language-server.readthedocs.io/en/latest/features.html#formatting
This commit is contained in:
Sanchayan Maity 2023-03-06 22:05:55 +05:30
parent 01e9c92051
commit 34a5bbdacb
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3
2 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,4 @@
local lsp_utils = require('lsp-utils')
local hls_config = lsp_utils.hls_config()
vim.lsp.start(hls_config)

View file

@ -177,7 +177,12 @@ function M.hls_config()
root_dir = root_directory, root_dir = root_directory,
filetypes = { 'haskell' }, filetypes = { 'haskell' },
single_file_support = true, single_file_support = true,
settings = { haskell = { formattingProvider = 'ormolu' } }, settings = {
haskell = {
formattingProvider = 'ormolu' ,
cabalFormattingProvider = 'cabalfmt',
}
},
} }
end end