-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 Highlighting Errors when Diffing - Fixed Format Fortran #19684
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Another test shows that the problem is related to If you rename the file from |
Workaround, either:
|
I can confirm that overriding the highlight mapping makes the diff more usable. Looking at this more closely though, the fixed format highlighting performed by the library is itself incorrect regardless of using fortranfixed or fortran. Fortranfixed is not resolving comments as actual comments. This can be seen in the example, lines 1-5 should be greyed out as comments, but are not https://try.gitea.io/test1765/fortran_test/src/branch/main/fortran_fixed.f So my original statement above that the fixed format highlighting was correct is actually false. |
There is a tricky thing in Gitea. When doing whole file rendering, the extension name is not respected, instead, Gitea will guess what's the language of the source file by its content, so even if the ext name is However, when Gitea is doing inline diff, it's done line by line without the guess, and only use the ext name as the language, then FortranFixed is used for |
Seems I forgot to update this issue. I had done some work upstream in Chroma for the parsing of fortran.
646 & 648 were included in Chroma 2.3.0, and 647 is in master awaiting a version tag. Chroma 2.3.0 has been merged into Gitea 1.18.0 branch. As the demo site is kept up to date, I need to check if the Chroma 2.3.0 inclusion has resolved most of this issue. |
Is there still any problem? Or should we hard-code |
Description
The chroma library had added a fixed format fortran syntax highlighter back in version v0.9.2, which gitea started using as of v1.15.0-RC1. The fortran fixed format syntax highlighting works for displaying files in gitea, however it is broken when displaying a diff of changes.
This can be see using the try.gitea portal:
The syntax highlighting is correct
https://try.gitea.io/test1765/fortran_test/src/branch/main/fortran_fixed.f
The syntax highlighting is incorrect when doing a diff
https://try.gitea.io/test1765/fortran_test/commit/228401fa1860d7aea71f3511937e49ee39d10938
Gitea Version
Tried both 1.16.4, 1.16.7
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
See https://try.gitea.io/test1765/fortran_test/commit/228401fa1860d7aea71f3511937e49ee39d10938
Git Version
No response
Operating System
ROCKY 8.5 (RHEL 8.5)
How are you running Gitea?
Used pre-built binaries for Linux x64, running on ROCKY Linux 8.5.
Database
No response
The text was updated successfully, but these errors were encountered: