Commit Graph

5629 Commits (6824ba7d6b9c615860da8a8739c191248515ad71)
 

Author SHA1 Message Date
Wilfred Hughes 6824ba7d6b Add release instructions to the manual 2021-10-18 22:41:56 +07:00
Wilfred Hughes 4287594cda Don't consider other paths when UnchangedNode is available
This substantially decreases the number of edges in our graphs,
especially when few nodes have changed. Diffing slow_before.rs with
slow_after.rs now takes half the time on my machine.

This makes diffing slightly greedier, so there may exist cases where
diffs are slightly worse. Comparing AXAB with AB is arguably nicer
as (+AX)AB rather than A(+XA)B. However, all the tests still pass,
and it's a huge perf win.

Closes #47
2021-10-18 22:23:44 +07:00
Wilfred Hughes 7f426070f6 Compute multiple MatchedPos from a slice of SingleLineSpan values 2021-10-17 17:24:36 +07:00
Wilfred Hughes 2640cbc101 Store only SingleLineSpan in MatchedPos
Positions almost always span a single line, as they just track
tokens. The only exception is multiline strings or comments.

Trying to match up all the lines between two tokens is far more
complex and doesn't provide much benefit. It was already the case that
we used the first line in the position in several code paths anyway.
2021-10-16 21:38:02 +07:00
Wilfred Hughes de110b3660 cargo fmt 2021-10-16 21:33:44 +07:00
Wilfred Hughes 10716461d3 Print the first few items of the route found when tracing 2021-10-16 09:31:10 +07:00
Wilfred Hughes 484e373986 Link to tree-sitter-rust fork 2021-10-05 23:03:33 +07:00
Wilfred Hughes 74a5e7b151 Note that the manual is tracking the bleeding edge version 2021-10-03 16:45:20 +07:00
Wilfred Hughes febfbcea3e Make word diffs more granular
Fixes #39
2021-10-03 16:43:08 +07:00
Wilfred Hughes e9b5fe13ab Prefer ::default() for SyntaxInfo to keep clippy happy 2021-10-03 15:38:47 +07:00
Wilfred Hughes a77798a695 cargo fmt 2021-10-03 15:25:46 +07:00
Wilfred Hughes 3df7bb57e1 Add basic syntax highlighting for keywords and operators
Helps with #32
2021-10-03 15:23:27 +07:00
Wilfred Hughes c92007e5b3 Remove criterion
I've found the numbers pretty noisy on my laptop, and `perf stat` is a
nice way of testing full size files for performance.
2021-10-02 22:00:12 +07:00
Wilfred Hughes d355c3ceb0 Merge commit '4b0e4a3891337514126ec72c7af394c0ff2cf48c' 2021-10-02 12:17:06 +07:00
Wilfred Hughes 4b0e4a3891 Better handling of quoted defun forms 2021-10-02 12:14:40 +07:00
Wilfred Hughes 98ca8ea106 Ensure that single-item tree-sitter lists are difftastic lists
This is important when executing tree-sitter queries, as highlighting
queries tend to target leaf nodes. Flattening the tree loses that.

This may also lead to more accurate diffing logic in some examples,
but I haven't found any obvious cases.
2021-10-01 23:57:15 +07:00
Wilfred Hughes 2acb3b43b5 cargo fmt 2021-10-01 09:20:47 +07:00
cherryblossom000 ca3f48ce2e Support `cjs` and `mjs` extensions for JavaScript
Node.js uses the [`cjs` and `mjs` extensions][1] to indicate different module systems.

[1]: https://nodejs.org/api/packages.html#packages_determining_module_system
2021-10-01 00:35:00 +07:00
Wilfred Hughes 87d771219b Fix HighlightKind in tests 2021-09-30 21:41:18 +07:00
Wilfred Hughes 67916d260d Dim unchanged comments as a crude syntax highlighting technique 2021-09-30 00:07:37 +07:00
Wilfred Hughes b747cdcb01 Make bad position data more obvious (use purple) 2021-09-29 23:57:44 +07:00
Wilfred Hughes d37c87a1a5 Update changelog for patch release 2021-09-28 09:50:02 +07:00
Wilfred Hughes 9409e4fb4e Clarify platform in changelog 2021-09-28 09:41:08 +07:00
Wilfred Hughes bdedcfce7d
Add missing word in readme 2021-09-27 20:30:57 +07:00
Wilfred Hughes 5e08a2562a Ensure version metadata is consistent 2021-09-27 00:17:52 +07:00
Wilfred Hughes a1dcfd45d6 Ignore target/ directory 2021-09-27 00:13:41 +07:00
Wilfred Hughes 69005f668d Mention mercurial in readme 2021-09-26 23:15:16 +07:00
Wilfred Hughes 08c68de229 Run `cargo upgrade` 2021-09-26 23:09:20 +07:00
Wilfred Hughes 62b030195e Upgrade to latest treesitter 2021-09-26 23:05:09 +07:00
Wilfred Hughes b0b1579f26 Correct delimiter positions
j counts from 0, so add the start value. Also ensure it is never equal
to i, or we get confused by delimiters where the open and close tokens
are the same (such as `|foo|` in Rust).
2021-09-26 21:40:10 +07:00
Wilfred Hughes 8a145e7b76 Improving profiling instructions
Provide full working examples and mention `perf`.
2021-09-26 21:32:49 +07:00
Wilfred Hughes ec37c5bef1 Add full Mercurial extdiff support 2021-09-26 21:23:22 +07:00
Wilfred Hughes 6ac01365c6 Update changelog for build fix 2021-09-26 21:21:02 +07:00
Benjamin Bannier 457b63c758 Fix building of e.g., vendor/tree-sitter-haskell-src/scanner.cc
At least this parser uses C++11 (lambda expressions) and C++14 features
(lambda `auto` parameter types). Since the default C++ standard of
compilers can vary, this patch explicitly sets C++14 mode when building
any vendored C++ files.
2021-09-26 19:10:09 +07:00
Wilfred Hughes e214b818de Factor out a helper function for diffing single files 2021-09-26 12:02:48 +07:00
Wilfred Hughes 22febe6736 Documenting mercurial support 2021-09-26 11:50:26 +07:00
Wilfred Hughes 4e09fd0507 Match delimiters when converting from tree-sitter to syntax
Previously, we only handled simple cases like `(x)` where the first
and last token were the delimiter tokens. We now allow arbitrary
tokens before and after the delimiter, and wrap them in an additional
list.

This was more common in the C family parsers, but it's a general
problem. It also helps with robustness of JSX/TSX delimiter parsing of
`<`, where we now require a close `>` at the same level.
2021-09-25 22:25:05 +07:00
Wilfred Hughes df1754931b Polish readme and add more screenshots 2021-09-25 00:15:30 +07:00
Wilfred Hughes 0828089e69 Link to the source code in the introduction 2021-09-24 23:44:32 +07:00
Wilfred Hughes 48efe9d7c4 Roll version 2021-09-24 23:40:07 +07:00
Wilfred Hughes c9f85d806e Document the main tricky cases with tree diffs 2021-09-24 23:33:25 +07:00
Wilfred Hughes 3d12e56e0f Store parent node in SyntaxInfo 2021-09-23 23:16:38 +07:00
Wilfred Hughes bc4f54da65 Set benchmark path to keep `cargo package` happy 2021-09-22 22:40:53 +07:00
Wilfred Hughes 3b36e6486d Add C# support
Closes #37.
2021-09-22 22:37:53 +07:00
Wilfred Hughes 806f925948 Add 'vendor/tree-sitter-c-sharp/' from commit '4a3d9677f86aab13b7e721df22e12004416e2539'
git-subtree-dir: vendor/tree-sitter-c-sharp
git-subtree-mainline: 5991efdcc7
git-subtree-split: 4a3d9677f8
2021-09-22 22:12:22 +07:00
Wilfred Hughes 5991efdcc7 Build tree-sitter parsers in parallel 2021-09-22 22:02:07 +07:00
Wilfred Hughes 05d0234061 Add symlink needed for Haskell build 2021-09-22 20:54:51 +07:00
Wilfred Hughes f6ada434fe Add Haskell support
Fixes #36
2021-09-22 10:18:48 +07:00
Wilfred Hughes 016d2b8be2 Add 'vendor/tree-sitter-haskell/' from commit 'bf7d643b494b7c7eed909ed7fbd8447231152cb0'
git-subtree-dir: vendor/tree-sitter-haskell
git-subtree-mainline: f7042660c0
git-subtree-split: bf7d643b49
2021-09-22 09:50:50 +07:00
Martin Midtgaard 4a3d9677f8
Fixes precedence between is and as (#209)
* Fixes precedence between is and as

'is' has higher precedence than 'as'. To get the test case to parse I also had to restrict the types of expressions that can be 'constant_pattern'.

* is and as has same precedence

Better understanding of is and as precedence. They have same precedence, but are left associative. The also have the same precedence as relative operators and not the same as equallity operators.

* Added more expressions to constant_pattern

nameof and some casts are allowed in constant expressions.

* Changed nullable_type to not be able to contain it self

This was to avoid precedence problems when parsing things like "int? ?".
2021-09-22 15:55:25 +07:00