-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Disable autofix by default #1657
Conversation
c286ef5
to
7b5e940
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1657 +/- ##
=======================================
Coverage 75.22% 75.22%
=======================================
Files 33 33
Lines 9054 9054
=======================================
Hits 6811 6811
Misses 2243 2243 ☔ View full report in Codecov by Sentry. |
i feel that most of the dislike of autofix was because of the var -> const one (which is already disabled now). i dont think ive seen many if any people complain about the discarding unused variables which ime helps a lot of people get over the unused variable error |
I've seen people complain about that unfortunately. I've just had enough of those comments so I'm going to merge this. |
7b5e940
to
f3fe901
Compare
Have you tried ignoring people that have a passion for complaining? =^_^= |
It's hard to ignore them when even your friends start saying the same stuff (albeit in a much nicer way). And they do have a point: editing people's code by default is a little jarring, I've experienced (and hated) this myself with the Go LSP, so I do get where they're coming from. |
That is a valid argument. That is something I would have liked to discuss in #1623. Let me make a counterargument: |
Just because other projects are doing something is hardly related to if zls should or shouldn't do it. Useful to study and figure out sure. But definitely not something to emulate! Good software will default having fewer opinions whenever possible. Formatting/style is opinionated by definition, and IIRC Zig formatting used to be required for the compiler to function. Consistent formatting is useful for source control features, and, the point of installing tooling. If I wanted to format my code myself, I wouldn't install a code formatter. But I didn't install ZLS because I wanted it to fix or format my code, I installed it to get better linting hints, and better syntax highlighting. I never wanted it to change my code. The problem for me isn't which fixup's it's making, the problem is that it's making decisions about my code without asking first. I think autofix is a great feature, and one zls should have. But it's not one I'd ever use, never for any of my code. It's not just jarring, it also breaks how I interact with code, unused variable warnings are compile errors for a reason, and I appreciate them! The author needs to make a decision, use the variable, or intentionally suppress it. Having my LSP do it for me, especially when I didn't want it, and when I didn't ask for it, is problematic. If autofix is happy to suppress these, errors why wouldn't it add Autofix shouldn't be enabled by default, because I don't trust autofix to act reasonably, if I want to take on the risk that something changed my code and I missed a bug because of it, that's my decision to make, but I should have to make the decision to enable it. I'm currently compiling from source myself because this is important to me, it's also mentioned as a warning every time I mention or suggest zls. Unsolicited rant aside, I only found out about this pull because I noticed the branch was added when I pulled to check for updates. So I just came by to say thank you @SuperAuguste, I really appreciate this change! |
Random comment of sympathy about the autofix feature. Having it enabled by default was super nice for me as a beginner (when iterating on code really quick it's quite annoying when something doesn't build because I quickly uncommented part of the logic). It's ok if it's not the default (I can sort of get the rationale), I enabled it for me since I highly value the speedup to the devtime when changing stuff around a lot. Thanks a lot for the feature, and thanks for making it the default for a bit, I wouldn't have discovered it without it, and it definitely eases the pain of zig complaining about unused variables (which again, I appreciate, but it's annoying when you're not trying to clean up your code, just iterating fast on some parts of your code while investigating something) |
Closes #1623