emacs-lsp / lsp-haskell

lsp-mode :heart: haskell
https://emacs-lsp.github.io/lsp-haskell
GNU General Public License v3.0
227 stars 56 forks source link

Overriding HLS configuration flags #140

Closed korayal closed 2 years ago

korayal commented 2 years ago

There are a set of new configuration parameters in HLS that is not yet available in lsp-haskell, so I was trying to override it myself on my Spacemacs setup like below:

  (add-hook 'lsp-mode-hook
            (lambda ()
              (lsp-register-custom-settings

               '(("haskell.formattingProvider" "ormolu")
                 ("haskell.formatOnImportOn" t)
                 ("haskell.completionSnippetsOn" t)
                 ("haskell.liquidOn" :json-false)
                 ("haskell.diagnosticsOnChange" t)
                 ("haskell.checkProject" :json-false)
                 ("haskell.checkParents" "NeverCheck")

                 ("haskell.plugin.ghcide.globalOn" t)
                 ("haskell.plugin.ghcide-completions.config.snippetsOn" t)
                 ("haskell.plugin.hlint.globalOn" t)
                 ("haskell.plugin.pragmas.globalOn" t)
                 ("haskell.plugin.floskell.globalOn" :json-false)
                 ("haskell.plugin.fourmolu.globalOn" :json-false)
                 ("haskell.plugin.ormolu.globalOn" :json-false)
                 ("haskell.plugin.stylish-haskell.globalOn" :json-false)
                 ("haskell.plugin.brittany.globalOn" :json-false)
                 ("haskell.plugin.tactic.globalOn" :json-false)
                 ("haskell.plugin.retrie.globalOn" t)
                 ("haskell.plugin.eval.globalOn" t)
                 ("haskell.plugin.importLens.globalOn" :json-false)
                 ("haskell.plugin.refineImports.globalOn" :json-false)
                 ("haskell.plugin.moduleName.globalOn" t)
                 ))))

My question is; is this the right way of updating this configuration?

michaelpj commented 2 years ago

I think that's fine. I have been procrastinating on updating all the settings exposed by lsp-haskell, so if you felt up to doing a PR for that it would be very welcome! I think there are even more than that, though. What I've done in the past is start from haskell-language-server vscode-extension-schema and feed it into https://github.com/emacs-lsp/lsp-mode/blob/master/scripts/lsp-generate-settings.el

korayal commented 2 years ago

Thank you! looks like vscode-extension-schema is missing some part of the configuration. so haskell-language-server generate-default-config feels like a better option to get the list of available configuration. But, that one is missing the details like description enum types etc. so we probably need a way to combine these two JSONs.

michaelpj commented 2 years ago

Ugh, how annoying. Maybe try mentioning the discrepancies upstream in HLS, they might have suggestions. I don't really know where that stuff comes from!

michaelpj commented 2 years ago

Settings should be up to date, and there's a snippet in the readme about putting in extra settings now.