Full-file syntax highlighting for diff pages#33766
Merged
Merged
Conversation
…acing placing spans for changes and not syntax highlighting the code
wxiaoguang
reviewed
Mar 2, 2025
wxiaoguang
previously requested changes
Mar 2, 2025
Contributor
There was a problem hiding this comment.
HTML encoding should be correctly handled, for example: <>
See new comment below #33766 (comment)
This comment was marked as outdated.
This comment was marked as outdated.
- reverting tests to be closer to original
… since we dont actually need to highlight the code here - adding newline in testcase
Contributor
|
Thank you very much. I can understand most of changes now. The idea is feasible, while there are still some details:
|
Member
Sounds acceptable to have a certain byte limit above which to fall back to hunk-based diff. Maybe 1-5MB or so. |
- adding conditions for when full file based highlighting should occur - falling back to hunk based highlighting in certain conditions - reverting original hunk-based highlighting tests - updating types to express intent better and to be more accurate i.e. `template.HTML` instead of string where appropriate
wxiaoguang
approved these changes
Mar 8, 2025
wxiaoguang
reviewed
Mar 8, 2025
Member
|
When expend more codes, it result in 500 |
Contributor
Fixed in b2dbc78 and added more tests |
silverwind
approved these changes
Mar 9, 2025
lunny
approved these changes
Mar 9, 2025
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Mar 10, 2025
* giteaofficial/main: Move notifywatch to service layer (go-gitea#33825) [skip ci] Updated translations via Crowdin Only keep popular licenses (go-gitea#33832) Removing unwanted ui container (go-gitea#33833) Full-file syntax highlighting for diff pages (go-gitea#33766) Improve theme display (go-gitea#30671) Decouple context from repository related structs (go-gitea#33823) Improve log format (go-gitea#33814) Decouple diff stats query from actual diffing (go-gitea#33810) Add global lock for migrations to make upgrade more safe with multiple replications (go-gitea#33706) Do not show passkey on http sites (go-gitea#33820)
hiifong
pushed a commit
to hiifong/gitea
that referenced
this pull request
Mar 10, 2025
Fix go-gitea#33358, fix go-gitea#21970 This adds a step in the `GitDiffForRender` that does syntax highlighting for the entire file and then only references lines from that syntax highlighted code. This allows things like multi-line comments to be syntax highlighted correctly. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 3f1f808)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #33358, fix #21970
This adds a step in the
GitDiffthat does syntax highlighting for the entire file and then only references lines from that syntax highlighted code. This allows things like multi-line comments to be syntax highlighted correctly.