-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Range of lines for fixers #850
Comments
I wonder if this use case is worth supporting. Not all tools support fixing ranges of lines. You often have to look at an entire file to know if you can fix something. A program for fixing errors should only really make changes where there are problems. Otherwise, why change anything? |
google/google-java-format supports a similar argument. |
While I agree that it won't work in all cases, I can think of many where it would provide clear benefit to simply refactor a single line/method/class. The most important argument being... I don't always want to refactor an entire file which causes a huge diff (and acompanying merge conflicts). |
I recommend writing smaller files. |
I generally don't need the fixers for code I wrote ;) And I can't control what my customers have running in all cases |
I agree that this would be a useful feature. I was excited about using Supporting this would be incredible! (And thanks for the already incredible plugin) My current workaround is something like this: |
Someone needs to figure out how to fit this into the existing API, including how fixer functions should be defined. Considerations need to be made when combining tools which do support fixing ranges with those that do not. |
Agreed, especially with languages such as python which are largely relying on whitespace this can be dangerous |
Some tools like
I'm curious, is this even working as you expect given what I wrote in my first paragraph? As far as I know you need to pass the
|
That works, assuming you select an entire function/class or other top-level code. Which already helps a lot imho :) It beats having to format everything yourself so I use similar tricks |
I've thought about how to support this a bit, and here is my plan.
With the above it would be possible to fix ranges of lines for the functions that support it, and ignore the output of others. You should expect weird results when mixing fixers which do and do not support fixing ranges. |
@w0rp, is there any update for us? It would be so so cool to be able to send a range of lines for a python linter. |
Thanks. I am using :'<,'>!black-macchiato . black-macchiato works on top of black |
Hey, thanks for this great linter plugin. I switched from syntastic recently and it's amazing how fast and responsive real time linting works. :)
In this commit I have added clang-tidy as a possible fixer for C and C++ code. However, often I only want to fix one specific line in a huge file (for example a missing semicolon or a missing
override
). Would it be possible to modifyALEFix
to accept a specific line or a range of lines? To stay compatible with existing code fixers could get an optional third parameter with a range of lines they can operate on.The text was updated successfully, but these errors were encountered: