tree-sitter-nu
tree-sitter-nu copied to clipboard
Assignment rhs includes all the white space after the assignment operator.
This affects stmt_let, stmt_mut and assignment.
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 }
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.