-
-
Notifications
You must be signed in to change notification settings - Fork 6k
diff: Update diffopt defaults to use indent-heuristic and inline:char #18255
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
diff: Update diffopt defaults to use indent-heuristic and inline:char #18255
Conversation
The default diff options have not been updated much despite new functionality having been added to Vim. - indent-heurstic: This has been enabled by default in Git since 33de716 in 2017. Given that Vim uses xdiff from Git, it makes sense to track the default configuration from Git. - inline:char: This turns on character-wise inline highlighting which is generally much better than the default inline:simple. It has been implemented since vim#16881 and we have not seen reports of any issues with it, and it has received good feedbacks.
|
You need to update the initial value of |
|
This proposes two separate new defaults for the diff options. I'm happy to separate them out if we only want one and not the other. Some additional thoughts below. indent-heuristic:
inline:char:
|
Done. Forgot to do that. |
|
Thanks, makes sense. Let me await updated CI runs. |
|
I just fixed the tests to use old defaults, by setting them to The DiffAdd is not visible in the above screenshot because |
Yes thanks makes senes. But wouldn't it also make sense to have those tests run under the new defaults? I am afraid we are now testing something that is no longer in so much use once we have changed the default. And I think we should make sure similar tests are run with the new defaults. Or do you think the existing tests that you provided in v9.1.1243 covers this? |
|
The way I look at it is that every feature should be tested and works, regardless of whether it's the default. Because the old tests were written against the old defaults (no indent-heuristic, inline:simple), there may be some hidden code coverage that's depending on triggering certain behaviors in those test cases that I don't really want to have to scrub through the code to find out. My opinion is if we think there are gaps in testing for indent-heuristics or inline:char, we should make sure those are tested and add new tests for those. I do believe I added enough regression tests for inline:char in the PR that added it that there shouldn't be any noticeable gaps in behavior though, which is why I don't propose adding more tests here. My goal here is to preserve the existing code coverage that should in theory already be testing with / without these features. |
This makes sure indent-heuristic and inline:char being defaults are actually checked.
|
Ok, despite what I wrote above, I made some changes so the new defaults will now actually be checked in tests. This at least makes sure the defaults won't be completely wrong. This required re-generating a couple screen dumps for Test_diff_cursorline and Test_diff_screen so they will enforce that the new defaults are actually in place and works correctly. I'm not sure if we want to do this across the board though (e.g. the line match tests). I feel that those tests should be focused on testing line match functionality. |
|
Alright thanks. I had to re-generate the screendump |
|
Ok thanks. I must have missed that. Feel free to ping me if there are issues with the new defaults. I think |
Problem: defaults: 'diffopt' option value can be improved
Solution: Update diffopt defaults to include "indent-heuristic" and
"inline:char" (Yee Cheng Chin)
The default diff options have not been updated much despite new
functionality having been added to Vim.
- indent-heurstic: This has been enabled by default in Git since
33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense
to track the default configuration from Git.
- inline:char: This turns on character-wise inline highlighting which is
generally much better than the default inline:simple. It has been
implemented since vim/vim#16881 and we have not seen reports of any issues
with it, and it has received good feedbacks.
closes: vim/vim#18255
vim/vim@976b365
Co-authored-by: Yee Cheng Chin <[email protected]>
Problem: defaults: 'diffopt' option value can be improved
Solution: Update diffopt defaults to include "indent-heuristic" and
"inline:char" (Yee Cheng Chin)
The default diff options have not been updated much despite new
functionality having been added to Vim.
- indent-heurstic: This has been enabled by default in Git since
33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense
to track the default configuration from Git.
- inline:char: This turns on character-wise inline highlighting which is
generally much better than the default inline:simple. It has been
implemented since vim/vim#16881 and we have not seen reports of any issues
with it, and it has received good feedbacks.
closes: vim/vim#18255
vim/vim@976b365
Co-authored-by: Yee Cheng Chin <[email protected]>
…35727) Problem: defaults: 'diffopt' option value can be improved Solution: Update diffopt defaults to include "indent-heuristic" and "inline:char" (Yee Cheng Chin) The default diff options have not been updated much despite new functionality having been added to Vim. - indent-heurstic: This has been enabled by default in Git since 33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense to track the default configuration from Git. - inline:char: This turns on character-wise inline highlighting which is generally much better than the default inline:simple. It has been implemented since vim/vim#16881 and we have not seen reports of any issues with it, and it has received good feedbacks. closes: vim/vim#18255 vim/vim@976b365 Co-authored-by: Yee Cheng Chin <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
My opinion is that diff results are never going to be completely backwards compatible in terms of creating identical behaviors, e.g. when Vim updated the diff engine to xdiff, or when maybe Git changes how the algorithm works (that said Git is usually quite conservative in doing so). The other main reason I proposed the change for using That said I can see how some may see this as a surprise, since As for indent-heuristic, I highly doubt it will be an issue. As I mentioned it has been the default in Git shortly after it was implemented years ago. Most people never noticed, other than the diff results being a little better aligned. |
|
Thanks, I'll feel like the whole inline diff feature greatly improves the diff mode, as such I feel like the old behaviour was too simplistic and therefore I think the new default setting makes sense. For the indent-heuristics, I agree that no-one will notice the change, as it will generally improve the diff experience in certain edge cases, which otherwise people won't notice any case |
…eovim#35727) Problem: defaults: 'diffopt' option value can be improved Solution: Update diffopt defaults to include "indent-heuristic" and "inline:char" (Yee Cheng Chin) The default diff options have not been updated much despite new functionality having been added to Vim. - indent-heurstic: This has been enabled by default in Git since 33de716387 in 2017. Given that Vim uses xdiff from Git, it makes sense to track the default configuration from Git. - inline:char: This turns on character-wise inline highlighting which is generally much better than the default inline:simple. It has been implemented since vim/vim#16881 and we have not seen reports of any issues with it, and it has received good feedbacks. closes: vim/vim#18255 vim/vim@976b365 Co-authored-by: Yee Cheng Chin <[email protected]>




The default diff options have not been updated much despite new functionality having been added to Vim.
indent-heurstic: This has been enabled by default in Git since 33de716 in 2017. Given that Vim uses xdiff from Git, it makes sense to track the default configuration from Git.
inline:char: This turns on character-wise inline highlighting which is generally much better than the default inline:simple. It has been implemented since Improve diff inline highlighting using per-character/word diff #16881 and we have not seen reports of any issues with it, and it has received good feedbacks.