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.
pull/48/head
Wilfred Hughes 2021-10-01 23:57:15 +07:00
parent 2acb3b43b5
commit 98ca8ea106
2 changed files with 3 additions and 1 deletions

@ -4,6 +4,8 @@
Improved handling of paired delimiters, particularly in C, C++ and C#.
Fixed a rare issue where single-item lists were flattened.
### Integration
Added support for Mercuial, see [this section in the

@ -338,7 +338,7 @@ fn syntax_from_cursor<'a>(
// Treat nodes like string literals as atoms, regardless
// of whether they have children.
atom_from_cursor(arena, src, nl_pos, cursor)
} else if node.child_count() > 1 {
} else if node.child_count() > 0 {
list_from_cursor(arena, src, nl_pos, cursor, config)
} else {
atom_from_cursor(arena, src, nl_pos, cursor)