haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 367 forks source link

Document what ghc warnings are needed for each ghcide feature (f.e. `-Wredundant-imports` for remove unused imports) #2064

Open jneira opened 3 years ago

jneira commented 3 years ago

https://github.com/haskell/haskell-language-server/blob/2fef04193cfe2ac08372a008a5b5cfb6275d5bea/ghcide/src/Development/IDE/Plugin/CodeAction.hs#L322

pepeiborra commented 3 years ago

It's not just redundant imports. In general, warnings need to be turned on in order to get ghcide code actions to address them, as ghcide will not turn any warnings on for you other than missing signatures, for type lenses

July541 commented 3 years ago

Shall we enable -Wall default for a single file? For example, I create a temp dir and a hs file named A.hs, I think it's better to open warning default in this condition. It has great advantages to beginners but little confuses.

jneira commented 3 years ago

Mmm i see, well, lets make this more generic then: it would be great a table or list of what warning is needed for each ghcide feature. or should there be a knowledge that we take as granted from the user?

July541 commented 3 years ago

I prefer hls is a partner for every new Haskell learner, we'd better assume users have no knowledge about hls itself, even no programming experience, so rely on these users to configure the project is a little difficult.

import Data.List(nub)
import Data.List

These redundant imports appear much more frequently in homework than in work I think.

georgefst commented 1 year ago

Shall we enable -Wall default for a single file?

This might be a good idea. Or we could warn the user when they don't have it enabled, and prompt them to switch it on. (Alternatively, this could be mostly solved by Cabal: https://github.com/haskell/cabal/issues/5696#issuecomment-692659025.)

Anecdotally, this often catches out beginners. I've most recently seen evidence of this this week. But I'm sure the ones we see are the tip of the iceberg.

michaelpj commented 10 months ago

I had an idea for how we could improve this from the GHC side: https://gitlab.haskell.org/ghc/ghc/-/issues/24329