Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lsp-haskell-plugins config, for coming HLS feature #100

Merged
merged 1 commit into from
Jan 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 95 additions & 7 deletions lsp-haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,88 @@
:group 'lsp-haskell
:type 'boolean)
(defcustom lsp-haskell-formatting-provider
"ormolu"
"ormolu"
"The formatter to use when formatting a document or range."
:group 'lsp-haskell
:type '(choice (const :tag "brittany" "brittany")
(const :tag "floskell" "floskell")
(const :tag "fourmolu" "fourmolu")
(const :tag "ormolu" "ormolu")
(const :tag "stylish-haskell" "stylish-haskell")
:type '(choice (const :tag "brittany" "brittany")
(const :tag "floskell" "floskell")
(const :tag "fourmolu" "fourmolu")
(const :tag "ormolu" "ormolu")
(const :tag "stylish-haskell" "stylish-haskell")
(const :tag "none" "none")))

;; ---------------------------------------------------------------------
;; Plugin-specific configuration
(defgroup lsp-haskell-plugins nil
"Customization group for 'lsp-haskell' plugins."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Customization group for 'lsp-haskell' plugins."
"Customization group for 'haskell-language-server' plugins."

They're not lsp-haskell plugins, after all!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, the elisp package is called lsp-haskell

:group 'lsp-haskell)

(defcustom lsp-haskell-ghcide-on
t
"Turn on the ghcide plugins."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-pragmas-on
t
"Turn on the pragmas plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-floskell-on
t
"Turn on the floskell plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-fourmolu-on
t
"Turn on the fourmolu plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-ormolu-on
t
"Turn on the ormolu plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-stylish-haskell-on
t
"Turn on the stylish-haskell plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-brittany-on
t
"Turn on the brittany plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-tactic-on
t
"Turn on the tactic plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-retrie-on
t
"Turn on the retrie plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-eval-on
t
"Turn on the eval plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-importlens-on
t
"Turn on the explicit import lens."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-modulename-on
t
"Turn on the moduleName plugin."
:group 'lsp-haskell-plugins
:type 'boolean)
(defcustom lsp-haskell-hlint-on
t
"Turn on the hlint plugin."
:group 'lsp-haskell-plugins
:type 'boolean)

;; ---------------------------------------------------------------------
;; Non-language server options

Expand Down Expand Up @@ -238,7 +310,23 @@ and `lsp-haskell-server-args' and `lsp-haskell-server-wrapper-function'."
("haskell.liquidOn" lsp-haskell-liquid-on t)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the liquid haskell support also going to become a plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a whole lot of legacy configuration items we brought over from HIE, some of which do things, some don't.

We have kept them so the parser doesn't blow up on the hls side if they get sent.

And we probably need a better deprecation story. It is important to report errors for malformed config, but it can become annoying.

("haskell.diagnosticsOnChange" lsp-haskell-diagnostics-on-change t)
("haskell.maxNumberOfProblems" lsp-haskell-max-number-of-problems)
("haskell.hlintOn" lsp-haskell-hlint-on t)))
("haskell.hlintOn" lsp-haskell-hlint-on t)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this to haskell.plugin.hlint.globalOn?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so let's move the hlint defcustom under lsp-haskell-plugins too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the legacy config items, which will have to be moved/deprecated some time. See comments at haskell/haskell-language-server#691 (review)


("haskell.plugin.ghcide.globalOn" lsp-haskell-ghcide-on t)
("haskell.plugin.pragmas.globalOn" lsp-haskell-pragmas-on t)
("haskell.plugin.floskell.globalOn" lsp-haskell-floskell-on t)
("haskell.plugin.fourmolu.globalOn" lsp-haskell-fourmolu-on t)
("haskell.plugin.ormolu.globalOn" lsp-haskell-ormolu-on t)
("haskell.plugin.stylish-haskell.globalOn" lsp-haskell-stylish-haskell-on t)
("haskell.plugin.brittany.globalOn" lsp-haskell-brittany-on t)
("haskell.plugin.tactic.globalOn" lsp-haskell-tactic-on t)
("haskell.plugin.retrie.globalOn" lsp-haskell-retrie-on t)
("haskell.plugin.eval.globalOn" lsp-haskell-eval-on t)
("haskell.plugin.importLens.globalOn" lsp-haskell-importlens-on t)
("haskell.plugin.moduleName.globalOn" lsp-haskell-modulename-on t)
("haskell.plugin.hlint.globalOn" lsp-haskell-hlint-on t)

))

;; This mapping is set for 'haskell-mode -> haskell' in the lsp-mode repo itself. If we move
;; it there, then delete it from here.
Expand Down