Skip to content

[Proposal] Future improvments for code hightlight diff #20467

Closed as not planned
Closed as not planned
@wxiaoguang

Description

@wxiaoguang

Follows

Background

Gitea's code diff is based on highlighted code at the moment. #19958 only does some improvements, there are still some bad cases for rendering if the diff breaks in a highlighted span. See the screenshot, the diff result is inconsistent.

image

image

(more hints, in the second screenshot, the color of bbbb is different, it's also caused by that the diff breaks in the span)

Possible solutions

Use "semantic change expanding" algorithm

Expand the spans with semantics to other diff sections?

Use a general token parser

More aggressively, use placeholders for all tokens (make aaaabbbb a token), then there will be no break in tokens?

Some other diff algorithms

(TODO)

Some references

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions