Commit Graph

730 Commits (cc064349acc283de01b24711349d47608e127442)

Author SHA1 Message Date
Wilfred Hughes 6760559e6f Increase MSRV to 1.65
See discussion in #570
2024-01-28 12:55:07 +07:00
Wilfred Hughes 73a6a61b27 Add VHDL to changelog 2024-01-28 12:35:11 +07:00
Wilfred Hughes 2d61aefb84 Fix tab replacement in single-column display
Fixes #617
2024-01-07 19:35:33 +07:00
Wilfred Hughes bc0cbaf3ae Change default tab width to 4
This is more consistent with web UIs like GitHub, so I think it's a
better default.
2024-01-07 13:15:12 +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 8eebc24165 Roll version 2024-01-07 00:33:16 +07:00
Wilfred Hughes 7eb2f99077 Update changelog for previous commit 2024-01-05 21:07:46 +07:00
Wilfred Hughes db0c150f61 Report permission changes
Fixes #605
2023-12-30 11:20:00 +07:00
Wilfred Hughes 8b90c95e01 When called with a single path, require conflict markers
Fixes #585
2023-12-29 19:39:44 +07:00
Wilfred Hughes c180fb52a9 Treat strict types in Haskell as atoms
This isn't ideal: it prevents a finegrained diff of syntax within a type, but it
beats claiming that the code is unchanged.

Fixes #607
2023-12-28 19:24:35 +07:00
Wilfred Hughes 26c58a25e8 Treat regex literals as atoms in Clojure 2023-12-17 10:46:15 +07:00
Wilfred Hughes 1bed379115 Document salesforce apex in the changelog 2023-12-07 08:56:28 +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 b9a1302e54 Bump MSRV to 1.63
In the past I've been more cautious, but this is the version supported
by Debian Stable, and it's more than 12 months old.

A decent number of dependencies are only tested against newer rustc
versions (see e.g. the recent aho-coarasick pin due to no MSRV on that
library). I've filed bugs in some cases, but upgrading rustc versions
more aggressively should make this problem less common.
2023-11-26 01:24:29 +07:00
Wilfred Hughes 5153b9f17c Document the changes in the 0.53.1 release 2023-11-26 01:12:58 +07:00
Wilfred Hughes 7e50c2d8a2 Roll version 2023-11-24 01:22:49 +07:00
Wilfred Hughes 2cab9ac1d6 Document --sort-paths in changelog 2023-11-24 01:12:11 +07:00
Wilfred Hughes 4c6336fe33 Document change to directory diffing 2023-11-24 01:03:41 +07:00
Wilfred Hughes fe62cf4cf5 Don't ignore novel blank lines
Fixes #575
2023-11-18 17:27:41 +07:00
Wilfred Hughes 635e62c19b Support .snap files
Closes #571
2023-11-18 14:50:54 +07:00
Wilfred Hughes 4284c3578a Increase MSRV to 1.60 2023-10-31 16:34:59 +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 8400000b3b Merge commit '494fb7644a9d2bbe4c7a0c5db2ef94d2aad6b0d8' 2023-10-26 08:46:53 +07:00
Wilfred Hughes 21ed3ec48b Add missing environment variable for --skip-unchanged
Fixes #581
2023-10-13 08:41:38 +07:00
Wilfred Hughes 69060fd617 Document SCSS support 2023-10-11 20:00:44 +07:00
Wilfred Hughes 67dbf0e962 Add --strip-cr
Closes #486
2023-10-10 08:36:57 +07:00
Wilfred Hughes b0dac91e50 Roll version 2023-10-08 20:07:24 +07:00
Wilfred Hughes b07e5198b5 Remove prebuilt musl binaries in release config 2023-10-08 15:40:39 +07:00
Wilfred Hughes ab1966b7d2 Merge commit '3fef30de8aee74600f25ec2e319b62a1a870d51e'
Update JSON parser. This allows multiple items, so JSONL is no longer
a parse error.

Fixes #528
2023-10-07 10:47:05 +07:00
Wilfred Hughes 1e7866b64e Do word diffing on text too 2023-09-12 13:03:27 +07:00
Wilfred Hughes 004a0da67f Flatten modifiers in C# to improve highlighting 2023-09-08 23:44:11 +07:00
Wilfred Hughes 9134593a39 Add XML support
Fixes #10
2023-09-08 23:43:20 +07:00
Wilfred Hughes d56f775f31 Highlight constructors consistently with type names 2023-09-03 01:30:22 +07:00
Wilfred Hughes 79b4e44113 Update changelog for today's releases and roll version 2023-08-25 09:26:28 +07:00
Wilfred Hughes 72475493a4 Tweak wording 2023-08-24 08:19:27 +07:00
Wilfred Hughes fa20bd9d44 Add Linux with musl, Linux on aarch64, and macOS on aarch64 targets
Use cross to cross-compile from Ubuntu to these platforms.

This will resolve #357 and #368 when the next release goes out.
2023-08-23 20:56:03 +07:00
Wilfred Hughes 9403e410c2 Merge commit 'c01fb4e38587e959b9058b8cd34b9e6a3068c827' 2023-08-21 08:52:30 +07:00
Wilfred Hughes 3f042da6bf Updated Rust parser 2023-08-18 22:44:36 +07:00
Wilfred Hughes 050a81aadf Updated bash parser 2023-08-18 22:25:57 +07:00
Alex Krantz 11a96e5aec Add JSON cli flag 2023-08-17 08:49:59 +07:00
Wilfred Hughes 11899a237c Roll version 2023-08-15 23:40:23 +07:00
Wilfred Hughes def88bbb43 Fix spelling in CHANGELOG 2023-08-15 23:01:09 +07:00
Wilfred Hughes e0a1405453 Add the ability to parse conflict markers and diff the two files 2023-08-15 09:01:15 +07:00
Wilfred Hughes 56230d1c69 Merge commit '06a2f6e71c7fcac34addcbf2a4667adad1b9c5a7' 2023-08-08 23:39:19 +07:00
Wilfred Hughes 4e77f83dd9 Merge commit '7dc4fb60390218b09bc351062eeede7dcdbb4d9f' 2023-08-08 23:37:28 +07:00
Wilfred Hughes 34d20d6665 Merge commit 'a2861e88a730287a60c11ea9299c033c7d076e30' 2023-08-08 23:24:08 +07:00
Wilfred Hughes 3eb014c0a7 Merge commit 'bbaa67a180cfe0c943e50c55130918be8efb20bd' 2023-08-08 23:22:22 +07:00
Wilfred Hughes db8797d6c2 Merge commit '7aa24fe8616072fc1a659f72d5b60bd8c01fb5cc' 2023-08-08 23:01:48 +07:00
Wilfred Hughes a187d7a134 Improve rename styling
It should use the heading with colour, consistent with other modes,
and the header should come before rename information.
2023-08-08 08:53:33 +07:00
Wilfred Hughes 4fdc8eebcd Increase MSRV to 1.59 2023-08-07 20:32:08 +07:00
Wilfred Hughes 892d4fdb58 Ensure size_hint never exceeds graph_limit
If we have thousands of syntax nodes on both sides, we can end
up attempting to preallocate a very large hashmap.

In #542, a user hit an issue with two JSON files where the LHS had
33,000 syntax nodes and the RHS had 34,000 nodes, so we'd attempt to
preallocate a hashmap of capacity 1,122,000,000. This required
allocating 70,866,960,400 bytes (roughly 66 GiB).

Impose a sensible limit on the hashmap.

Fixes #542
2023-08-04 17:19:27 +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 448972f8a3 Roll version 2023-07-26 20:02:23 +07:00
Wilfred Hughes b3acf48128 Bump minimum required Rust version to 1.58
Difftastic is generally conservative about MSRV, and will only
increase the version when there is a compelling reason (e.g. major
performance improvement, important bug fix in a dependendency).

This version increase will enable us to upgrade crossterm to 0.26, which
has better detection of terminal width on Windows.

I've also clarified MSRV details for other dependencies that cannot
currently be upgraded.
2023-07-26 11:34:05 +07:00
Wilfred Hughes 69da133ab0 Merge commit '2c7aff437deed72bbceceab95797b3909cc4627d' 2023-07-24 21:50:22 +07:00
Wilfred Hughes f43e91faf7 Merge commit 'ad095896dd223f1c22b85ac5ec84ab11fb732b07' 2023-07-24 21:28:47 +07:00
Wilfred Hughes 4e9637c861 Check more bytes when detecting encoding
I've observed PDF files that have sufficiently large headers that they
were detected as text, which wasn't helpful.

Also improve logging to report how many invalid bytes were found.
2023-07-21 08:34:41 +07:00
Wilfred Hughes 1c0b3153df Fix typo 2023-07-21 08:32:17 +07:00
Wilfred Hughes 2d23eb549d Document the new LaTeX support 2023-07-20 23:05:18 +07:00
Wilfred Hughes a15b92afaf Merge commit '6c8329e2da78fae78e87c3c6f5788a2b005a4afc' 2023-07-15 15:59:11 +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 a5d3cb55b7 Treat constructors consistently with variables in Haskell atoms 2023-07-12 17:34:42 +07:00
Wilfred Hughes 2d2a1484fd Roll version 2023-07-12 17:10:34 +07:00
Wilfred Hughes 5606c04261 Treat qualified modules and variables as atoms in Haskell 2023-07-12 12:34:39 +07:00
Wilfred Hughes d9382640ed Mention the new subword string highlighting in the changelog 2023-07-10 09:04:53 +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
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 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
Alan Zimmerman 5dba13dcd5 Prepare version 0.1.0
Summary: Preparing to publish a new version of https://crates.io/crates/tree-sitter-erlang to bring in the recent changes for OTP 26 support.  And fix the ELP github CI

Reviewed By: michalmuskala, perehonchuk

Differential Revision: D46796302

fbshipit-source-id: 8320d63a5d8b3aa6829992864bf641fdea735ca5
2023-06-16 04:39:42 +07:00
Wilfred Hughes 63a5eeaa98 Update changelog for Scala parser update
Fixes #521
2023-06-12 22:28:56 +07:00
Wilfred Hughes b0a3a0ada9 Use DFT_LOG as the internal logging environment variable
Fixes #519
2023-05-21 23:33:34 +07:00
Wilfred Hughes 26bb4bb7ed Fix punctuation 2023-05-17 22:46:47 +07:00
Wilfred Hughes b2abf528b3 Fix markdown 2023-05-17 22:45:34 +07:00
Wilfred Hughes f1acd3aab4 Roll version 2023-05-16 21:13:51 +07:00
Wilfred Hughes b6895d42e4 Document the --override option in CHANGELOG and --help
This also enables users to disable language parsing.
Closes #439
Closes #440
2023-05-15 23:04:20 +07:00
Wilfred Hughes 84af470128 Remove --language 2023-05-14 15:57:43 +07:00
Wilfred Hughes 05a1b184ea Use globbing to match file names in language detection 2023-05-14 15:50:56 +07:00
Wilfred Hughes bde09efb80 Update changelog and tests for new path printing logic 2023-04-15 21:08:40 +07:00
Wilfred Hughes efd57ddbae Update changelog and manual for Solidity support 2023-04-12 00:56:13 +07:00
Wilfred Hughes 2296c9f739 Update version of next release 2023-04-01 16:20:17 +07:00
Wilfred Hughes 81ac13cbd3 Roll version following release 2023-03-31 08:37:06 +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 1e9f437688 Remove --missing-as-empty 2023-03-17 08:40:21 +07:00
Wilfred Hughes 6d99ea41c1 Merge commit 'ff1f0ac0f1c678a23f68d0140e75a0da8e11b7b5' 2023-03-17 00:46:11 +07:00
Wilfred Hughes 6ae589766c Merge commit 'ab75be9750e6f2f804638824d1790034286a830c' 2023-03-17 00:45:03 +07:00
Wilfred Hughes 6a455faa06 Merge commit 'b66d19b9b6ec3edf3d8aff0c20646acbdaa0afb3' 2023-03-17 00:14:19 +07:00
Wilfred Hughes e24ca47173 Merge commit '5720b249490b3c17245ba772f6be4a43edb4e3b7' 2023-03-17 00:13:21 +07:00
Wilfred Hughes aef2a84fa5 Merge commit 'f1106bf834703f1f2f795da1a3b5f8f40174ffcc' 2023-03-17 00:09:44 +07:00
Wilfred Hughes 8266e0a161 Merge commit '64457ea6b73ef5422ed1687178d4545c3e91334a' 2023-03-17 00:05:52 +07:00
Wilfred Hughes f76dfdc4f0 Merge commit '3c24aa9365985830421a3a7b6791b415961ea770' 2023-03-17 00:01:50 +07:00
Wilfred Hughes 1c01128050 Update changelog for last commit 2023-03-16 22:12:10 +07:00
Wilfred Hughes b914149ccf Merge commit '399605a02bcd5daa309ce63a6459c600dce3473f' 2023-03-16 08:20:22 +07:00
Wilfred Hughes 7fbe0d6c2f Improve UTF-16 detection heuristics and add test 2023-03-16 00:31:58 +07:00
Wilfred Hughes b1ecf00602 Merge commit 'fcacbeb4af6bcdcfb4527978a997bb03f4fe086d' 2023-03-15 23:50:56 +07:00
Wilfred Hughes 630e843a66 Merge commit '03fa93db133d6048a77d4de154a7b17ea8b9d076' 2023-03-15 23:24:58 +07:00
Wilfred Hughes b636201a8c Merge commit 'f35789006ccbe5be8db21d1a2dd4cc0b5a1286f2' 2023-03-15 21:49:50 +07:00
Wilfred Hughes 4eaba59c5e Merge commit 'b338fa9f4807b9e0336cd4dde04948a8c324a4cf' 2023-03-15 16:11:16 +07:00
Wilfred Hughes 20ad284882 Add 'vendored_parsers/tree-sitter-clojure/' from commit '421546c2547c74d1d9a0d8c296c412071d37e7ca'
Closes #448

git-subtree-dir: vendored_parsers/tree-sitter-clojure
git-subtree-mainline: ebfc043a4a
git-subtree-split: 421546c254
2023-03-15 15:43:55 +07:00
Wilfred Hughes a67be0f845 Treat quoted_keys as atoms in TOML 2023-03-15 15:12:33 +07:00
Wilfred Hughes 5d617a4c3f Add Ada to changelog 2023-03-15 15:08:46 +07:00
Wilfred Hughes 6ad77c620c Don't highlight text in purple
Closes #498
2023-03-14 23:47:17 +07:00
Jonatan Kłosko 869dff3ceb Release v0.1.0 2023-03-14 10:58:34 +07:00
Wilfred Hughes 8a36f69f5f Update changelog for #496 2023-03-13 23:08:45 +07:00
Wilfred Hughes ffd2c4a7fb Roll version 2023-03-03 08:44:56 +07:00
Wilfred Hughes 2d1a2c906e Count errors on the root node too
Fixes #377
2023-03-03 00:25:41 +07:00
Wilfred Hughes 045d6a2c58 Treat Newick and Racket as lisps 2023-03-03 00:23:11 +07:00
Wilfred Hughes 03985066f5 Treat Makefile text as atoms
Improves another case identified in #476
2023-03-02 23:52:01 +07:00
Wilfred Hughes f8a7ccee85 Use consistent formatting in changelog 2023-03-02 23:31:12 +07:00
Wilfred Hughes 0a060026e3 Roll version 2023-03-02 23:25:11 +07:00
Wilfred Hughes 667501adf6 Document the --parse-error-limit option added in 0.44 2023-03-02 23:23:33 +07:00
Wilfred Hughes c33d7f2520 Support --check-only on text files too 2023-03-02 08:50:45 +07:00
Wilfred Hughes c404917502 Update changelog and manual for Newick 2023-02-21 08:46:55 +07:00
Wilfred Hughes 1ff64dddcb Mention Racket in the changelog 2023-02-21 08:33:28 +07:00
Wilfred Hughes a7f06471e1 Update changelog 2023-02-10 08:52:07 +07:00
Wilfred Hughes 63cf71641a Display file size in the header if it's too big 2023-02-05 17:28:39 +07:00
Wilfred Hughes d425685284 Next version will be 0.44 2023-02-04 16:42:22 +07:00
Wilfred Hughes f43e0d7e9a Mention 0.43.1 in changelog 2023-02-04 15:26:53 +07:00
Wilfred Hughes 8d1b26e3f4 Update release dates in changelog 2023-02-04 14:10:15 +07:00
Wilfred Hughes 0177ce27f9 Mention #473 in the changelog 2023-02-02 22:19:52 +07:00
Wilfred Hughes bf26ec890f Update changelog for #475 2023-02-02 22:11:24 +07:00
Wilfred Hughes 5ed4bac8a5 Add support for R
Fixes #470
2023-01-26 08:50:00 +07:00
Wilfred Hughes 998c9e94ff Fix crash on repeated, partially novel lists
Fixes #469
2023-01-25 23:54:41 +07:00
Wilfred Hughes 6321b8ece2 Consistently append newlines regardless of colour mode 2023-01-25 16:55:12 +07:00
Wilfred Hughes 3291da6be4 Allow colour to be configured with DFT_COLOR too
In #468 it's also mentioned that this couldn't be configured with an
environment variable.
2023-01-25 16:44:41 +07:00
Wilfred Hughes 4337fbbcd8 Show the default value for --color and --display
Fixes #468
2023-01-25 16:40:12 +07:00
Wilfred Hughes 48c64297c5 Roll version 2023-01-15 20:15:40 +07:00
Wilfred Hughes daa7156a2c Fix crash with --display=inline and trailing whitespace
Line numbers may be less than .max_line(), as .max_line() trims
whitespace. Ensure pad_after() is robust to this, and add a test.

I could only reproduce the crash in inline display mode, but in
principle this could be an issue in all modes.

Fixes #452
2023-01-15 20:04:12 +07:00
Wilfred Hughes a488efd63b Add highlighting for ignored syntactic elements
This finishes --ignore-comment support.

Fixes #449.
2023-01-15 14:49:46 +07:00
Wilfred Hughes 0e3c57c64a Skip unique items before computing Myer's diff on text
This substantially improves performance on text files where there are
few lines in common.

For example, 10,000 line files with no lines in common is more than 10x
faster (8.5 seconds to 0.49 seconds on my machine), and
sample_files/huge_cpp_before.cpp is nearly 2% faster.

Fixes the case mentioned by @quackenbush in #236.

This is inspired by the heuristics discussions at
https://github.com/mitsuhiko/similar/issues/15
2023-01-15 11:38:02 +07:00
Wilfred Hughes efec759504 Only set language_used after a full syntactic diff
This fixes cases where the language is detected but the file hits the
byte limit.

Fixes #462.
2023-01-14 12:52:08 +07:00
Wilfred Hughes 08b3ff138f Rename vendor/ directory
Closes #453
2023-01-10 08:35:01 +07:00
Wilfred Hughes 63a3bf0c91 Ensure we use the correct config for sublanguage parsing
Otherwise get the wrong node names for atoms.
2023-01-08 22:24:43 +07:00
Wilfred Hughes 8ed4fbccfa Treat colour values (e.g. `#FFF`) as atoms in CSS 2023-01-08 22:22:46 +07:00
Wilfred Hughes 44168638f4 Next release will be 0.42 2023-01-08 22:21:56 +07:00
Wilfred Hughes fbe79aa408 Fix spelling 2023-01-08 21:46:02 +07:00
Wilfred Hughes 34967f588d Treat predefined_type as an atom in TypeScript
Currently it contains a nested string node, even though it's a fixed
set of known types. This was preventing us from applying good syntax
highlighting.

This was particularly noticeable with `string`, which wasn't
previously highlighted as a type.
2023-01-07 22:43:50 +07:00
Wilfred Hughes 610a6e441d Ensure that textual fallback diffing has a parse language of None
Previously we still passed the parse language after exceeding the
graph limit, leading to incorrect underline highlighting.
2023-01-06 19:07:05 +07:00
sogaiu ac25f8424e Add links to issues in changelog 2023-01-06 22:11:59 +07:00
sogaiu f821bbe156 Use a separate file for changelog 2023-01-06 22:06:05 +07:00
Steinar H. Gunderson 9133918dd4 Support parsing of sub-languages.
This allows given nodes (configurable per-language, using tree-sitter's
query syntax) to be re-parsed as other languages. The canonical example
is CSS or JavaScript inside HTML, which normally would be a single token
but now can get the full range of syntax highlighting and tree diffing.

The config sets this up for only two languages: HTML (contains CSS or
JavaScript in <script> or <style> tags; we don't support style="" or
onclick="" etc. at this point), and Makefiles (contains Bash in
$(shell ...) commands). The latter is fairly obscure; the big win is
in the former.

It would be nice to also have this support for PHP; however, the HTML
parser seems to be a bit confused when asked to parse the partial HTML
blocks we get if we just mark the "text" blocks as HTML, so for this
to work well, probably the PHP blocks should be parsed as sub-languages
of HTML instead of vice versa.

Also, as a minor quibble, there should be support for bash in Perl's
backticks (similar to in Makefiles), but the tree-sitter Perl parser
does not support backticks at all (it goes into error recovery).

There may have been languages that I've missed, e.g. some languages
might have nodes that contain e.g. SQL.

Fixes #382. Potentially relevant to #376.
2023-01-03 08:31:48 +07:00
Wilfred Hughes 0fc1842595 Improve word highlighting heuristics in comments
Previously we highlighted changed whitespace, which led to ugly
results if the number of words changed (there was a different number
of whitespace characters so some were highlighted).

Also treat _ and - as word constituents, as it produces nicer results
when people write example CLI invocations in comments.
2023-01-02 16:56:31 +07:00
Wilfred Hughes 87dcfd2cca Replace tabs in inline output too 2023-01-01 22:55:48 +07:00
Wilfred Hughes e8e5ca8e47 Replace tabs during display, so parsing sees the original source
Fixes #350
2023-01-01 22:44:47 +07:00
Wilfred Hughes 3c95b2ebbb Roll version 2022-12-28 15:12:58 +07:00
Wilfred Hughes 00ecf36a22 Pop delimiters immediately, rather than having ExitDelimiter* edges
@QuarticCat observed that popping delimiters is unnecessary, and saw a
speedup in PR #401. This reduces the number of nodes in typical graphs
by ~20%, reducing runtime and memory usage.

This works because there is only one thing we can do at the end of a
list: pop the delimiter. The syntax node on the other side does not
give us more options, we have at most one. Popping all the delimiters
as soon as possible is equivalent, and produces the same graph route.

This change has also slightly changed the output of
samples_files/slow_after.rs, producing a better (more minimal)
diff. This is probably luck, due to the path-dependent nature of the
route solving logic, but it's a positive sign.

A huge thanks to @QuarticCat for their contributions, this is a huge
speedup.

Co-authored-by: QuarticCat <QuarticCat@pm.me>
2022-12-28 02:00:09 +07:00
Wilfred Hughes 3b37b9a12c Expand symlinks before computing relative path for display paths
Fixes #447
2022-12-22 22:48:27 +07:00
Wilfred Hughes d18acce856 Update changelog for 08e7b5f41 2022-12-22 09:17:19 +07:00
Wilfred Hughes a2fa9fdbf5 Update changelog for fda897b81 2022-12-22 09:14:28 +07:00
Wilfred Hughes cadceb20b0 Show whole file names too with --list-languages 2022-12-19 09:33:53 +07:00
Wilfred Hughes 723e3dbd0e Roll version 2022-12-19 00:20:42 +07:00
Wilfred Hughes e0fcf2b84b Add a --check-only flag
Fixes #386
2022-12-18 23:55:22 +07:00
Wilfred Hughes a2f22cb17c Only set the exit code if --exit-code is set
This is important for usage with git log, which terminates on non-zero
exit codes.
2022-12-18 23:11:18 +07:00
Wilfred Hughes 6a46237bb0 Set the exit code when changes are found
Closes #285
2022-12-18 00:28:54 +07:00
Wilfred Hughes 2cf27ec7cd Display paths relative to cwd
Fixes #444
2022-12-16 10:08:38 +07:00
Wilfred Hughes afc78e976d Document Erlang support and add test
Fixes #394
2022-12-15 23:30:45 +07:00
Wilfred Hughes 7b31be8adb Improve binary file detection heuristics
Fixes #433
2022-12-08 10:29:35 +07:00
Wilfred Hughes 554fb18b7c Fix interleaved output when diffing directories
Fixes #437
2022-12-08 09:58:19 +07:00
Wilfred Hughes 8e190677e7 Roll version 2022-11-14 00:30:56 +07:00
Wilfred Hughes 2e7c90c472 Ensure line wrapping uses the same length on both sides
Closes #421
2022-11-13 00:35:06 +07:00
Wilfred Hughes b662a2220b Apply upstream tree_magic_mini patch to fix blank line crash
Fixes #378
2022-10-31 00:54:24 +07:00
Wilfred Hughes 7f7b35441b Ensure that inline display without color has newlines
This was broken in 3147eb8e6a when
newline splitting was made consistent, and
2071517621 only fixed the inline case
when color was enabled.

Fixed #383
2022-10-28 23:42:52 +07:00
Wilfred Hughes 28c3b0ef5d Tweak line number styling to make it more distinct from content
Dim line numbers for unchanged lines, and make changed lines bold (in
addition to the existing red/green colours).

Closes #384
2022-10-28 20:34:36 +07:00
facebook-github-bot a8b8b0e16c Initial commit
fbshipit-source-id: ba4d26ff8ff932e614e343d0c8cac90abf5f2776
2022-10-19 08:51:29 +07:00
Wilfred Hughes b9d44ae65f Treat error nodes as atoms
Fixes #408
2022-10-15 22:50:08 +07:00
Wilfred Hughes e91878fb32 0.37 is now released 2022-10-14 16:10:27 +07:00
Wilfred Hughes 6b0009c941 Mention perf improvements from #393 and #395 2022-10-14 13:50:00 +07:00
Wilfred Hughes b4ff28c75e Fix side-by-side line length when colour is disabled
Fixes #406

Looks like this was inadvertently broken in #301.
2022-10-14 13:15:17 +07:00
Wilfred Hughes b6ddd152d0 Add the ability to configure how many lines of context are shown
See #242
2022-10-13 12:34:52 +07:00
Wilfred Hughes 308a9c842a Update changelog for Swift parser update 2022-10-09 16:02:19 +07:00
Wilfred Hughes 345a88fe53 Support - as a CLI argument
Fixes #389
2022-09-24 17:23:47 +07:00
Wilfred Hughes b7e95d2b1d Mention Chinese manual in changelog 2022-09-24 17:01:47 +07:00
Wilfred Hughes ee688b43f2 --list-languages should respect --color
Fixes #387
2022-09-21 21:49:24 +07:00
Wilfred Hughes c602503dec Treat . as punctuation
Closes #388
2022-09-21 21:39:07 +07:00
Wilfred Hughes f71ce08407 Don't assume that Windows is building on MSVC
The flag /utf-8 is supported by cl.exe, but gcc.exe interprets it as a
non-existent linker script.
2022-09-18 15:08:53 +07:00
Wilfred Hughes 88222e83c4 Prepare for patch release with fixed Windows build 2022-09-17 23:55:00 +07:00
Wilfred Hughes d5ae17d3d5 Roll version following release 2022-09-17 20:18:59 +07:00
Wilfred Hughes ba6d73bcf4 Document Hare in manual and changelog 2022-09-15 09:39:41 +07:00
Wilfred Hughes 3c51f58d8e Add Pascal support
Fixes #365
2022-09-13 00:05:23 +07:00
Wilfred Hughes 23f6a15838 Update changelog for 888894d0f 2022-09-12 23:03:54 +07:00
Wilfred Hughes aff584af46 Don't crash when the line split boundary is on a combining character
Fixes #358
2022-09-12 23:02:20 +07:00
Wilfred Hughes f155a27522 Underline changed words in comments
This makes them easier to spot in larger changes.

Fixes #328
2022-09-10 15:54:04 +07:00
Wilfred Hughes fe30b7d86b Treat .zip files as binary unconditionally
Improves #358
2022-09-10 12:22:58 +07:00
Yuya Nishihara 84f0b25fb6 Add support for QML
QML is a UI language, and its syntax is basically JSON-like structure
+ JavaScript. The tree-sitter parser is named after the upstream grammar
file qmljs.g, but the canonical language name is QML. So I choose Qml as
the Language enum.

https://doc.qt.io/qt-6/qmlapplications.html
2022-09-10 11:38:35 +07:00
Wilfred Hughes fe5ef8757d Give novel punctuation a lower edge cost
We'd rather see an unchanged variable name than an unchanged comma.

Fixes #366
2022-09-09 09:47:53 +07:00
Wilfred Hughes 9695d0009e Mention slider fix in changelog 2022-09-02 18:35:04 +07:00
Wilfred Hughes e15244c8f6 Roll version 2022-09-02 18:24:08 +07:00
Wilfred Hughes 5b866f8db3 Fix extensions for language detection with Makefile syntax 2022-09-02 11:42:28 +07:00
Wilfred Hughes fd571c98a7 Add a --list-languages option
Fixes #292
2022-09-02 11:41:05 +07:00
Wilfred Hughes 40dfd9eb29 Fix typo in .workflow extension name 2022-09-02 11:26:40 +07:00
Wilfred Hughes a04f867557 Fix terminal width detection
This was previously fixed in
cb900c3463 (see commit message), but
broken in #341.

Instead, use both term_size and terminal_size, to maximise our chances
that we can detect the width. Also comment the code with the relevant
terminal_size issue.

Fixes #346
2022-09-02 11:07:48 +07:00
Wilfred Hughes 8ff572d615 Copy crates.io note from the release info on 0.28 2022-09-01 09:18:32 +07:00
Wilfred Hughes 659f2dd6bd Add support for Makefiles 2022-08-28 16:26:01 +07:00
Wilfred Hughes b1b3756fa7 Attempt to detect and decode UTF-16 files too
Closes #345
2022-08-28 15:38:57 +07:00
Wilfred Hughes 1d1d883a9b Roll version 2022-08-27 23:00:33 +07:00
Wilfred Hughes a247218811 Set +whole-archive on C/C++ libraries
This fixes the build for Rust 1.61+ on some machines. I can reliably
reproduce this locally, but CI does not exhibit this issue (I'm not
sure why).

The Rust compatibility notes document this change:
https://github.com/rust-lang/rust/blob/1.61.0/RELEASES.md#compatibility-notes

and eventually this will be supported by cc:
https://github.com/rust-lang/cc-rs/pull/671

Fixes #339
2022-08-27 17:28:04 +07:00
Wilfred Hughes 09334030ab Fix incorrect line number being used in side-by-side display
Fixes #334
2022-08-22 09:34:34 +07:00
Wilfred Hughes f3420df1ca Roll version 2022-08-21 22:05:04 +07:00
Wilfred Hughes c957818514 Explore two graph nodes for each parenthesis position
This produces substantially better diff results, and fixes the 'last
item in the list shown as changed' problem.

This can produce slower diffing. typing_before.ml takes 10% more
instructions and slow_before.rs takes 110% more instructions.
2022-08-21 16:34:17 +07:00