-
Notifications
You must be signed in to change notification settings - Fork 325
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
Syntax highlight in the diff output #32
Comments
Yeah, I think syntax highlighting would be very worthwhile. It's not something I plan to work on until I've got the diffing logic solid, so it's not a high priority for me. For your specific example, I'm afraid difftastic doesn't support |
I would also love to get more syntax highlight. The minimal version that you did (dimmed comments and bold keywords) is already great. Thanks a lot for the hard work. |
See also #311. |
I do not understand whether the commit that closed this issue should fix the following: I inserted 2 lines into a Nix multi-line string, and
This is on |
Improve grammar and tags
…s/actions/checkout-3 Bump actions/checkout from 2 to 3
Mark the rule '_if_null_expression' explicitly as inline
@Wilfred Should #409 (comment) help with this? E.g. would one need to write code similar to the one added in 9133918 ? |
@nh2 I don't think sublanguages help here. In a generic string literal, there's no way for difftastic to know what the language in the string is. Better handling of multiline comments/string is what will really help here I think. |
@Wilfred It's shell script in ~95% of the cases. There are also some hints, e.g. the variable name that the string is assigned to. Separate question though: VSCode auto-detects languages based on heuristics; if it looks like shell or Python, it guesses it. Such thing would certainly help here. Does difftastic have a such functionality one could turn on / do the libraries it uses provide such features? |
It would be nice if there was syntax highlighting in the diff output, so the code structure is easier to understand.
Sample PL/SQL diff:
git version 2.33.0
![diff with git 2.33](https://user-images.githubusercontent.com/213894/132167666-c92a0f44-a692-40e3-9c3b-b7a3a4c48d84.png)
difftastic 0.8
![diff with difftastic 0.8](https://user-images.githubusercontent.com/213894/132167697-b93cfde1-e2ce-4c5e-b9b9-c55e4e220433.png)
delta 0.8.3
![diff with delta 0.8.3](https://user-images.githubusercontent.com/213894/132167724-41acc709-910c-4a46-8b3a-4303bbd41c56.png)
PL/SQL diff where the diff is within string literals (the indentation at line 256 looks odd, and I did not notice it before I took the screenshots).
The code is "PL/SQL code generator written in PL/SQL", and I do not expect that PL/SQL code within string literals to be highlighted as PL/SQL :) However, it would be nice if string literals were highlighted differently from the regular code.
git version 2.33.0
![git version 2.33.0](https://user-images.githubusercontent.com/213894/132168336-1087393c-a9b5-426e-94fc-a93d9a0ef54f.png)
difftastic 0.8
![difftastic 0.8](https://user-images.githubusercontent.com/213894/132168354-992084f2-fdec-48c2-b1ef-a36eda8e19dc.png)
delta 0.8.3
![delta 0.8.3](https://user-images.githubusercontent.com/213894/132168368-ac2a848f-571a-46ae-8ea0-94e6e1e232b2.png)
Re "string literals vs code" there's a semi-standard extension from IntelliJ: https://www.jetbrains.com/help/idea/using-language-injections.html#use-language-injection-comments
For instance, the following bit in Groovy code (Jenkins Job DSL code) is highlighted as XML in IntelliJ IDEA:
The text was updated successfully, but these errors were encountered: