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
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