Commit Graph

717 Commits (711d39975806233ce505abcea45998170d402579)

Author SHA1 Message Date
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
Wilfred Hughes 515932151f Merge branch 'cmake' 2022-08-20 18:36:07 +07:00
Wilfred Hughes bbdc324b7f Add CMake support
Fixes #333
2022-08-20 18:32:32 +07:00
Wilfred Hughes 58c8f47298 Also consider highlights.scm when marking nodes as comments
This removes the need to special-case Perl, and is necessary for
CMake (which has nodes bracket_comment and line_comment that aren't
marked as 'extra').
2022-08-20 18:28:07 +07:00
Wilfred Hughes fb38e7a24f Always use the RHS for language detection
Taking the longest path breaks if we have e.g. /dev/null and foo.py,
because foo.py is shorter.
2022-08-18 23:00:15 +07:00
Wilfred Hughes 01cce54978 Fix path display when called from git with two arguments
Fixes #332
2022-08-18 23:00:13 +07:00
Wilfred Hughes 5fe6d551d9 Always use the RHS for language detection
Taking the longest path breaks if we have e.g. /dev/null and foo.py,
because foo.py is shorter.
2022-08-18 22:58:43 +07:00
Wilfred Hughes 040dd3b0e2 Fix path display when called from git with two arguments
Fixes #332
2022-08-18 09:34:14 +07:00
Wilfred Hughes 6ce0717447 Note the newer rustc requirement 2022-08-12 12:39:00 +07:00
Wilfred Hughes a5aa433277 Mention #329 in the changelog 2022-08-12 12:25:02 +07:00
Wilfred Hughes 0c03187b96 Roll version 2022-08-07 18:16:16 +07:00
Wilfred Hughes f028389393 Update changelog for last commit 2022-08-07 18:13:04 +07:00
Wilfred Hughes 5d93efa51a Document Elm support in the manual and changelog
This was added in 0.26.
2022-08-02 09:15:11 +07:00
Wilfred Hughes bc283341f3 Use unique subtrees shared between LHS/RHS to determine similar lists
This makes the 'lists are sufficiently similar' heuristic more
aggressive. Previously we'd look for lists with common start or end
children and the same delimiters.

This worked badly for cases like:

LHS: (novel-lhs (a b c d e))
RHS: (novel-rhs (a b c d e))

Instead, look for sublists that are unique on both sides and occur on
both the LHS and RHS root being considered. This allows us to match up
many more cases.

Consider lists to be sufficiently similar exclusiely using this
(surprisingly effective) heuristic, and don't consider outer
delimiters.

This substantially improves performance in many cases, particularly
for files that are fairly flat (many toplevel lists with little
nesting).

Fixes #306
2022-07-19 21:58:37 +07:00
Wilfred Hughes 3e320bb1cb Bump version number 2022-07-12 00:12:21 +07:00
Wilfred Hughes 8547987830 Add Hacklang support 2022-07-11 22:13:37 +07:00
Wilfred Hughes 38c6718c86 Improve handling of /dev/null paths when there are two CLI argsuments
When git calls us, we always know the file name. If we're called with
two arguments and one is /dev/null, use the other for language
detection and display.
2022-07-11 21:41:04 +07:00
Wilfred Hughes f2ca7cf314 Add SQL support
Closes #311
2022-07-11 09:31:34 +07:00
Wilfred Hughes 144f7d9e30 Updated TypeScript parser 2022-07-10 23:42:54 +07:00
Wilfred Hughes 2d0af395f9 Updated Scala parser 2022-07-10 23:39:13 +07:00
Wilfred Hughes 5c48a7fcef Updated Ruby parser 2022-07-10 23:36:05 +07:00
Wilfred Hughes 91bebc3caa Updated Python parser 2022-07-10 23:24:45 +07:00
Wilfred Hughes 15f77cb1de Updated PHP parser 2022-07-10 23:22:43 +07:00
Wilfred Hughes 40a66f4cd4 Updated OCaml parser 2022-07-10 23:21:09 +07:00
Wilfred Hughes 548b7c1d17 Updated JSON parser 2022-07-10 23:08:29 +07:00
Wilfred Hughes ecff4f8036 Updated Java 2022-07-10 23:06:25 +07:00
Wilfred Hughes 9e1744bf02 Updated HCL parser 2022-07-10 23:04:12 +07:00
Wilfred Hughes 18078a0e37 Updated Haskell parser 2022-07-10 23:00:55 +07:00
Wilfred Hughes c5a5555862 Update Gleam parser 2022-07-10 22:58:50 +07:00
Wilfred Hughes dead5e8a8a Update changelog for Elm parser bump 2022-07-10 22:49:01 +07:00
Wilfred Hughes 6b3d8e24f6 Updated Dart parser too 2022-07-10 22:43:38 +07:00
Wilfred Hughes cc4501c645 Document the C# parser update 2022-07-10 22:31:04 +07:00
Wilfred Hughes 2071517621 Fix duplicate newlines in inline display mode
Fixes #314
2022-07-10 20:28:42 +07:00
Wilfred Hughes 0e7ab02741 Mention syntax highlighting fixes in last release
Introduced by d785886294
2022-07-04 20:07:49 +07:00
Wilfred Hughes c745de51b0 Roll version 2022-07-04 20:05:31 +07:00
Wilfred Hughes 36e11985ce Mention Julia in changelog 2022-07-04 20:04:27 +07:00
Wilfred Hughes 9cff13985e Update changelog for #301 2022-07-04 15:23:38 +07:00
Wilfred Hughes d96ccc884f
Merge branch 'master' into add-html-parser 2022-07-03 21:40:57 +07:00
Wilfred Hughes f10cfa00cc Limit the graph size based on the number of predecessors found
Fixes #183
Fixes #306
2022-07-03 18:23:17 +07:00
Benjamin Manns d131ae1d35 Add HTML parser 2022-07-01 12:23:20 +07:00
Wilfred Hughes 17f98a7f4d Next release will be 0.29.1 2022-06-13 16:49:55 +07:00
Wilfred Hughes e369f5b53f Mention performance improvements 2022-06-09 10:19:20 +07:00
Wilfred Hughes dd80e58640 Roll version 2022-06-09 10:12:46 +07:00
Wilfred Hughes 6970b443b0 Document MIME database configuration and paths 2022-05-19 23:19:54 +07:00
Wilfred Hughes 3eada5b9b0 Prefer outer delimiter in lisps 2022-05-11 11:54:02 +07:00
Wilfred Hughes 1a6c5b8e7f Display rename information when before and after paths are different 2022-05-08 11:52:42 +07:00
Wilfred Hughes 5103389d23 Mention Elvish in changelog 2022-05-07 11:26:35 +07:00
Wilfred Hughes 03c5d78650 Treat perl regexes as atoms too 2022-04-29 18:28:01 +07:00
Wilfred Hughes 3bb5933163 Ensure Perl comments are treated as atoms with an atom kind of comment 2022-04-29 18:23:31 +07:00
Wilfred Hughes 75a3624f7c Treat files with null bytes as binary 2022-04-29 18:08:38 +07:00
Wilfred Hughes 77fb9cd179 Roll version 2022-04-29 16:52:45 +07:00
Wilfred Hughes 12ef8f97da Allow syntax highlighting to be disabled
Fixes #265
2022-04-29 12:12:21 +07:00
Wilfred Hughes e1cbdc1478 Allow users to override the tab width
Fixes #274
2022-04-28 20:47:04 +07:00
Wilfred Hughes 72eba2d426 Added Swift support
Closes #225
2022-04-28 09:29:58 +07:00
Wilfred Hughes f5b07f265a Fix changelog heading 2022-04-27 21:51:29 +07:00
Wilfred Hughes f98f2a8aca Fix directory diffing when files were only present on one side
This particularly helps usage with mercurial when files are added or
removed.

Fixes #272
2022-04-27 21:46:46 +07:00
Wilfred Hughes 1b90fcd6aa Don't assume paths are valid UTF-8 2022-04-26 22:33:42 +07:00
Wilfred Hughes f7c09510a1 HCL: document and add more file extensions 2022-04-24 20:21:10 +07:00
Wilfred Hughes ee0f1ee7f2 Diff files in directories in parallel 2022-04-24 20:17:47 +07:00
Wilfred Hughes c8c7d3570e Improve JSON detection 2022-04-23 18:55:13 +07:00
Wilfred Hughes bfcd4cc88a Add docs and syntax highlighting for Perl 2022-04-23 10:44:52 +07:00
Wilfred Hughes 91c3102666 Update changelog for previous commit 2022-04-22 00:51:51 +07:00
Wilfred Hughes e67ca22fc6 Roll version 2022-04-18 09:36:30 +07:00
Wilfred Hughes a91a3e5db0 Handle namespaced highlighting queries 2022-04-18 09:35:09 +07:00
Wilfred Hughes 34fd5ba7eb Render tabs with 8 spaces (previously 4)
Most web UIs seem to do this (e.g. on GitHub), and C code from the
Linux kernel assumes 8 spaces in a tab when aligning things.
2022-04-17 20:13:53 +07:00
Wilfred Hughes a7e298dfa1 Merge commit '06dfec714e2424be9d19aacb739771746f5aec2b' 2022-04-17 19:10:56 +07:00
Wilfred Hughes 65b62fbefe Merge commit '8e9dba7bd7cf089838a036a98be94db53ba2d0a9' 2022-04-17 17:08:35 +07:00
Wilfred Hughes 5c9d820eb2 Merge commit '0b107de5415e7470a30ef1a390d9db3306432bdb' 2022-04-17 17:02:08 +07:00
Wilfred Hughes f03e7f063f Merge commit '78c4e9b6b2f08e1be23b541ffced47b15e2972ad' 2022-04-17 16:58:01 +07:00
Wilfred Hughes d9b9ec45a8 Merge commit 'e7cb801ef57f74db5c4ebe14df74de852bb451b5' 2022-04-17 16:57:12 +07:00
Wilfred Hughes 653d187950 Merge commit 'ed976b81b00ce7b72b99bca75e7a616cc526220c' 2022-04-17 16:50:04 +07:00
Wilfred Hughes 30cab49688 Merge commit 'c8fed1f0847a65a04a4b8cb7655f5f416e0742ca' 2022-04-17 16:41:36 +07:00
Wilfred Hughes bea5bb235a Merge commit '1dabc1c790e07115175057863808085ea60dd08a' 2022-04-17 16:39:04 +07:00
Wilfred Hughes 7bfb15c03f Merge commit '5b6ae1f88e741b9ed738891ad1362fb9f2041671' 2022-04-17 16:35:04 +07:00
Wilfred Hughes 019a137f4a Merge commit 'a832195eb3685a279856bb480ce19cff19554b6d' 2022-04-17 16:33:09 +07:00
Wilfred Hughes 3b36271959 Split large lists that are mostly unchanged
Fixes #156
2022-04-17 15:54:27 +07:00
Wilfred Hughes 6b24e28c28 Add support for TOML 2022-04-14 21:21:36 +07:00
Wilfred Hughes 1a93162740 Fix block sclars in YAML 2022-04-14 18:45:48 +07:00
Wilfred Hughes 47fe0cfc42 Add some more common keyword-ish capture names for highlighters 2022-04-14 00:40:09 +07:00
Wilfred Hughes 059fc824ff Add Kotlin support
Closes #220
2022-04-14 00:21:29 +07:00
Wilfred Hughes 92b3c6e932 Use clap's built-in env var feature
Fixes #239
2022-04-12 23:57:20 +07:00
Wilfred Hughes f496da2d1e Difftastic is now available as GitHub releases
Closes #193
2022-04-10 15:58:42 +07:00
Wilfred Hughes a43adb2f4b Document build fixes in 0.26.2 2022-04-10 13:00:14 +07:00
Wilfred Hughes 890c28a5ac Update changelog for 0.26.1 2022-04-10 12:39:15 +07:00
Wilfred Hughes 1830d286e0 Ensure unchanged MatchedPos have the same number on LHS and RHS
Fixes #246
2022-04-09 21:12:31 +07:00
Wilfred Hughes 1c9ae2fbc6 Fix parsing of built-in Zig identifiers
Fixes #248
2022-04-09 19:38:07 +07:00
Wilfred Hughes 3c6db050dc Roll version 2022-04-09 19:01:54 +07:00
Wilfred Hughes 053de5acbe Update to Clojure parser with separate symbol positions
See discussion in https://github.com/sogaiu/tree-sitter-clojure/issues/21
2022-04-09 12:41:49 +07:00
Wilfred Hughes 2162b5c67b Add a changelog entry for 42884b73a0
Some users seem to be seeing this build failure, e.g. #245.
2022-04-08 22:40:10 +07:00
Wilfred Hughes 1c416733ef Fix nested sliders in C-like languages
Improves #165
2022-04-08 09:41:56 +07:00
Wilfred Hughes bdb68cd676 Support @boolean and @character highlighting queries 2022-04-03 22:36:15 +07:00
Wilfred Hughes 0c1e539373 Update CHANGELOG and manual for new languages 2022-04-03 22:10:09 +07:00
Wilfred Hughes 01678f8556 Don't pad the right column in side-by-side display
Helps with #209 too.
2022-04-03 11:30:19 +07:00
Wilfred Hughes 03b8a4cb5a Update changelog and parser docs for recent additions 2022-04-02 17:21:39 +07:00
Wilfred Hughes 28c6e35943 Merge #205 2022-04-02 17:18:59 +07:00
Wilfred Hughes e472acb805 Add a --language option to override language detection
Fixes #199
2022-04-01 23:10:48 +07:00
Wilfred Hughes 97b9a13d15 Expose a proper `--display` CLI option
This helps with discovery of the different display options available,
such as inline (see #34).
2022-04-01 22:15:24 +07:00
Jacob Rothstein 9945270f4b
add gleam
# Conflicts:
#	CHANGELOG.md
#	README.md
2022-03-31 14:08:05 +07:00
Wilfred Hughes bef93e9626 Roll version 2022-03-31 09:47:58 +07:00
Wilfred Hughes 299c321e72 Treat interpolated strings as atoms in PHP
This makes diffing slightly less useful for large strings, but it's
consistent with the other languages.
2022-03-31 09:34:03 +07:00
Wilfred Hughes a1ec5e88e8 Fix side-by-side display when source contains CRLF
Fixes #212
2022-03-31 09:32:21 +07:00
Wilfred Hughes 559d0f9b6b Fix Java delimiters `[` and `]` 2022-03-30 23:23:44 +07:00
Wilfred Hughes 5703f75568 Don't assume that lines end with newlines
Previously we would crash if the last line in a file had no trailing
newline and ended with a multibyte character.

Closes #217
2022-03-30 22:42:17 +07:00
Wilfred Hughes ff37192918 Update changelog for last commit 2022-03-30 20:56:12 +07:00
Wilfred Hughes ecdf993ff1 Add support for Nix
Closes #196
2022-03-29 22:46:09 +07:00
Jafar eb29b824c3
Merge branch 'master' into pr-add_lua_parser 2022-03-30 06:23:20 +07:00
JafarAbdi b850d41fa5 Add lua support 2022-03-30 06:21:10 +07:00
Wilfred Hughes 646ab39cbb Mention that Janet is supported 2022-03-29 19:50:25 +07:00
Wilfred Hughes f26ca24df7 Discard '\n' nodes in C and C++
These are from the preprocessor grammar rules, but they're not useful
for difftastic.

Reported upstream: https://github.com/tree-sitter/tree-sitter-c/issues/97

Closes #180
2022-03-27 23:37:23 +07:00
Wilfred Hughes b6cd8c9a42 Update Clojure highlighting to match upstreamed PR
See https://github.com/sogaiu/tree-sitter-clojure/pull/20
2022-03-26 23:50:55 +07:00
Wilfred Hughes 1d7324c2dc Clarify wording when a parsed file has no changes at all 2022-03-26 23:31:12 +07:00
Wilfred Hughes 92b9680ecd Define a scala.scm of highlighting queries 2022-03-26 23:26:21 +07:00
Wilfred Hughes 5b1bc62ac6 Don't show hunk numbers when there's only one hunk
Related: #60
2022-03-26 22:52:04 +07:00
Wilfred Hughes bacefe5a58 Roll version 2022-03-26 16:02:51 +07:00
Wilfred Hughes 2b36a755f0 Ensure that blank lines in multiline strings are shown as changed
Fixes #121
2022-03-23 22:47:17 +07:00
Wilfred Hughes f15ec6d637 Lower the default node limit for tree diffing
Fixes #176
2022-03-22 21:15:54 +07:00
Wilfred Hughes 4647112e93 Define a highlighting file for Clojure
This isn't provided upstream, and the parse tree doesn't have a lot of
information, but we can at least handle string literals and keywords.
2022-03-22 21:08:46 +07:00
Wilfred Hughes c9c3582871 Print incrementally when diffing directories
Fixes #170
2022-03-22 09:51:23 +07:00
Wilfred Hughes 9e32e2e08e Ensure matched lines includes blanks at the ends of the file
Fixes #163
2022-03-20 22:31:32 +07:00
Wilfred Hughes 68f3ab2b92 Don't consider lines with whitespace to have missing syntax
Fixes #171
2022-03-20 19:49:13 +07:00
Wilfred Hughes 12ee2c7673 Warn if both arguments are the same path
Fixes #164
2022-03-20 15:14:14 +07:00
Wilfred Hughes 2fd48800c7 Update changelog for previous commit 2022-03-20 15:06:13 +07:00
Ömer Sinan Ağacan a2488f984c Add support for Dart 2022-03-20 11:07:32 +07:00
Wilfred Hughes 9435798c9c Next release will be 0.24 2022-03-19 10:27:04 +07:00
Wilfred Hughes 06ffa0267a Next release will be a patch release with a single crash fix 2022-03-19 10:24:30 +07:00
Wilfred Hughes d06f357c93 Fix crash when outer delimiters are discarded when skipping unchanged
If we skip some nodes inside a list whose delimiters are unchanged, we
need to mark the outer list as unchanged.

Split ChangeState::Unchanged into UnchangedNode and UnchangedDelimiter
to make this clearer, and add a test.
2022-03-18 16:00:05 +07:00
Wilfred Hughes b5187d98d0 Roll version 2022-03-17 22:22:42 +07:00
Wilfred Hughes e38d14a144 Prefer aligning blank lines in display
After we've aligned lines based on diff results, we have intermediate
lines that we need to align somehow. Previously, we'd just take them
in order, aligning the first on the LHS with the first on the RHS and
so on.

If the intermediate lines start or end with a sequence of blank lines,
prefer aligning the blank lines. If we have both, arbitrarily choose
the ending blank lines.

This has produced better results in many of the sample files, although
in the case of slow_before.rs we've just changed from a leading blank
line alignment to a trailing blank line alignment.
2022-03-17 22:16:45 +07:00
Wilfred Hughes 6d58247465 Preserve the outer delimiter when shrinking
Previously, we'd always discard the outer delimiter if it matched on
both sides. This prevented the tree diff finding optimal diffs.

Fixes #124
2022-03-16 23:38:05 +07:00
Wilfred Hughes d709aa98b5 Fix typo 2022-03-15 21:52:09 +07:00
Wilfred Hughes b2229d66a8 Always display all lines in a hunk
Previously we were assuming that the first/last line pairs in a hunk
contained the earliest/latest lines on both sides. This isn't true
when there are no common items between the lines.

This fixes some display issues in load_before/after.js, but include a
new integration test that is smaller and easier to eyeball.

Fixes #133
2022-03-15 00:11:30 +07:00
Wilfred Hughes 8c469e3d36 Ensure slider correction sets the opposite node on both sides
Fixes #154
2022-03-13 21:23:58 +07:00
Wilfred Hughes 19d11951ce Update changelog for c0d1faae6 2022-03-13 20:26:59 +07:00
Wilfred Hughes afb1b369f4 Switch to wu-diff for textual diffing
In #153 a user reported difftastic never terminated on a 140,000
file. This was due to the diff crate using a very large amount of time
and memory.

The diff crate does not use Myers' algorithm, which has a
divide-and-conquer approach using snakes:

https://blog.jcoglan.com/2017/03/22/myers-diff-in-linear-space-theory/

wu-diff does implement Myer's algorithm and performs much better on
these large files.
2022-03-10 23:12:25 +07:00
Wilfred Hughes a3a2bfb317 Roll version 2022-03-10 00:13:26 +07:00
Wilfred Hughes ed0bde6b91 Adding support for PHP 2022-03-09 23:52:31 +07:00
Wilfred Hughes 0927a2f9e6 Update changelog 2022-03-09 23:11:04 +07:00
Wilfred Hughes 17ff2bc07e < and > are delimiters in Rust and C++ 2022-03-08 20:42:57 +07:00
Wilfred Hughes 88ae00bd88 Use depth difference as a heuristic when comparing equal nodes
This reverts commit 7544874a55. It turns
out there are cases where this is still necessary (see new sample
file). It's also performance neutral.

This bug became more obvious with the recent 'skip unchanged'
optimisations. The optimisation changed the number of preceeding nodes and
exposed this bug more often.
2022-03-08 09:44:55 +07:00
Wilfred Hughes 6f65bbbbb0 Merge branch 'delim_type'
Introduce a new type EnteredDelimiter that tracks entering/leaving
list nodes. The PopEither and PopBoth cases reflect the choices more
accurately than a 2-tuple of options.

This is a performance hit (slow_before.rs runtime has increased by
49%) but it's important for diff correctness.

Fixes #147
2022-03-06 21:39:15 +07:00
Wilfred Hughes f82cace9bd Atom content equality should ignore highlighting
Improves several cases in #147
2022-03-05 11:37:10 +07:00
Wilfred Hughes 2d4ec0a4be Bump minimum Rust version to 1.56 for rpds support 2022-03-05 10:42:52 +07:00
Wilfred Hughes 25433a0c3d Only consider novel trees at the top level
Helps with #148. On my machine this changes slow_after.rs from 4.4 to
3.4 seconds, but only reduced instruction count from 12.8B to 10.4B.

The one changed case in sample_files/ is more granular and more
readable.
2022-03-02 22:55:22 +07:00
Wilfred Hughes cb0f1f3fe5 Roll version 2022-02-28 09:26:26 +07:00
Wilfred Hughes 128bad9ac9 Fix typo 2022-02-26 11:47:30 +07:00
Wilfred Hughes ea7d6b7257 Fix Unicode handling in word splitting 2022-02-24 09:36:51 +07:00
Wilfred Hughes 3aa9a48b25 Parse Emacs file headers when doing language detection
Fixes #145
2022-02-23 22:51:52 +07:00
Wilfred Hughes 562c215a06 Fix crash when a line-wrapped line has no styles
Fixes #142
2022-02-21 19:44:20 +07:00
Wilfred Hughes f1063bd1e7 Ensure we consider all unchanged nodes for calculating alignment
Fixes #141
2022-02-20 22:41:29 +07:00
Wilfred Hughes d8e8e12bf8 Roll version 2022-02-20 16:50:05 +07:00
Wilfred Hughes 82890923cd Track entering/leaving parents explicitly
This produces significantly better diffs, and fixes some cases that
were outright wrong before.

Fixes #30
2022-02-20 12:43:52 +07:00
Wilfred Hughes 692f08f1f1 Merge hunks when lines are adjacent 2022-02-19 16:12:04 +07:00
Wilfred Hughes 84a2dc2dac Fix missing context on misaligned hunks
Fixes #134
2022-02-12 12:26:00 +07:00
Wilfred Hughes 46301dbfa5 Don't crash on zero arguments 2022-02-12 11:04:52 +07:00
Wilfred Hughes ab1071cfda Increase the default value of DFT_NODE_LIMIT
Closes #136
2022-02-11 21:54:24 +07:00
Wilfred Hughes e561cdf580 Terminate after displaying a single column. 2022-02-08 23:50:15 +07:00
Wilfred Hughes 76fc3118ac Introduce a byte limit for files that are too big to parse
Default limit is 1 MB.

Fixes #131.
2022-02-08 23:44:50 +07:00
Wilfred Hughes 30c342913e Handle sliders of two steps
Fixes #132
2022-02-08 09:52:28 +07:00
Wilfred Hughes f4061d87fa Remove parser reference that was removed before release 2022-02-07 23:18:21 +07:00
Wilfred Hughes d9ec560f0d Roll version 2022-02-07 23:14:55 +07:00
Wilfred Hughes 1fa7f6450b Don't print .. after the last line in a file
Fixes #118
2022-02-07 22:18:49 +07:00
Wilfred Hughes ab8e8e4485 Treat NovelLinePart as a change
Previously we'd treat it as unchanged, leading to incorrect text diffs
when words were added on a single side.

Fixes #122
2022-02-07 20:37:01 +07:00
Wilfred Hughes e2832dabb3 Set a maximum size on syntactic diffing, and use line diffing otherwise
Fixes #82
2022-02-06 16:38:55 +07:00
Wilfred Hughes da05d6e69d Use italics for comments 2022-02-06 15:06:35 +07:00
Wilfred Hughes a3055083c1 Highlight JS keyword in TS files
Fixes #126
2022-02-05 13:40:45 +07:00
Wilfred Hughes 9e48b64d2c Add a --missing-as-empty flag to allow non-existent paths
By default, difftastic now errors if paths don't exist.
2022-02-03 21:26:51 +07:00
Wilfred Hughes 0dcb76eec1 Report whether a binary file has changed
Fixes #119
2022-02-03 21:03:50 +07:00
Wilfred Hughes 3e9d506256 Highlight built-in constants too 2022-02-03 00:27:35 +07:00
Wilfred Hughes 43605bd5e8 Add support for Hack 2022-02-02 23:22:15 +07:00
Wilfred Hughes 73c12d2b04 Syntax highlight comments in Clojure and Common Lisp
These don't mark their comments as 'extra', but use the node kind
"comment" so it's easy to detect them.
2022-02-02 23:10:06 +07:00
Wilfred Hughes d1aa1d4925 Line up additions and removals if they affect more than one line 2022-01-31 22:23:58 +07:00
Wilfred Hughes 52ef67ccbd Treat quoted_string in OCaml as an atom
Fixes #117
2022-01-31 21:41:53 +07:00
Wilfred Hughes 8f6b269492 Tag a 0.18.1 release 2022-01-30 22:56:19 +07:00
Wilfred Hughes 409f7aae75 Roll version 2022-01-30 18:03:45 +07:00
Wilfred Hughes ea24dd8784 Skip unchanged delim and find a fixpoint
This lets us discard more nodes before diffing, improving performance.

Fixes #84
2022-01-30 17:20:24 +07:00
Wilfred Hughes 82ce1ab818 Add a --skip-unchanged flag
Closes #98
2022-01-29 23:06:42 +07:00
Wilfred Hughes 2d3b08cc0a Document loop parsing fix 2022-01-29 18:22:47 +07:00
Wilfred Hughes 36c4520025 Provide an environment variable for controlling background colour
Fixes #55
2022-01-29 16:07:31 +07:00
Wilfred Hughes c38b072fd2 Add a --background option
Improves #55
2022-01-29 15:58:51 +07:00
Wilfred Hughes 0eeb91d591 Add a --color CLI option 2022-01-29 12:38:31 +07:00
Wilfred Hughes c0ba12bf68 Add a --width CLI argument 2022-01-29 12:13:21 +07:00
Wilfred Hughes fca1c6fffe Prefer 'normal' over white foreground colours
This is important in terminals with white backgrounds.

Improves #55
2022-01-27 22:18:06 +07:00
Wilfred Hughes 1b907e84c1 Fix character literals in Lisp
Improves #85
2022-01-27 21:53:21 +07:00
Wilfred Hughes 5cf143228f Treat attribute IDs in OCaml as atoms
Fixes #114
2022-01-27 20:25:17 +07:00
Wilfred Hughes 6fb800606e Get all matched lines and then slice
This is much simpler conceptually and less prone to bugs.

Fixes #111
2022-01-26 21:58:02 +07:00
Wilfred Hughes cb510375c1 Show ChangedCommentPart in bold 2022-01-25 22:55:30 +07:00
Wilfred Hughes 69dbad35ad Roll version 2022-01-25 22:32:18 +07:00
Wilfred Hughes e123cad49e Only set next/prev on potentially changed syntax nodes
Otherwise we end up running dijkstra on nodes at the end that we've
already marked as unchanged, and erroneously claim they're novel.

Fixes #112
2022-01-25 22:29:19 +07:00
Wilfred Hughes 440c94ce3c Don't treat identical text files as binary
Looks like a copy-paste mistake.
2022-01-24 20:34:34 +07:00
Wilfred Hughes f053529f76 Use bold for highlighting types too
Too many colours makes it harder to spot the red/green changed
sections, but it's nice seeing types distinctly.

This is probably the limit of syntax highlighting possible within the
current design, so consider #32 done for the time being.

Fixes #32
2022-01-23 11:56:27 +07:00
Wilfred Hughes 6ff60bf0c5 Add syntax highlighting on comments
Improves #32
2022-01-23 11:07:16 +07:00
Wilfred Hughes 94e968b660 Ignore unchanged nodes at the start/end of the file
This is the first part of #84.
2022-01-22 22:26:52 +07:00
Wilfred Hughes a2dc0b5109 Roll version 2022-01-22 19:03:58 +07:00
Wilfred Hughes de89caadb3 Don't consider newlines to be words in the line parser
This causes us to match up unrelated lines, and doesn't make sense for
a line parser.

Improves #90.
2022-01-22 17:56:12 +07:00
Wilfred Hughes e060ab31bf Fix another bug with duplicate line printing
hunk_end needs flipping when operating on the mirror image, as well as
the output.
2022-01-22 17:16:23 +07:00
Wilfred Hughes cb7122c937 Take an opposite line whenver possible when matching novel regions
Fixes #99
2022-01-22 13:16:33 +07:00
Wilfred Hughes b88ed07dc2 Update changelog 2022-01-21 21:42:34 +07:00
Wilfred Hughes b136369fd7 Revert "Prefer novel tokens on the same line, even if there are repeats"
This reverts commit 37a18401c6.
2022-01-20 19:12:52 +07:00
Wilfred Hughes 02a25ff251 Improve perf when diffing identical contents
Should help with #98.
2022-01-18 23:34:31 +07:00
Wilfred Hughes 109f1aac09 Consider previous context after fill when calculating after context
Fixes #80
2022-01-17 19:16:24 +07:00
Wilfred Hughes 37a18401c6 Prefer novel tokens on the same line, even if there are repeats
Fixes most cases in #76, but does not help with #56.
2022-01-15 19:38:18 +07:00
Wilfred Hughes 2d4ab5e494 Treat ocaml tags as atoms too 2022-01-15 11:00:41 +07:00
Wilfred Hughes c7b12d202f Treat ocaml type variables as an atom
The `'` in `'foo` gets a separate tree-sitter AST node, but the `foo`
does not. Treat the whole thing as an atom to avoid missing
highlighting on the `foo` part.

Fixes #89
2022-01-14 23:35:19 +07:00
Wilfred Hughes e404c0e86f Ensure we only calculate opposite positions once
Previously this was computed per-hunk, which was wasteful and slow
when there are many hunks.
2022-01-14 09:48:40 +07:00
Wilfred Hughes eeafbe681a Detect PKGBUILD and other common shell files
Fixes #95
2022-01-13 23:06:31 +07:00
Wilfred Hughes 8c6559ba81 Treat bash heredocs as atoms
Fixes #93
2022-01-11 19:14:04 +07:00
Wilfred Hughes 6ad40e10c4 Trim whitespace in JSX text
Fixes #72
2022-01-09 18:47:24 +07:00
Wilfred Hughes d240bfeebd Fix Mercurial when whole file has been removed
Mercurial gives us the path even when it doesn't exist. Just require
at least one of the paths to exist, rather than both.

(Git gives us /dev/null in this situation.)

Fixes #50
2022-01-07 09:42:56 +07:00
Wilfred Hughes a11e3081b2 Roll version 2022-01-06 01:00:48 +07:00
Wilfred Hughes c511b634f7 Only split source code on newlines once
Widths::new() is called once per hunk, so repeatedly splitting on
newlines can become a major performance bottleneck.
2022-01-06 00:54:52 +07:00
Wilfred Hughes 2f8a82de15 Document new textual differ
See #86
2022-01-06 00:54:05 +07:00
Wilfred Hughes c7c6f1a7b6 Print a newline on binary files, consistent with other files 2022-01-03 23:56:34 +07:00
Wilfred Hughes 40e23e4026 Improve alignment when the last line is novel 2022-01-03 12:43:43 +07:00
Wilfred Hughes 05be21d08e Fix typo in changelog 2022-01-01 20:28:45 +07:00
Wilfred Hughes 2dc480ec5c Updated typescript parser 2021-12-31 19:40:14 +07:00
Wilfred Hughes ba15ce8103 Updated Ruby parser 2021-12-31 19:39:22 +07:00
Wilfred Hughes efa8313e39 Update Python parser 2021-12-31 19:36:13 +07:00
Wilfred Hughes 13bf9f7f42 Update OCaml parser 2021-12-31 19:34:05 +07:00
Wilfred Hughes 5e8c116a3c Updated Java parser 2021-12-31 19:31:48 +07:00
Wilfred Hughes 75b29947b3 Updated Haskell parser 2021-12-31 19:31:11 +07:00
Wilfred Hughes 52af11744f Updated C# parser 2021-12-31 19:25:36 +07:00
Wilfred Hughes 426a95c552 Document C/C++ parser updates 2021-12-30 10:07:43 +07:00
Wilfred Hughes 3381a3dc60 Document bash parser update 2021-12-30 10:02:14 +07:00
Wilfred Hughes 177db1f652 Improve highlighting of blank lines in novel sections
If we're displaying a blank line and there's no opposite line, assume
it's novel and needs highlighting.

This is a best-effort heuristic, but it seems to work well.
2021-12-29 16:44:14 +07:00
Wilfred Hughes 667a42d57b Downgrade to tree-sitter 0.20.0
0.20.1 has a performance regression, which seems to particularly
affect Elixir parsing:
https://github.com/tree-sitter/tree-sitter/issues/1510
2021-12-29 14:59:12 +07:00
Wilfred Hughes 9d9f55a605 Document elixir parser changes 2021-12-29 10:45:44 +07:00
Wilfred Hughes 0cf68ef847 Roll version 2021-12-27 18:28:15 +07:00
Wilfred Hughes 9e3c6a7c9d Use shebang (if present) to detect language type 2021-12-27 17:33:14 +07:00
Wilfred Hughes 91db24fc9a Add language detection based on whole file names 2021-12-27 12:38:22 +07:00
Wilfred Hughes 382d498559 Fix crash when opposite side has unpaired lines
See #66
2021-12-18 23:30:16 +07:00
Wilfred Hughes 447ed2c14d Fix crash on unicode characters on line boundaries
Fixes #74
2021-12-11 15:58:07 +07:00
Wilfred Hughes 36857c3828 Allow terminal width to be overridden by DFT_WIDTH
Should help with #71.
2021-12-11 14:46:03 +07:00
Wilfred Hughes 6f1baae23e Prefer terminal_width crate so we support more platforms
term_width is unmaintained and does not support Windows.

Fixes #71
2021-12-07 23:24:13 +07:00
Wilfred Hughes bffbf1b779 Document release dates 2021-12-07 23:13:46 +07:00
Wilfred Hughes d820a4ed29 Document windows build fixes 2021-12-07 23:10:07 +07:00
Wilfred Hughes 4948f59855 Roll version 2021-12-04 23:56:42 +07:00
Wilfred Hughes e00f94fed8 Treat float values as atoms in CSS
Otherwise we treat `0.5em` as two atoms, unlike `1em` which was
already a single atom.
2021-12-04 18:34:24 +07:00
Wilfred Hughes aab3e7f2cc Treat regex literals and template string literals as atoms in JS/TS
Fixes #64
2021-12-04 18:19:15 +07:00
Wilfred Hughes 4f0fa617df Don't require flags that only disable warnings
These flags aren't strictly required, they're only used to prevent
warnings when compiling tree-sitter parsers.

Should help with compiling on MSVC, see #63.
2021-12-04 18:10:31 +07:00
Wilfred Hughes d9e149decc Log a warning on parse errors
Fixes #62
2021-12-04 18:02:36 +07:00
Wilfred Hughes 87c486742c Treat punctuation characters individually when splitting comments
Fixes #49
2021-11-30 22:45:10 +07:00
Wilfred Hughes 05873b546b Add support for Common Lisp 2021-11-26 22:53:21 +07:00
Wilfred Hughes 4b0f7708ae Expand file associations 2021-11-25 00:07:36 +07:00
Wilfred Hughes de56eabe94 Add support for bash syntax 2021-11-24 23:53:21 +07:00
Wilfred Hughes a5ed3fbd48 Add basic Ruby support 2021-11-20 01:08:33 +07:00
Wilfred Hughes 7c5a0aec0c Merge commit 'a03f1d2d1dfbf6f8e0fdca5f9ff030228241eb57' 2021-11-19 23:57:48 +07:00
Wilfred Hughes 153cc5eeca Merge commit '203e239408d642be83edde8988d6e7b20a19f0e8' 2021-11-19 23:56:55 +07:00
Wilfred Hughes f8427c6970 Merge commit 'fdeb68ac8d2bd5a78b943528bb68ceda3aade2eb' 2021-11-19 23:54:58 +07:00
Wilfred Hughes e8f45d91b8 Roll version 2021-11-19 00:49:14 +07:00
Wilfred Hughes d2f73e343c Document newer haskell parser commit 2021-11-14 16:51:47 +07:00
Wilfred Hughes 546391e9c0 Fix subword highlighting in multiline comments 2021-11-14 16:48:55 +07:00
Wilfred Hughes 9693d813d2 Document Haskell parser upgrade 2021-11-14 13:27:55 +07:00
Wilfred Hughes 25dae40dfa Display the file name even when there are no syntactic changes 2021-11-14 13:04:06 +07:00
Wilfred Hughes 8f0603e22b Merge branch 'truncate_lines' 2021-11-14 13:02:56 +07:00
Wilfred Hughes d3b38866a8 Document new hunk logic for display 2021-11-03 00:48:46 +07:00
Wilfred Hughes 0f8a2d3672 Highlight line numbers for lines with changes 2021-10-28 00:21:45 +07:00
Wilfred Hughes c23a36411d Only use bold for keywords in novel tokens
This makes added/removed regions slightly less prominent, but easier
to read. It also makes them more consistent with the styling on the
surrounding text.
2021-10-27 23:55:33 +07:00
Wilfred Hughes b3106e1382 Print file name and hunk number on every hunk 2021-10-23 16:52:49 +07:00
Wilfred Hughes c698f8979b Rename binary to `difft` for brevity 2021-10-23 16:19:33 +07:00
Sebastian Dröge ebebfdf23e Fix typo in CHANGELOG.md 2021-10-19 08:54:25 +07:00
Wilfred Hughes e82a3f62f7 Clarify syntax highlighting features in 0.11 2021-10-18 23:10:09 +07:00
Wilfred Hughes ddd05cf738 Fix heading in changelog that should be h3 2021-10-18 23:07:44 +07:00
Wilfred Hughes 44b025fdc5 Roll version 2021-10-18 22:42:17 +07:00
Wilfred Hughes 4287594cda Don't consider other paths when UnchangedNode is available
This substantially decreases the number of edges in our graphs,
especially when few nodes have changed. Diffing slow_before.rs with
slow_after.rs now takes half the time on my machine.

This makes diffing slightly greedier, so there may exist cases where
diffs are slightly worse. Comparing AXAB with AB is arguably nicer
as (+AX)AB rather than A(+XA)B. However, all the tests still pass,
and it's a huge perf win.

Closes #47
2021-10-18 22:23:44 +07:00
Wilfred Hughes febfbcea3e Make word diffs more granular
Fixes #39
2021-10-03 16:43:08 +07:00
Wilfred Hughes 98ca8ea106 Ensure that single-item tree-sitter lists are difftastic lists
This is important when executing tree-sitter queries, as highlighting
queries tend to target leaf nodes. Flattening the tree loses that.

This may also lead to more accurate diffing logic in some examples,
but I haven't found any obvious cases.
2021-10-01 23:57:15 +07:00
Wilfred Hughes 67916d260d Dim unchanged comments as a crude syntax highlighting technique 2021-09-30 00:07:37 +07:00
Wilfred Hughes b747cdcb01 Make bad position data more obvious (use purple) 2021-09-29 23:57:44 +07:00
Wilfred Hughes d37c87a1a5 Update changelog for patch release 2021-09-28 09:50:02 +07:00
Wilfred Hughes 9409e4fb4e Clarify platform in changelog 2021-09-28 09:41:08 +07:00
Wilfred Hughes ec37c5bef1 Add full Mercurial extdiff support 2021-09-26 21:23:22 +07:00
Wilfred Hughes 6ac01365c6 Update changelog for build fix 2021-09-26 21:21:02 +07:00
Wilfred Hughes 4e09fd0507 Match delimiters when converting from tree-sitter to syntax
Previously, we only handled simple cases like `(x)` where the first
and last token were the delimiter tokens. We now allow arbitrary
tokens before and after the delimiter, and wrap them in an additional
list.

This was more common in the C family parsers, but it's a general
problem. It also helps with robustness of JSX/TSX delimiter parsing of
`<`, where we now require a close `>` at the same level.
2021-09-25 22:25:05 +07:00
Wilfred Hughes 48efe9d7c4 Roll version 2021-09-24 23:40:07 +07:00
Wilfred Hughes c9f85d806e Document the main tricky cases with tree diffs 2021-09-24 23:33:25 +07:00
Wilfred Hughes 3b36e6486d Add C# support
Closes #37.
2021-09-22 22:37:53 +07:00
Wilfred Hughes f6ada434fe Add Haskell support
Fixes #36
2021-09-22 10:18:48 +07:00
Wilfred Hughes a0388c7d8b Optimise equal_content by checking num_descendants first
Traversing children is costly so we avoid it where possible. This
saves a further ~5% runtime on slow_before.rs/slow_after.rs.
2021-09-19 23:57:14 +07:00
Wilfred Hughes d7b0c917c1 Remove regex parser 2021-09-19 12:17:25 +07:00
Wilfred Hughes 6c08507b0d Add C++ support 2021-09-17 22:37:41 +07:00
Wilfred Hughes fb96b0a78d Add C support 2021-09-14 23:25:22 +07:00
Wilfred Hughes 31572a83a9 Roll version following release 2021-09-14 00:34:38 +07:00
Wilfred Hughes 7fa9b29e4d Factor out a lib.rs
This makes it easier for us to use tools that require a library, such
as criterion.
2021-09-13 00:41:58 +07:00
Wilfred Hughes 2da9747e26 Add more Rust delimiter tokens 2021-09-12 00:36:33 +07:00
Wilfred Hughes 9e9f7aff78 Update changelog for Rust parsing improvements 2021-09-11 21:11:41 +07:00
Wilfred Hughes eed16fc6d7 Simplify Dijkstra implementation
This is faster than the previous approach, and also less code.
2021-09-11 15:26:59 +07:00
Wilfred Hughes fd0dd8e75d Always use the full width for LHS column in side-by-side display 2021-09-06 15:21:20 +07:00
Wilfred Hughes 2ac459918a Add support for Elixir 2021-09-06 15:09:44 +07:00
Wilfred Hughes a39d4b3bb7 Use word-level diffs for text content too
We already do word-level diffs for comments, so use comment atoms in
the line-based parser.

Fixes #33
2021-09-06 12:47:20 +07:00
Wilfred Hughes d29bd46969 Associate more file extensions with Clojure
Fixes #31
2021-09-05 19:43:47 +07:00
Wilfred Hughes 34a5bd768d TSX is now supported 2021-09-05 19:37:28 +07:00
Wilfred Hughes 6d98fd86ab Configure typescript parser 2021-09-05 19:26:44 +07:00
Wilfred Hughes b6b0f8057b Treat integer values as atoms in CSS 2021-09-05 11:39:49 +07:00
Wilfred Hughes e3b2994aa9 Java parser was added in 0.7 too 2021-09-05 11:23:21 +07:00
Wilfred Hughes 0f042fb160 Roll version 2021-09-05 11:23:00 +07:00
Wilfred Hughes d99ada1573 Preserve leading whitespace when constructing comment nodes
Display relies on accurate content values. If we transform comment
contents, we would colour the wrong part of the source code when
displaying. See before/after.java sample files.
2021-09-05 11:13:05 +07:00
Wilfred Hughes e4b5bd4e19 Remove Scheme support
There's no tree-sitter parser available sadly, and I eventually plan
to drop the regex parser.
2021-09-04 18:30:17 +07:00
Wilfred Hughes 809d6383ad Document Python support 2021-09-04 17:05:11 +07:00
Wilfred Hughes 86a330c44e Add debug logging and log stats on shortest path found 2021-09-04 10:46:51 +07:00
Wilfred Hughes d1354c7174 Use a single-column display when whole files are added or removed 2021-08-29 23:42:59 +07:00
Wilfred Hughes cc93976969 Handle SIGPIPE
Based on the sample code in
https://stackoverflow.com/a/65760807/509706

Closes #28
2021-08-29 16:50:05 +07:00
Wilfred Hughes c662181cd6 Make tree-sitter the default parser 2021-08-29 15:17:40 +07:00
Wilfred Hughes 1dfedc6534 Ensure we use codepoints when slicing strings to avoid crashes
Rust will panic if we try to slice on a boundary that isn't a char
boundary. Count unicode codepoints and slice to the relevant byte.

Added a test file that was crashing before due to the use of curly
quotes.
2021-08-29 15:10:01 +07:00
Wilfred Hughes 32c3e9d0ca Fix another crash when removing a whole file in git 2021-08-28 12:53:55 +07:00
Wilfred Hughes 7f021e147d Improve handling of delimiters in all supported tree-sitter languages 2021-08-28 12:00:06 +07:00
Wilfred Hughes 2eb2f8b67d Add a --dump-ts debug option 2021-08-28 11:24:29 +07:00
Wilfred Hughes 1d0b1ad6b6 Add --dump-syntax for debugging the syntax tree 2021-08-27 22:32:48 +07:00
Wilfred Hughes 35779dde2e Remove unused --lang argument 2021-08-27 22:11:30 +07:00
Wilfred Hughes 309e4bc02c Match delimiter tokens based on their content 2021-08-26 23:51:06 +07:00
Wilfred Hughes bda2ce7d11 Improve string literals in tree-sitter parsers 2021-08-26 23:35:19 +07:00
Wilfred Hughes d5ce3e626f Fix missing string pattern for JSON parser 2021-08-24 01:12:11 +07:00
Wilfred Hughes 5d67ad3bea Merge display sections in changelog 2021-08-24 00:23:32 +07:00
Wilfred Hughes f17e0a5e0a Support colour when using git with a pager
Closes #29
2021-08-24 00:20:34 +07:00
Wilfred Hughes fad0775315 Fix crash on renaming files 2021-08-22 23:51:41 +07:00