Commit Graph

11083 Commits (b104c4be10ad1d31e3d3b1bb4357fb63e7ca94ec)
 

Author SHA1 Message Date
Wilfred Hughes b104c4be10 Fix sliders in a single global pass
Previously we fixed sliders in each 'possibly changed' region. This
meant that we couldn't fix sliders that needed to move outside the
region. The most common case was code of the form `foo, bar, baz`
where `, baz` was unchanged but we wanted to slide to `,`.

We now call `fix_all_sliders` for the toplevel tree on both
sides. This required some minor changes to the slider logic, as the
unchanged/novel regions could occur at any level of the tree.

(It was probably also the case that we were missing slider
opportunities previously, because we terminated as soon as we found an
outer slider for the nested case.)

This change has no performance impact, probably because tree diffing
is vastly more expensive (O(N^2)) than sliders (O(N)).

Fixes #327
2022-09-02 18:10:09 +07:00
Wilfred Hughes 114235e4da cargo fmt 2022-09-02 18:05:22 +07:00
Wilfred Hughes 8860fabf19 Fix novel_regions_after_unchanged to always append the last region
This is the correct thing to do (and consistent with
novel_regions_before_unchanged), although I haven't found any examples
where it affects the results.
2022-09-02 16:39:11 +07:00
Wilfred Hughes d9fb75981e Make the default value of --background visible in --help 2022-09-02 13:04:34 +07:00
Wilfred Hughes a9866e1187 Mention --list-languages in the manual 2022-09-02 12:58:36 +07:00
Wilfred Hughes c70014a74a Add bold styling to --list-languages to help readability 2022-09-02 12:01:05 +07:00
Wilfred Hughes c0083fdca0 Display file extensions alphabetically 2022-09-02 11:59:30 +07:00
Wilfred Hughes faa5d0a51c Use language pretty-printer for --list-languages 2022-09-02 11:57:05 +07:00
Wilfred Hughes eabefd5612 Factor out language name pretty-printing 2022-09-02 11:56:51 +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 6278e31130 Factor out LANG_EXTENSIONS as a constant we can iterate over 2022-09-02 11:25:33 +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 df5c787ec7 Revert "Add failing test for #346"
This reverts commit 46bbe06d75.
2022-09-02 10:47:00 +07:00
Wilfred Hughes 46bbe06d75 Add failing test for #346
This fails locally as expected, but I want to confirm that it fails on
CI too.
2022-09-01 09:40:18 +07:00
Wilfred Hughes b31e3c78c1 Add sample files missing from b1b3756fa7 2022-09-01 09:21:25 +07:00
Wilfred Hughes efa75b16c8 cargo fmt 2022-09-01 09:19:16 +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 615daf8880 Add 'vendor/tree-sitter-make/' from commit 'a4b9187417d6be349ee5fd4b6e77b4172c6827dd'
git-subtree-dir: vendor/tree-sitter-make
git-subtree-mainline: b1b3756fa7
git-subtree-split: a4b9187417
2022-08-28 16:06:14 +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 8b5642ef51 Use the same checkout action version everywhere 2022-08-27 23:04:36 +07:00
Wilfred Hughes 1d1d883a9b Roll version 2022-08-27 23:00:33 +07:00
Wilfred Hughes 3f0fdbff9f This linking option is required in older rust versions, not newer 2022-08-27 17:58:07 +07:00
Wilfred Hughes ae799f39d9 Document environment variables in manual 2022-08-27 17:53:18 +07:00
Wilfred Hughes aca46af40f Don't specify +whole-archive before rust 1.61 2022-08-27 17:51:54 +07:00
Wilfred Hughes 734a638ca2 Difftastic uses several factors to detect the language 2022-08-27 17:30:22 +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 d3963ca7e7
Be more explicit about cargo version when using stable 2022-08-27 16:26:31 +07:00
Wilfred Hughes 78e07c8178 Push to gh-pages with --force 2022-08-27 16:14:25 +07:00
Wilfred Hughes c3299a7cba Upstream version format has changed 2022-08-27 16:09:02 +07:00
Wilfred Hughes d65b0affca Use latest version of pages deploy action 2022-08-27 16:05:33 +07:00
Wilfred Hughes 175620590f 'cargo test' should be 'cargo doc' 2022-08-27 16:05:25 +07:00
Wilfred Hughes 660e9a1b1e Don't use actions-rs for build of manual either 2022-08-27 16:00:41 +07:00
Wilfred Hughes bc40836b8f Don't track history in gh-pages
This is already in the main branch and it makes the repository bigger
than it needs to be.

Should slightly improve #343
2022-08-27 15:55:52 +07:00
Wilfred Hughes db12fb0cf3 Fix version specification 2022-08-27 15:33:11 +07:00
Wilfred Hughes b04ac7361d Move away from actions-rs as it's unmaintained
It doesn't support rust-toolchain.toml per
https://github.com/actions-rs/toolchain/issues/126 and it isn't
receiving new updates per
https://github.com/actions-rs/toolchain/issues/216 .
2022-08-27 15:27:19 +07:00
Wilfred Hughes aa48ac194d Use an explicit toolchain step in GitHub actions 2022-08-27 15:16:36 +07:00
Wilfred Hughes b5847506dd
Merge pull request #344 from igrep/fix-342
Fix: Can't build on Windows in a locale whose default encoding is not UTF-8
2022-08-24 21:10:28 +07:00
YAMAMOTO Yuji 12f941c7a9
Fix: Can't build on Windows in a locale whose default encoding is not UTF-8 #342
Fix #342 by adding `/utf-8` flag to cl.exe

Ref. https://docs.microsoft.com/en-us/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=msvc-170
2022-08-25 10:04:14 +07:00
Wilfred Hughes 94ee57036e Add Rust stable to CI 2022-08-23 09:17:49 +07:00
Wilfred Hughes 721ebc663d
Merge pull request #341 from rhysd/terminal-size
Use `terminal_size` crate instead of `term_size` crate
2022-08-23 09:04:29 +07:00
rhysd f201b9e225 Use `terminal_size` crate instead of `term_size` crate
since `term_size` has stopped maintenance 2 years ago.
2022-08-23 10:36:54 +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 026b2674d0 Update expected output
The previous two commits were done in a branch that was rebased, so
the integration tets missed 5fe6d551d.
2022-08-21 21:36:00 +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 a71d6118cf Store predecessors and neighbours as mutable fields in graph nodes
This is a more traditional graph representation. It is slightly easier
to reason about, and it's clearer that graph node creation time
dominates graphs exploration.

This is a slight performance regression, but it enables better
exploration of parethesis nesting (see next commit). typing_before.ml
has regressed from 3.75B instructions to 3.85B instructions and
slow_before.rs has regressed from 1.73B instructions to 2.15B
instructions.

This change has also made the diff output for slow_before.rs slightly
worse (note the `lhs` variable is now claimed as changed in more
cases). It's not clear why, but presumably means that the node visit
order has changed slightly.

Closes #324
2022-08-21 16:25:54 +07:00
Wilfred Hughes 2cc05f340f rustfmt 2022-08-21 16:01:51 +07:00