1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +00:00
serenity/Userland/Libraries/LibCpp
Shannon Booth f690807c5a LibDiff: Change underlying representation of Hunk to allow context
The existing hunk data structure does not contain any way to easily
store information about context surrounding the additions and removals
in a hunk. While this does work fine for normal diffs (where there is
never any surrounding context) this data structure is quite limiting for
other use cases.

Without support for surrounding context it is not possible to:
 * Add support for unified or context format to the diff utility to
   output surrounding context.
 * Be able to implement a patch utility that uses the surrounding
   context to reliably locate where to apply a patch when a hunk range
   does not apply perfectly.

This patch changes Diff::Hunk such that its data structure more closely
resembles a unified diff. Each line in a hunk is now either a change,
removal, addition or context.

Allowing hunks to have context inside of them exposes that HackStudio
heavily relies on there being no context in the hunks that it uses for
its' git gutter implementation. The fix here is simple - ask git to
produce us a diff that has no context in it!
2023-07-02 11:18:11 -06:00
..
Tests LibCpp: Support for parsing c-style fixed arrays (arr[2]) 2023-04-26 09:40:25 +01:00
AST.cpp LibCpp: Add support for type aliases with typedef/using 2023-06-18 20:30:21 +02:00
AST.h LibCpp: Add support for type aliases with typedef/using 2023-06-18 20:30:21 +02:00
CMakeLists.txt Everywhere: Mark dependencies of most targets as PRIVATE 2022-11-01 14:49:09 +00:00
Lexer.cpp LibCpp: Remove Nonnull*PtrVector from list of known SerenityOS types 2023-03-06 23:46:36 +01:00
Lexer.h Everywhere: Fix badly-formatted includes 2022-09-17 04:00:54 +00:00
Parser.cpp LibCpp: Add support for type aliases with typedef/using 2023-06-18 20:30:21 +02:00
Parser.h LibCpp: Add support for type aliases with typedef/using 2023-06-18 20:30:21 +02:00
Preprocessor.cpp LibCpp: Ignore the #error preprocessor directive 2023-06-18 20:30:21 +02:00
Preprocessor.h AK+Everywhere: Rename FlyString to DeprecatedFlyString 2023-01-09 23:00:24 +00:00
SemanticSyntaxHighlighter.cpp LibDiff: Change underlying representation of Hunk to allow context 2023-07-02 11:18:11 -06:00
SemanticSyntaxHighlighter.h AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
SyntaxHighlighter.cpp LibSyntax+Libraries: Replace TextStyle with Gfx::TextAttributes 2023-03-15 14:55:49 +01:00
SyntaxHighlighter.h LibSyntax: Teach each highlighter about it's comment syntax 2022-11-27 18:28:43 -07:00
Token.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
Token.h Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00