sourcegit icon indicating copy to clipboard operation
sourcegit copied to clipboard

[Bug] Python multiline string in diff hunk header breaks syntax highlighting

Open bwachtendorf opened this issue 1 year ago • 2 comments

Similar to #549 but not quite the same, so I figured it warrants a new issue.

When git diff interprets an object instantiation with a multiline string as a function header and includes the quotation marks in the header of the hunk, syntax highlighting breaks and interprets everything as a string: Example: syntax_highlighting_bugged_hunk_header

This fixes itself when the quotation marks are not included in the hunk header anymore. Example: syntax_highlighting_works_hunk_header

bwachtendorf avatar Oct 10 '24 06:10 bwachtendorf

Same reason as #549

love-linger avatar Oct 10 '24 06:10 love-linger

Can the hunk header not be excluded from syntax highlighting? I understand, that the issue in #549 requires a different approach to syntax highlighting, because the quotation marks are part of the changed code, but in this case the header is not part of the code. Is the complete diff highlighted instead of just the parts inside the hunks?

bwachtendorf avatar Oct 10 '24 06:10 bwachtendorf

I've checked the source code if AvaloniaEdit. To implement this feature, it is probably necessary to rewrite a AvaloniaEdit.TextMate. This is not in the development plan.

love-linger avatar Oct 12 '24 09:10 love-linger