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
Wilfred Hughes
6f1a069a75
Document usage of tree-sitter
2021-08-16 22:30:12 +07:00
Wilfred Hughes
414182c9dd
Only show a single column in side-by-side when adding a whole file
2021-08-08 23:25:26 +07:00
Wilfred Hughes
09a80150df
Fix adding/removing whole files
...
The 'remove unaligned lines at beginning of hunk' logic meant we just
discarded the whole hunk.
This breaks alignment again (previously fixed in 3ebbf268fd ), but that
should be fixed properly in the padding logic.
2021-08-08 23:15:23 +07:00
Wilfred Hughes
3ae0b7df84
Allow RHS to be arbitrarily long in a pager
...
If stdout is not a TTY, assume it's a pager and don't truncate the
RHS.
2021-08-08 17:35:31 +07:00
Wilfred Hughes
857cb77d8f
Ensure LHS and RHS source code are the same width
2021-08-08 17:31:18 +07:00
Wilfred Hughes
83b8c843cb
Use .. for column numbers on blank lines used to align
2021-08-08 11:26:17 +07:00
Wilfred Hughes
1ceaecfa25
Remove --width from CLI parameters
...
This is the first step in refactoring for inline diffs.
2021-08-01 15:30:12 +07:00
Wilfred Hughes
2e6666041f
Contiguous novel atoms are always better than changing depth of novel lists
2021-07-31 23:32:23 +07:00
Wilfred Hughes
34f084d8f1
Calculate content width based on visible lines
2021-07-31 17:21:55 +07:00
Wilfred Hughes
e67732bab9
Improve contiguous novel logic
...
Inspect the previous syntactic node, then get the atom position, open
delimiter position or close delimiter position depending on the
context.
2021-07-31 16:54:14 +07:00
Wilfred Hughes
a4751b98f1
Fix a parsing issue with -> in Rust
2021-07-31 01:25:16 +07:00
Wilfred Hughes
573cd32a01
Prefer matching comments that are similar
...
Previously, we'd match up any pair of comments with a levenstein
distance of 0.4 or more. This was reasonably effective, but misssed
opportunities even more precise diffs.
Instead, prefer the comment matching with the highest levenshtein
distance.
We still only highlight word-level changes for comments with a
levenshtein of 0.4 or more.
Closes #27
2021-07-30 22:54:30 +07:00
Wilfred Hughes
da63704675
Roll version
2021-07-28 00:04:47 +07:00
Wilfred Hughes
6f2140e901
Replace tabs with spaces before parsing
...
Difftastic uses offsets to store the positions of AST nodes, so we
cannot replace tabs after parsing.
A string literal with a tab character " " being replaced by a four
space string literal " " is now ignored by difftastic. This is
wrong: difftastic should only ignore whitespace between atoms.
This is still an improvement for source code that uses tab characters,
which is common in Go. The above case should be rare until we have a
full solution.
Fixes #24
2021-07-27 23:36:20 +07:00
Wilfred Hughes
a7f688ee82
Put a spacer between LHS and RHS lines printed
...
Width calculations already consider the spacer, but it was lost in a
refactor.
2021-07-27 22:02:48 +07:00
Wilfred Hughes
f24c4954bc
Update changelog for previous commit
2021-07-27 22:01:38 +07:00
Wilfred Hughes
7701e38510
Add a basic Go parser
2021-07-25 23:46:33 +07:00
Wilfred Hughes
e36a2e8c96
Don't crash on binary files
2021-07-25 12:50:42 +07:00
Wilfred Hughes
c8481775e2
Remove --context CLI argument
2021-07-25 12:34:50 +07:00
Wilfred Hughes
04214ef1ef
Ignore indentation changes on multiline comments
2021-07-25 12:27:24 +07:00
Wilfred Hughes
3ebbf268fd
Improve alignment when LHS and RHS have different numbers of lines
2021-07-24 18:01:12 +07:00
Wilfred Hughes
928584676a
Only highlight individual comment words for comments that are similar
2021-07-24 17:01:30 +07:00
Wilfred Hughes
3f8e41d862
Parse @ in elisp
2021-07-24 16:50:53 +07:00
Wilfred Hughes
45af6b4534
Parse < and > as symbols in elisp
2021-07-24 16:45:06 +07:00
Wilfred Hughes
2da5181ffb
Prefer replacing comments over novel atoms
...
This was broken in 4c33f34 .
2021-07-24 16:36:36 +07:00
Wilfred Hughes
6d7e155cc6
Remove unused CLI parameter
2021-07-24 16:27:33 +07:00
Wilfred Hughes
b81312e88b
Roll version
2021-07-22 00:09:13 +07:00
Wilfred Hughes
5d2c14a3f9
Entering a list should set the prev_novel state to the open delimiter
2021-07-22 00:07:09 +07:00
Wilfred Hughes
61446c916a
Prefer marking large subtrees as novel rather than largely novel
...
This solves the "replace function A with completely different function
B" problem, even if they start with the same function keyword.
2021-07-21 01:05:01 +07:00
Wilfred Hughes
c48e8e2977
Improve JS and JSON parsing
2021-07-20 01:18:39 +07:00
Wilfred Hughes
7bd8afc439
Improve handling of = and & in lisps
2021-07-20 01:09:29 +07:00
Wilfred Hughes
aa28b26f48
Basic support for non-UTF8 source files
2021-07-20 00:46:12 +07:00