-
-
Notifications
You must be signed in to change notification settings - Fork 389
(Opinion) hlint should not be enabled by default #1933
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
Comments
Well, that would be a big change and i guess users using hlint will be disturbed setting it off by default.
I know there are advanced users who dislike hlint hints cause they follow them automatically or dont want to follow it. And agree they can be distracting for beginners who should focus in basic features and the type system. Otoh you can disable hlint globally for all projects, at least in vscode, i guess it will be possible in other editors too. //cc @ndmitchell @expipiplus1 |
FWIW there is already an option to conveniently toggle the hlint diagnostics, and VSCode has strong support for managing option sets at various levels (user, workspace, etc). So you could easily include a |
From my editor's point of view, this doesn't bother me as I can explicitly I've never tried to teach true beginners in Haskell, so am not able to speak From a selfish point of view though, the more For all but the very beginner Haskeller, I think HLint is a splendid tool and
For any advanced Haskellers I suspect that turning off undesired HLint hints FWIW the thing I use HLint most for is automatically applying hints, I no |
As a compromise that would fix most of my annoyances with hlint, how about not showing any hlints as long as there is any other warning or error in the project? I believe this is the way HIE used to work. |
We already report them at the hint level of severity, deciding to hide (or not) certain kinds of diagnostic under certain conditions seems like a classic example of something that the client should control! |
Totally agree the responsability should be in the editor (at least part of it). |
I didn't mean that the client should tell us which diagnostics to send, but rather that the client should just filter the diagnostics after receiving them, if it wants to. "Hide all hint level diagnostics if there is an error" is something the client can just do on it's own without us! |
Please keep in mind that my concern is not whether people who know what they want can customize the editor to do what they want; that is already the case. I would like to protect the unconfident from seeing blue squiggles when they've done nothing wrong. |
What would the response be if an issue was opened on VSCode to ignore 'Hint' severity messages by default? Is this actually a Haskell specific problem considering that many other language servers run linters too. (I don't mean to imply that because everyone else does it it's a good idea to show these by default). |
Well, we are entering the slippery zone of user experience (so psichology) but i think the blue color tries to signal the diagnostic is a recommendation and i would not feel i am doing something "wrong" if i ignore them. |
Exactly. This is IMO a vscode UX issue. In some ways the whole point of the client/server split with lsp servers is that the server just gives the client all the stuff and then it's up to the client to handle everything relating to presentation. To be clear, I was only objecting to "conditionally don't emit hlint messages when there's an error". Having the hlint plugin default to off seems fine to me. In fact, I think I'd be in favour. Expert users will know it exists and go find it. What about beginners?
Overall "beginners miss out on hlint oh no" seems less bad to me. |
In fact, thinking about it: if we can get our option-discovery good enough, I'd be quite in favour of stripping down the default features quite a lot. We also provide a lot of code actions and code lenses by default, and it might be good to cut that down. Consider e.g. the "make imports explicit" lens. I can imagine it's quite overwhelming for users to see every import line annotated with this massive code lens! |
Regarding the "make imports explicit" lens: We might want to add a heuristic that when more than n identifiers are imported from a specific module, don't show the full list but instead just the number of imported identifiers or something. And maybe don't make the whole thing explicit by just clicking on it? If there are 50+ identifiers imported from a specific module, I'm not sure if making it explicit would improve readability. I've seen a lot of beginners accidentally clicking on that code-lens. (This is kind of off topic though) |
I think one of the problems is hlint suggestions are controversial. If we could agree in a minimal set of suggestions which fits most uses, from beginners to advanced ones maybe the recommendations and code refactors will be less disturbed. |
The problem with defaulting features to off (e.g. hlint, code lenses on imports) is that it's approximately equivalent to deleting these features. We should assume that most people won't reconfigure their editor, which means most things should be on by default (because they are useful) or deleted (because they only impact a few users and aren't worth the hassle). I think a perfectly reasonable code action on any HLint suggestion would be "disable all hlint warnings" which would drop a suitable disable-everything .hlint.yaml, or change the config (no idea which is the better idea). That way users can very quickly disable it. Similarly, I think having a code action on the first import which is annotated saying "disable these annotations" would be good too. I also agree that whether hints are displayed or not should be very much in the editors choice. If they want to hide hints while warnings/errors exist, that should be an editor configuration. If they want to disable hints entirely, that should also be an editor choice. While HLint suggestions aren't universally applicable, the default set has been much reduced from the past. Most things are mostly a good idea. Not universally, but mostly. |
So if everyone agree i think we could close this when the last action was done (and optionally when we check editors has the required control over diagnostics) |
I'm not sure where exactly the right place to discuss this is, how there should be a consensus, or whether this has already been deliberated on before, but I'd like to toss an opinion out there: hlint is more hindrance than a help.
At present the workaround I have for myself is to add an
.hlint.yaml
file to every project with the following contents:But my concern arises because we're about to teach a beginner workshop where, for the first time, we expect the majority of students to be following along with vscode and haskell-language-server installed. Haskell already offers a tremendous source of distractions from the small carefully-chosen set of core ideas we can try to get across in a few hours, without hlint interjecting its suggestions and bringing up things like eta reduction, tuple sections, etc. while people are still working on understanding types and basic syntax.
For myself, I also find the blue squiggles and additions to the Problems tab in vscode to be superfluous distractions from work. I don't really understand what the intended target audience is for the information that hlint provides, or why this information would need to be omnipresent while we code.
hlint itself acknowledges that...
But the experience of using vscode and haskell-language-server is that the hints are presented in the absence of this explanation. The messages appear under the "problems" tab as read as imperative commands like "Use fewer brackets". To anyone who doesn't already know better, they appear confident and authoritative in this context.
The text was updated successfully, but these errors were encountered: