This is a very tiny perf hit, but allows us to pass newly allocated
strings to new_atom(), which will be necessary for normalising
case-insensitive languages.
This isn't strictly necessary since difftastic is a binary-only
crate. However, it improves compiler warnings (see next commit) and
potentially helps future changes to make difftastic available as a
library.
This corresponds to:
$ cargo +nightly fmt -- --config group_imports=StdExternalCrate
Since this option is only available on nightly, I'm not adding a
rustfmt.toml to enforce this, just doing it as a one-off run.
Previously we didn't check the state of children, which was an
oversight from the original implementation. As a result, we fixed
nested sliders in fewer situations.
Fixes#535
If a string is replaced with another, apply subword highlighting
similar to how we handle replaced comments.
Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
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
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
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.
This saves 16% time, 18% memory and 1% instruction counts from the
sample files in #293. These are large files, treated as textual diffs,
so reducing the storage per-line is significant. Files with structural
diffing, such as sample_files/slow_before.rs, are unchanged.
Fixes#293Closes#297
It's reasonable to assume that a single column won't exceed four
billion, and this is a small speedup (1% instruction count reduction
on the sample file in #293).