-
Hello, I use both Is there an easy way to switch between the two? I have thought about creating an autocmd that toggles the option based on the project directory. The problem is that I don't know when exactly Thanks for the help and have a nice day =) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey 👋 haskell-tools doesn't do formatting. That's done by haskell-language-server, which has plugins for the for the different formatting providers. For configuration via this plugin, see the advanced configuration section in the readme. For haskell-language-server settings, see the hls documentation. haskell-language-server loads the configuration at startup, and can't dynamically change the formatting provider at runtime. If you only need different settings per project, you can use a To change the provider within a session, for the same project, you would have to change the configuration and then restart the LSP client with To change the configuration dynamically, you can do something like this: vim.g.hls_formatting_provider = 'fourmolu'
vim.g.haskell_tools = {
hls = {
settings = function(project_root)
local ht = require('haskell-tools')
local defaults = ht.lsp.load_hls_settings(project_root)
local result = vim.tbl_deep_extend('force', defaults, {
haskell = {
formattingProvider = vim.g.hls_formatting_provider,
},
})
return result
end,
},
} And then define a command or keymap that sets |
Beta Was this translation helpful? Give feedback.
Hey 👋
haskell-tools doesn't do formatting. That's done by haskell-language-server, which has plugins for the for the different formatting providers.
For configuration via this plugin, see the advanced configuration section in the readme.
For haskell-language-server settings, see the hls documentation.
haskell-language-server loads the configuration at startup, and can't dynamically change the formatting provider at runtime.
If you only need different settings per project, you can use a
hls.json
(see this readme section).To change the provider within a session, for the same project, you would have to change the configuration and then restart the LSP client with
:HlsRestart
(orvim.cmd.Hls…