haskell-language-server icon indicating copy to clipboard operation
haskell-language-server copied to clipboard

Document the fact that the tactics plugin turns on -Wincomplete-patterns

Open ncfavier opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

I just spent a long time troubleshooting why I was getting diagnostics for incomplete patterns despite explicitly disabling the incomplete-patterns warning. Turns out hls-tactics-plugin is enforcing that warning:

https://github.com/haskell/haskell-language-server/blob/8b5a1e0d65062b45932fe5defaa295aef545423e/plugins/hls-tactics-plugin/src/Wingman/StaticPlugin.hs#L59-L64

Describe the solution you'd like

Either disable that behaviour, or make it clear in the documentation.

ncfavier avatar Dec 07 '21 16:12 ncfavier

I guess wingman needs that and it cant work without it (maybe @isovector could confirm that) But it should be documented and I would say the server should emit a warning, to be shown in logs, if the user has disabled it explicitly

jneira avatar Dec 07 '21 17:12 jneira

Wingman doesn't need to set it --- I never considered that someone would intentionally turn off these warnings. We should enable the warning only if it wasn't explicitly set, but that's not information available in the dynflags. Does HLS have this info somewhere?

@ncfavier how is the flag getting set in the first place (it's off by default), and how are you disabling it?

isovector avatar Dec 07 '21 20:12 isovector

The flag is set by Wingman in the snippet posted above and nowhere else. If I unset it by adding -Wno-incomplete-patterns to my project's options (either in ghc-options in a Cabal file, or directly using a direct cradle), Wingman overrides it and I get the warnings. If I add {-# GHC_OPTIONS -Wno-incomplete-patterns #-} to the top of my source file then the warnings are disabled.

ncfavier avatar Dec 07 '21 20:12 ncfavier