Commit Graph

13265 Commits (syntax_id)
 

Author SHA1 Message Date
Wilfred Hughes 2d2a1484fd Roll version 2023-07-12 17:10:34 +07:00
Wilfred Hughes 49e2aed1ad Fix github action configuration to create drafts 2023-07-12 17:05:52 +07:00
Wilfred Hughes 8614910fe2 cargo fmt 2023-07-12 16:45:58 +07:00
Wilfred Hughes f6ceb2aefd Update unit test new subword highlighting heuristic 2023-07-12 12:48:45 +07:00
Wilfred Hughes 5606c04261 Treat qualified modules and variables as atoms in Haskell 2023-07-12 12:34:39 +07:00
Wilfred Hughes a814e01d22 Improve word diffing heuristic and add another sample file 2023-07-12 12:12:32 +07:00
Wilfred Hughes 1d3b6836ef Handle multiline atoms more accurately in split_atom_words 2023-07-12 11:49:39 +07:00
Amaan Qureshi 8c8007eaee
Merge pull request #124 from josharian/expr_stmt
Materialize expression_statement nodes
2023-07-11 19:07:25 +07:00
Wilfred Hughes c2b7042b80 Do subword highlighting in more cases
This is useful when two strings substantially differ, but have the
same e.g. end.
2023-07-10 21:26:24 +07:00
Raymond Ha 5f2c94b897
fix: correctly parse universal selector in descendant selector 2023-07-10 20:01:23 +07:00
Alan Donovan cfaf12cae0 Materialize expression_statement nodes
The hard work was done by Alan.
See https://github.com/tree-sitter/tree-sitter-go/pull/73
for the original pull request, from which this was extracted.

Co-authored-by: Alan Donovan <alan@alandonovan.net>
2023-07-10 16:21:15 +07:00
Amaan Qureshi a60f1ddef4
Merge pull request #133 from benjaminBrownlee/preproc-define-fix
fix: allow preproc define without value to preceed a line with whitespace
2023-07-10 18:39:20 +07:00
Benny Powers 33d9d86cad
feat: add pseudo-element arguments
Fixes #29
2023-07-10 18:20:45 +07:00
Benjamin Brownlee bb74560cd4
fix: allow preproc define without value to preceed a line with whitespace at start 2023-07-10 13:34:30 +07:00
Wilfred Hughes d9382640ed Mention the new subword string highlighting in the changelog 2023-07-10 09:04:53 +07:00
Wilfred Hughes 5824322244 Require some common words to do subword highlighting
This is important when comparing short string literals. This change
has improved several cases in sample_files/ but I've added a new
example that made the previous unwanted behaviour much more obvious.
2023-07-10 09:03:21 +07:00
Wilfred Hughes 4aca79f220 Use the raw_entry_mut API on hashbrown::HashMap
This saves us searching the hash map twice. This is a modest
performance improvement: an instruction count reduction of 4% on
slow_before.rs, and 1% reduction on typing_before.ml.
2023-07-09 22:49:37 +07:00
Wilfred Hughes b1f7e21e83 Move to hashbrown 0.12 to meet our MSRV
Performance is unchanged too.
2023-07-09 22:03:24 +07:00
Wilfred Hughes 5f2d970ad2 Choose the last hashbrown version that supports our MSRV 2023-07-09 19:54:09 +07:00
Wilfred Hughes 202265a03b cargo fmt 2023-07-09 19:49:21 +07:00
Wilfred Hughes e9abae90ab Add basic smoke tests for debug dump options 2023-07-09 15:48:45 +07:00
Wilfred Hughes 8eb949eb02 Use DftHashMap everywhere
This is a 4% reduction in instructions for typing_before.ml, but a
0.2% increase instructions for slow_before.rs. This seems like a win
overall, and it also keeps the codebase more consistent and simpler.
2023-07-09 15:41:01 +07:00
Wilfred Hughes d9911e0b49 Move DftHashMap to a separate file 2023-07-09 15:37:51 +07:00
Wilfred Hughes f2456a12b2 Use hashbrown for the alloc_if_new data
This was intended to allow usage of .entry_ref(), but it's already a
performance win without using that API! It's around a 9% reduction in
instructions in slow_before.rs, and 2% reduction in typing_before.ml.
2023-07-09 11:11:03 +07:00
Wilfred Hughes 27f59c0b3a Don't treat - as a word constituent
This produces slightly better results with some string replacements.
2023-07-08 17:16:14 +07:00
Wilfred Hughes 2607d17d73 Fix spelling in comment 2023-07-08 17:16:14 +07:00
Zhenge Chen ffd49d523a Detect replaced strings
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>
2023-07-08 17:16:06 +07:00
Wilfred Hughes f86ba13abf Increase punctuation cost to 200 2023-07-08 14:59:47 +07:00
Wilfred Hughes 495dbe5b14 Improve comments in Edge::cost 2023-07-08 14:53:33 +07:00
Wilfred Hughes 574fb5bd50 Fix clippy lint 2023-07-07 23:52:51 +07:00
Wilfred Hughes 53855e415e Reduce copying further in set_neighbours
This saves a remarkable 8.5% of instructions on slow_before.rs.
2023-07-07 23:37:16 +07:00
Wilfred Hughes a180fd6d24 Don't return the neighbours inside get_set_neighbours
This caused unnecessarying closing, costing 0.2% instructions in some
cases, and also made the code less readable.
2023-07-07 23:29:51 +07:00
Wilfred Hughes 87d27c5598 Only split numbers inside comments
Inside text files, it seems to be better to be conservative and
consider abc123def as one word rather than three.

This is noticeable when looking at changes to the compare.expected
file, which contains hashes. 123c456 and 345c789 don't really have a
`c` in common, so subword highlighting is ugly.
2023-07-07 08:40:06 +07:00
6cdh 92bf6372c6 fix(README): english grammar 2023-07-07 09:28:11 +07:00
FW 2878163ee7
Merge pull request #88 from Gh0u1L5/fix/package-info
Add missing tree-sitter section in package.json
2023-07-07 00:53:58 +07:00
Gh0u1L5 dd99b7f1c8
Update package.json
Co-authored-by: FW <30873659+fwcd@users.noreply.github.com>
2023-07-06 23:45:49 +07:00
Wilfred Hughes c07e640b24 Remove contiguous penalty
The contiguous penalty was an attempt to fix the slider problem:

// Old
A B
C D

// New
A B
A B
C D

// Unwanted diff
A +B+
+A+ B
C D

However, it doesn't make sense for Dijkstra, which is stateless. The
best route from vertex X is independent of how we got to vertex X.

This worked by dumb luck: in some circumstances we terminate early
rather than fully executing Dijkstra's algorithm. This cost tweak
improved results on a few test files. However, the post-processing
slider logic is a proper, general solution. This was added much later.

There's no reason to keep the contiguous penalty now. It's confusing,
and makes adding new edge costs with consistent 'X costs more than Y'
behaviours more difficult.

Performance is essentially neutral: a small decrease in
typing_before.ml, a small increase in slow_before.rs.
2023-07-06 08:37:02 +07:00
Wilfred Hughes 31df177881 Increase the punctuation penalty
This ensures that choosing a unchanged non-punctuation atom with some
novel atoms is better than choosing punctuation and some changed
comments. This produces better results in general, see
comma_and_comment_after.js for an example.

This will be more noticeable after the next commit, where costs of
novel atoms are in a smaller range of values.
2023-07-06 08:16:24 +07:00
Wilfred Hughes c3016eca4a Add TODO 2023-07-06 08:14:03 +07:00
Wilfred Hughes 43c24047b4 Don't track contiguous status on novel delimiter edges
This is harder to reason about, and
2e6666041f did not include a motivating
test case.

Removing contiguous status is a minor perf improvement (2% reduction
in instructions), makes the code simpler, and does not significantly
affect diffing results.

Of the two sample files that have changed, the erlang_before.erl file
has improved and nest_before.rs is neutral.
2023-07-04 23:53:16 +07:00
Wilfred Hughes 1e4d1828c7 Store probably_punctuation on unchanged edges
This is equivalent (increased cost on unchanged nodes vs decreased
cost on changed nodes), but easier to reason about.

Previously we have multiple notions of changed atoms: NovelAtomLHS,
NovelAtomRHS, and ReplacedComment. We want to consider punctuation as
less desirable even when e.g. comments arereplaced.
2023-07-03 19:48:31 +07:00
Wilfred Hughes c405b58327 Fix cost for ReplacedComment
This needs to be 2x novel nodes, or we prefer it far too often.
2023-07-02 23:12:31 +07:00
Martin Jambon 7a4edcbc37
Merge pull request #122 from amaanq/single-import-spec-list
Fix single import spec list without terminator
2023-06-30 14:15:57 +07:00
Amaan Qureshi 51e24d2106
chore: generate 2023-06-29 23:41:11 +07:00
Amaan Qureshi 044f54ec61
chore: add tests 2023-06-29 23:41:07 +07:00
Amaan Qureshi 9111ada713
fix: allow single import specs to not require a terminator 2023-06-29 23:40:18 +07:00
Wilfred Hughes 3730580ca3 Improve word splitting heuristics
This is particularly noticeable when diffing comments with timestamps
2000-12-31T23:59:59 where we don't want 31T23 to be a single word.
2023-06-29 08:33:30 +07:00
fwcd 8d43d90d56 Disable dependency caching 2023-06-28 17:09:41 +07:00
fwcd 4f2ec0fec1 Upgrade the actions in the other workflows too 2023-06-28 16:58:19 +07:00
fwcd ad309a5643 Add workflow_dispatch trigger 2023-06-28 16:58:19 +07:00