Commit Graph

206 Commits (8cdb59fa5edd896cd639592a9ee94673992bcb21)

Author SHA1 Message Date
Wilfred Hughes 8cdb59fa5e Normalise newlines before diffing
This produces good, consistent results on different trailing newlines
before, consistent with the behaviour before 7edd2a82cd (see #755).
2024-10-21 08:34:39 +07:00
Wilfred Hughes 7edd2a82cd Always consider newlines when diffing lines
StringIgnoringNewline caused crashes in code that assumed that two
equal values would hav the same string length.

This reverts 86612798ad. A better
approach would be to normalise line endings before diffing, but
additionally print whether files have/lack trailing newlines.

Fixes #755
2024-10-15 08:46:34 +07:00
Wilfred Hughes 1ac95534fe Don't push empty positions when diffing lines 2024-07-30 16:16:34 +07:00
Hugo van Rijswijk df76ea2369 Update compare result 2024-07-23 12:55:49 +07:00
Wilfred Hughes 92fa3fb3de Ensure files with no common content are aligned 2024-07-20 23:43:04 +07:00
Wilfred Hughes ffe27c575e Ensure line splitting distinguishes "foo" and "foo\n"
We rely on being able to split lines and rejoin them to obtain the
original string. `str::lines()` in the Rust stdlib does not have this
property.

This was causing crashes in word-diffing on textual diffing, where
code paths differed on the number of lines they thought a string had.

This was broken in 8b842387a1.

Fixes #688.
2024-07-20 16:09:44 +07:00
Wilfred Hughes 7827a059cb Update F# expected output 2024-05-25 14:58:14 +07:00
Wilfred Hughes d92b65c5fd Merge remote-tracking branch 'thecentury/f#' 2024-05-14 09:46:55 +07:00
Wilfred Hughes d292546df7 Prefer 'device tree' as two words 2024-05-13 16:59:48 +07:00
Wilfred Hughes d3e5aa5232 Merge remote-tracking branch 'blmaier/support-devicetree' 2024-05-13 16:50:13 +07:00
Wilfred Hughes 28d8673371 Treat tree-sitter nodes highlighted as comments as atoms
Fixes #711
2024-05-11 22:03:59 +07:00
Wilfred Hughes e51834fa77 Support comment.foo highlighting queries
This should improve highlighting in cases like Elm that use
`@comment.elm`.
2024-05-11 16:08:29 +07:00
Wilfred Hughes 5c40cd0282 Prefer _1 and _2 naming for test files
This is less to type, and it's now alphabetical, so e.g.
sample_files/*.kt just works as a test argument.
2024-04-28 23:28:06 +07:00
Wilfred Hughes 2e016566ac Update CSS parser 2024-04-28 21:45:25 +07:00
Wilfred Hughes 38f148df1f Don't flatten error nodes
As of b9d44ae65f (released in 0.38), difftastic prefers a textual
diff if any parse errors are present. As a result, users have to
opt-in to allowing parse errors. We can now preserve structure to
produce diffs that are more granular, at the slight risk of changes
being missed if parsers discard tokens.

Fixes #703
2024-04-28 17:28:34 +07:00
Wilfred Hughes 3be8e80fe7 Fix issue with later lines not having positions during diffing 2024-03-19 00:25:18 +07:00
Wilfred Hughes b78f7d447b Always replace tabs, even in single-column display
Fixes #617
2024-03-04 21:38:23 +07:00
Wilfred Hughes 7ddd8879b1 Merge branch 'scheme-support' of github.com:kutsurak/difftastic into kutsurak-scheme-support 2024-03-04 08:46:59 +07:00
Wilfred Hughes 53298e4240 Set a length limit on lines when doing a word diff
See #653
2024-02-29 00:54:55 +07:00
Brandon Maier e6b27caf06 Add support for devicetrees 2024-02-28 17:11:53 +07:00
Wilfred Hughes 7a00339977
Merge pull request #634 from evanrichter/smali
Smali language support
2024-02-19 11:57:54 +07:00
Wilfred Hughes 4fef3f7b00 Update regression test for QML parser 2024-02-15 23:40:56 +07:00
Wilfred Hughes e70224bb22 Update regression tests for new JS/TS parsers 2024-02-15 08:30:57 +07:00
Panagiotis Koutsourakis 67ada1ccd4 Add support for Scheme 2024-02-12 10:20:57 +07:00
Evan Richter d106c979ee add smali language support 2024-02-01 15:41:14 +07:00
Mikhail Brinchuk 297fa952c2
Merge branch 'Wilfred:master' into f# 2024-01-29 11:45:31 +07:00
Wilfred Hughes a3731067b2
Merge pull request #618 from arbrauns/tree-sitter-vhdl
Add tree-sitter-vhdl
2024-01-28 12:04:53 +07:00
Wilfred Hughes 6c4310e33b Remove macro from Objective-C sample file so it parses fully 2024-01-28 11:02:58 +07:00
Mikhail Brinchuk 9a894d5369 Added a regression test for F# 2024-01-28 12:36:13 +07:00
Armin Brauns c5638750d6 Add tree-sitter-vhdl 2024-01-09 09:23:51 +07:00
Wilfred Hughes 5c67ed08a9 Update integration test for new tab width 2024-01-07 19:26:07 +07:00
Wilfred Hughes db86b28a28 Add support for Objective-C
Closes #600

Co-authored-by: Nick Moore <nick@pilotmoon.com>
2024-01-07 12:50:19 +07:00
Wilfred Hughes db0c150f61 Report permission changes
Fixes #605
2023-12-30 11:20:00 +07:00
Wilfred Hughes 001279a2e1 Update expected output test 2023-12-08 21:51:29 +07:00
Rodolphe Blancho e18b5d0712
Merge branch 'master' into feature/salesforce_apex_support 2023-12-05 12:31:59 +07:00
Wilfred Hughes 569f0038d1 Always filter blank lines at start and end in positions
Fixes #595
2023-11-28 12:35:28 +07:00
Wilfred Hughes 8a58fb76ab Update regression test for SCSS capitalisation change 2023-11-25 01:20:31 +07:00
Wilfred Hughes fe62cf4cf5 Don't ignore novel blank lines
Fixes #575
2023-11-18 17:27:41 +07:00
Wilfred Hughes 778a6bee9a Flatten nullable types in Kotlin
Workaround for #589 and #411
2023-10-26 08:56:37 +07:00
Wilfred Hughes 81714c17ce
Merge pull request #573 from brneor/scss
Add Scss parser
2023-10-11 08:57:58 +07:00
Rodolphe Blancho 05d78ca741 add support for Salesforce Apex
Apex Language documentation:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm

Uses https://github.com/aheber/tree-sitter-sfapex
2023-10-06 11:08:02 +07:00
Wilfred Hughes 992437db1d Show the language name when parsing fails 2023-09-28 00:33:49 +07:00
Breno Reis fffbc17adc
add regression test for SCSS 2023-09-20 14:38:35 +07:00
Wilfred Hughes 8ebd6317d1 Add XML test file 2023-09-12 13:05:15 +07:00
Wilfred Hughes 1e7866b64e Do word diffing on text too 2023-09-12 13:03:27 +07:00
Wilfred Hughes d56f775f31 Highlight constructors consistently with type names 2023-09-03 01:30:22 +07:00
Wilfred Hughes fac4f3082b Update snapshot tests for new Rust parser 2023-08-18 23:07:54 +07:00
Wilfred Hughes 0af76db498 Update regression tests for humansize file formatting 2023-08-13 09:10:16 +07:00
Wilfred Hughes 757c297412 Adjust header style
Show the hunk count and detected language in a dimmed style. This
information is less important than the diff content itself, so this
change makes the important information more prominent.

First part of #544
2023-07-31 08:35:27 +07:00
Wilfred Hughes 797af40ae8 Improve Java highlighting 2023-07-27 08:33:38 +07:00