Skip to content

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

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

Open
jneira opened this issue Aug 2, 2021 · 6 comments
Labels
type: enhancement New feature or request

Comments

@jneira
Copy link
Member

jneira commented Aug 2, 2021

caRemoveRedundantImports :: Maybe ParsedModule -> Maybe T.Text -> [Diagnostic] -> [Diagnostic] -> Uri -> [Command |? CodeAction]

  • Maybe we could add the feature in the README and note htat you have to enable that warning (or -Wall) to make it work
@pepeiborra
Copy link
Collaborator

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
Copy link
Collaborator

July541 commented Aug 2, 2021

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
Copy link
Member Author

jneira commented Aug 2, 2021

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?

@jneira jneira changed the title Document -Wredundant-imports is needed to trigger remove unused imports code actions Document what warnings are nedded for each ghcide feature (f.e. -Wredundant-imports for remove unused imports) Aug 2, 2021
@jneira jneira changed the title Document what warnings are nedded for each ghcide feature (f.e. -Wredundant-imports for remove unused imports) Document what ghc warnings are needed for each ghcide feature (f.e. -Wredundant-imports for remove unused imports) Aug 2, 2021
@July541
Copy link
Collaborator

July541 commented Aug 2, 2021

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
Copy link
Collaborator

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: haskell/cabal#5696 (comment).)

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
Copy link
Collaborator

michaelpj commented Jan 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants