简体   繁体   中英

How to get rid of automatic type annotations in LunarVim from Haskell Language Server?

I use LunarVim for editing Haskell code. Automatic type and import hints are quite annoying. How to turn them off?

For example, after the import Text.ParserCombinators.Parsec import, the following hint is automatically showed right after import statement: import Text.ParserCombinators.Parsec ( car, noneof, string, ... ) . If types for a function are not specified, the hint with the inferred types is automatically showed after the first line of the function.

HLS is very helpful, but the code looks cluttered due to those hints. It would be great to disable only the hints keeping all the HLS functionality. The default LunarVim setup is used with some plugins unrelated to Haskell and some changes are made in themes.

Thanks.

On Linux, under ~/.config/lvim/lsp-settings , try creating a file haskell.json with the following setting:

{
  "haskell.plugin.importLens.globalOn": "false"
}

You can do it from within Lunarvim with :LspSettings haskell

This should fix the import hints. As for the inferred types, I couldn't find a specific option. However, you can run haskell-language-server generate-default-config to print the default configuration and check the definitions of these options in https://haskell-language-server.readthedocs.io/en/latest/configuration.html#configuring-your-editor

Note: although I have lunarvim installed, I prefer the vanilla neovim with some plugins installed, such as Coc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM