Commit Graph

584 Commits (d8fb6413eff8fd874baf5138ac7e965dd79d9a26)
 

Author SHA1 Message Date
Wilfred Hughes d8fb6413ef Ignore local notes 2021-07-27 23:49:31 +07:00
Wilfred Hughes ad585be0fc Add another elisp sample file 2021-07-27 23:48:58 +07:00
Wilfred Hughes 2aae6b6e77 Add a JS test file showing a larger change 2021-07-27 23:48:03 +07:00
Wilfred Hughes 78d0a354db Add sample file for changing nesting levels of variables
The last expression `res` in `fn parse_lines` was previously handled
badly, choosing an inner `res` occurrence.
2021-07-27 23:46:11 +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
maekawatoshiki 725b346c58 Show help if no arguments given 2021-07-26 21:10:27 +07:00
Wilfred Hughes 7701e38510 Add a basic Go parser 2021-07-25 23:46:33 +07:00
Wilfred Hughes e6693d2204 Add TODO 2021-07-25 13:56:00 +07:00
Wilfred Hughes f8b6b8ae13 Define a SyntaxInfo::new helper 2021-07-25 13:52:30 +07:00
Wilfred Hughes 171236e2d5 Avoid recompiling another regex 2021-07-25 13:03:15 +07:00
Wilfred Hughes 9c37d854d1 Avoid .unwrap() when printing positions 2021-07-25 13:00:46 +07:00
Wilfred Hughes 6d5704aed9 Only compile the newline regexp once 2021-07-25 12:56:02 +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 a711d1e424 Fix spelling 2021-07-25 11:39:10 +07:00
Wilfred Hughes 280a5ffe9e Add alignment todo 2021-07-25 10:41:45 +07:00
Wilfred Hughes 9c71298f82 Define a separate Interval type rather than using RangeInclusive 2021-07-25 10:39:15 +07:00
Wilfred Hughes 64cc9ce973 Remove completed todo 2021-07-25 09:53:01 +07:00
Wilfred Hughes 818d69a84a Make clippy happier 2021-07-25 09:52:25 +07:00
Wilfred Hughes fe26935346 cargo fmt 2021-07-25 09:51:26 +07:00
Wilfred Hughes a5b11c5eca Update screenshot 2021-07-24 18:07:32 +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 1aeb68427d Simplify result printing so we don't need to concat after 2021-07-24 17:32:51 +07:00
Wilfred Hughes 61e5f912f7 Remove TODO
Contiguous nodes can be the first or last on the line, so we need the
prev_novel data.
2021-07-24 17:26:41 +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 3a26616fac Remove commented-out code 2021-07-24 16:58:51 +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 f79c77d421 Prefer u64 for num_descendants 2021-07-24 16:06:46 +07:00
Wilfred Hughes b3f98e9639 LineNumber only has one field, so use a tuple struct 2021-07-24 16:04:25 +07:00
Wilfred Hughes 1927707001 Treat strings the same as other atoms
There's no different highlighting or behaviour for string literals, so
there's no benefit to the addition complexity of handling them
separately.
2021-07-22 00:19:48 +07:00
Wilfred Hughes 0a7273850f cargo fmt 2021-07-22 00:09:26 +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 4c33f34025 Decrease highest edge score
This is easier to reason about and reduces risk of overflow.
2021-07-20 20:29:12 +07:00
Wilfred Hughes 3e73845090 Tweak contiguous change scores so they're closer together
This gives flexibility to add more types of edges.
2021-07-20 20:26:43 +07:00
Wilfred Hughes 63147be63c Add test for multline string 2021-07-20 20:09:58 +07:00
Wilfred Hughes c184a7da8f Improve string literal parsing and add unit tests 2021-07-20 20:07:21 +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
Wilfred Hughes 2d9efe15a0 Fix another crash on empty files
Git history with file additions/removals should now work.
2021-07-20 00:22:01 +07:00
Wilfred Hughes 9711cdf94e Fix another crash on empty files 2021-07-20 00:19:00 +07:00
Wilfred Hughes 816288149e Fix a crash on empty files 2021-07-20 00:14:21 +07:00