You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helix-plus/helix-core/src
Michael Davis 94346356e7
Use TreeCursor to pretty-print :tree-sitter-subtree (#4606)
The current `:tree-sitter-subtree` has a bug for field-names when the
field name belongs to an unnamed child node. Take this ruby example:

    def self.method_name
      true
    end

The subtree given by tree-sitter-cli is:

    (singleton_method [2, 0] - [4, 3]
      object: (self [2, 4] - [2, 8])
      name: (identifier [2, 9] - [2, 20])
      body: (body_statement [3, 2] - [3, 6]
        (true [3, 2] - [3, 6])))

But the `:tree-sitter-subtree` output was

    (singleton_method
      object: (self)
      body: (identifier)
      (body_statement (true)))

The `singleton_method` rule defines the `name` and `body` fields in an
unnamed helper rule `_method_rest` and the old implementation of
`pretty_print_tree_impl` would pass the `field_name` down from the
named `singleton_method` node.

To fix it we switch to the [TreeCursor] API which is recommended by
the tree-sitter docs for traversing the tree. `TreeCursor::field_name`
accurately determines the field name for the current cursor position
even when the node is unnamed.

[TreeCursor]: https://docs.rs/tree-sitter/0.20.9/tree_sitter/struct.TreeCursor.html
2 years ago
..
increment Fix deprecation warnings for chrono 0.4.23 (#4738) 2 years ago
auto_pairs.rs Fix multi byte auto pairs (#4024) 2 years ago
chars.rs Temporarily turn on unicode-lines 3 years ago
comment.rs core: Move state into the history module 2 years ago
config.rs Add support for local language configuration (#1249) 3 years ago
diagnostic.rs diagnostics: Use Vec<Tag> instead of Option<Vec<Tag>> 2 years ago
diff.rs Fix Clippy lints in tests (#1563) 3 years ago
graphemes.rs Improve Readability (#2639) 2 years ago
history.rs core: Move state into the history module 2 years ago
indent.rs Fix panic from indenting on tree with errors 2 years ago
lib.rs core: Move state into the history module 2 years ago
line_ending.rs Resolve a bunch of upcoming clippy lints 2 years ago
macros.rs Split parts of helix-term into helix-view. 4 years ago
match_brackets.rs Fix match brackets comment (#1346) 3 years ago
movement.rs Use requested direction for new textobject selection range 2 years ago
object.rs Fix edge-case in tree-sitter expand_selection selection command (#2877) 2 years ago
path.rs Add workspace and document diagnostics picker (#2013) 2 years ago
position.rs feat: make `move_vertically` aware of tabs and wide characters (#2620) 2 years ago
register.rs Refactor blackhole register (#4504) 2 years ago
search.rs Jump to the next number on the line before incrementing (#1778) 3 years ago
selection.rs Use requested direction for new textobject selection range 2 years ago
shellwords.rs Capture word parts while calculating shellwords (#4632) 2 years ago
surround.rs Resolve a bunch of upcoming clippy lints 2 years ago
syntax.rs Use TreeCursor to pretty-print :tree-sitter-subtree (#4606) 2 years ago
test.rs Run clippy on workspace in CI (#4614) 2 years ago
textobject.rs Adjust `m` textobject description and minor code clarification (#3343) 2 years ago
transaction.rs fix tests 2 years ago
wrap.rs add reflow command (#2128) 3 years ago