tree-sitter-nu icon indicating copy to clipboard operation
tree-sitter-nu copied to clipboard

Assignment rhs includes all the white space after the assignment operator.

Open Bahex opened this issue 7 months ago • 1 comments

This affects stmt_let, stmt_mut and assignment.

Image

Noticed this while adding nu support to Wansmer/treesj

The plugin in question keeps white space between nodes intact, but appears to trim the nodes themselves during formatting.

do {
    let a = 1
}

# expected output of join operation
do { let a = 1 }

# actual output of join operation
do { let a =1 }

Bahex avatar Apr 29 '25 03:04 Bahex

Related tree-sitter issues: https://github.com/tree-sitter/tree-sitter/issues/4091, https://github.com/tree-sitter/tree-sitter/issues/3966

For some reason, the bug tag was removed 4 days ago. Maybe the authors thought it was a grammar issue. Generally I have no idea of how to fix this. Sometimes simply reordering/refactoring the grammar rule works but other times it makes things worse.

blindFS avatar Apr 29 '25 07:04 blindFS