Commit Graph

173 Commits (e39bef9611c501004b9d97aae98735e4ec34520e)

Author SHA1 Message Date
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
Wilfred Hughes 7caaaf7fcf Handle nested sliders correctly when preferring the outer delimiter
Previously we didn't check the state of children, which was an
oversight from the original implementation. As a result, we fixed
nested sliders in fewer situations.

Fixes #535
2023-07-14 08:49:55 +07:00
Wilfred Hughes 5606c04261 Treat qualified modules and variables as atoms in Haskell 2023-07-12 12:34:39 +07:00
Wilfred Hughes a814e01d22 Improve word diffing heuristic and add another sample file 2023-07-12 12:12:32 +07:00
Wilfred Hughes c2b7042b80 Do subword highlighting in more cases
This is useful when two strings substantially differ, but have the
same e.g. end.
2023-07-10 21:26:24 +07:00
Wilfred Hughes 5824322244 Require some common words to do subword highlighting
This is important when comparing short string literals. This change
has improved several cases in sample_files/ but I've added a new
example that made the previous unwanted behaviour much more obvious.
2023-07-10 09:03:21 +07:00
Wilfred Hughes 27f59c0b3a Don't treat - as a word constituent
This produces slightly better results with some string replacements.
2023-07-08 17:16:14 +07:00
Zhenge Chen ffd49d523a Detect replaced strings
If a string is replaced with another, apply subword highlighting
similar to how we handle replaced comments.

Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
2023-07-08 17:16:06 +07:00
Wilfred Hughes 87d27c5598 Only split numbers inside comments
Inside text files, it seems to be better to be conservative and
consider abc123def as one word rather than three.

This is noticeable when looking at changes to the compare.expected
file, which contains hashes. 123c456 and 345c789 don't really have a
`c` in common, so subword highlighting is ugly.
2023-07-07 08:40:06 +07:00
Wilfred Hughes c07e640b24 Remove contiguous penalty
The contiguous penalty was an attempt to fix the slider problem:

// Old
A B
C D

// New
A B
A B
C D

// Unwanted diff
A +B+
+A+ B
C D

However, it doesn't make sense for Dijkstra, which is stateless. The
best route from vertex X is independent of how we got to vertex X.

This worked by dumb luck: in some circumstances we terminate early
rather than fully executing Dijkstra's algorithm. This cost tweak
improved results on a few test files. However, the post-processing
slider logic is a proper, general solution. This was added much later.

There's no reason to keep the contiguous penalty now. It's confusing,
and makes adding new edge costs with consistent 'X costs more than Y'
behaviours more difficult.

Performance is essentially neutral: a small decrease in
typing_before.ml, a small increase in slow_before.rs.
2023-07-06 08:37:02 +07:00
Wilfred Hughes 43c24047b4 Don't track contiguous status on novel delimiter edges
This is harder to reason about, and
2e6666041f did not include a motivating
test case.

Removing contiguous status is a minor perf improvement (2% reduction
in instructions), makes the code simpler, and does not significantly
affect diffing results.

Of the two sample files that have changed, the erlang_before.erl file
has improved and nest_before.rs is neutral.
2023-07-04 23:53:16 +07:00
Wilfred Hughes c405b58327 Fix cost for ReplacedComment
This needs to be 2x novel nodes, or we prefer it far too often.
2023-07-02 23:12:31 +07:00
Wilfred Hughes 3730580ca3 Improve word splitting heuristics
This is particularly noticeable when diffing comments with timestamps
2000-12-31T23:59:59 where we don't want 31T23 to be a single word.
2023-06-29 08:33:30 +07:00
Wilfred Hughes 8b842387a1 Don't clean trailing newline before diffing
Difftastic should take the user's input as-is, or it risks performing
an incorrect diff in both textual and syntactic diffing.

Fixes #499
2023-03-30 08:46:11 +07:00
Wilfred Hughes 0ec2f3a319 Add test case that reproduces #499 2023-03-24 23:19:13 +07:00
Wilfred Hughes 3263612150 Update expected output for latest QML grammar 2023-03-17 00:55:59 +07:00
Wilfred Hughes a0f7ed5e78 Set explicit locales for ordering globs in integration test 2023-03-15 15:47:27 +07:00
Karl Ding 4a861c376e Manually order expected sample comparison file
It appears that the GitHub Actions runner is returning the glob path
results in a different ordering than the ordering obtained when locally
running the compare_all.sh script. This difference in the ordering
causes CI to fail due to differences to the generated expectation file.

This also seems to have been an issue in previous PRs---the solution
here is likely to sort the output before processing or figure out what
shell options cause the difference in glob ordering, and explicitly set
those in the shell script to eliminate the difference (or prevent the
script from inheriting anything but shell defaults).

For now, try reordering the output by hand to match the ordering the
GitHub Action runner likely expects.
2023-03-14 21:46:40 +07:00
Karl Ding 6b2947b4e9 Add Ada "Hello World" sample file 2023-03-14 21:46:40 +07:00
Wilfred Hughes 045d6a2c58 Treat Newick and Racket as lisps 2023-03-03 00:23:11 +07:00
Wilfred Hughes 9556cd978e Merge branch 'delehef/master' 2023-02-21 08:46:07 +07:00
Franklin Delehelle 21ded51e90 Add newick example files 2023-02-21 08:45:49 +07:00
6cdh 5e659e2d98 add racket highlight 2023-02-21 08:30:00 +07:00
6cdh 3c418168a4 fix bug in here_string 2023-02-12 16:45:38 +07:00
6cdh 2fade3e0bf fix here string 2023-02-12 13:57:45 +07:00
6cdh fe756905bf added Racket support 2023-02-12 13:39:58 +07:00
Wilfred Hughes 96fc044e6d Improve syntax highlighting
`@include` and `@exception` are both used for highlighting keywords in
several languages.
2023-02-10 08:50:43 +07:00
Wilfred Hughes 0f1d323bf3 Disable lua-match? highlighting predicates
This fixes inaccurate type highlighting in Scala.

See #310
2023-02-10 08:45:41 +07:00
Wilfred Hughes 5db907f393
Merge pull request #481 from hugo-vrijswijk/master
Update tree-sitter-scala
2023-02-08 17:52:46 +07:00
Wilfred Hughes df6f4618b6 Update expected output for 62da0d56cc 2023-02-08 17:51:28 +07:00
Wilfred Hughes 18b46812c0 Update C++ expected output for 63cf71641a 2023-02-08 17:49:05 +07:00
Hugo van Rijswijk afad33c71e update compare.expected 2023-02-08 11:16:19 +07:00
Wilfred Hughes 7d5afd78dc Respect --error-limit when parsing
Next step for #472
2023-02-04 22:29:18 +07:00
Wilfred Hughes 5ed4bac8a5 Add support for R
Fixes #470
2023-01-26 08:50:00 +07:00