Replies: 2 comments 1 reply
-
|
From the small amount of tests so far, the actions The edge cases arise from the Maybe these actions can be like the old "force" move actions? And then the extension doesn't allow a user to perform them unless explicitly requested? Maybe also allow performing them if there is a configuration for that language that specifies it is OK, For example in Rust, the fn parent() { fn child() { } }
// ^^^^^^^^^^^^^^^ // select this and call before-parentResult: fn parent() fn child() { }{ }This is because the An edge-case rule could be something like: {
"rust": {
"before-parent": {
"parent": "(function_item body: (block) @parent) @real_parent"
}
}
}And that query resolves the "real" parent the block should be moved before? |
Beta Was this translation helpful? Give feedback.
-
Editor mode changesInstead of "blocks", the editor will show all the nodes. Otherwise, behavior stays the same. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, the extension is useless for a language that doesn't have pre-written queries.
Adding queries is also not a trivial task, especially for niche languages not supported by the tree-sitter playground.
The upside is that a language with queries has no false-positives, blocks are always correct and moving them never causes a syntax error (at least for the tested default queries).
The downside is that for most languages, the extension is very hard to setup.
This feature will reverse that tradeoff.
Instead, the default behavior will be to directly manipulate the syntax tree, no "block" abstraction that groups nodes together. When a user does want to move multiple nodes, another new feature - scope-selection will be used to manually select the block. Then, the block can move anywhere within the syntax tree, not just between pre-configured blocks.
The upside is that all tree-sitter supported languages are supported by default.
The downside is that each language can have edge cases that can cause a block move to create a syntax error.
This discussion is to help me decide if this approach is better than the new one, and to think about potential mitigations
to the new feature's downside.
* Of course, any input is much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions