Closed selfint closed 1 year ago
https://github.com/selfint/code-blocks/discussions/127#discussioncomment-6153519 :
From the small amount of tests so far, the actions after-next & before-previous basically always work. The edge cases arise from the into-next, into-previous, before-parent & after-parent actions. 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, or specifies a way to handle it? For example in Rust, the before-parent action can behave strangely: fn parent() { fn child() { } } // ^^^^^^^^^^^^^^^ // select this and call before-parent Result: fn parent() fn child() { }{ } This is because the { } of the parent function are a block node, and that node is the parent of the selection. 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?
From the small amount of tests so far, the actions after-next & before-previous basically always work.
after-next
before-previous
The edge cases arise from the into-next, into-previous, before-parent & after-parent actions.
into-next
into-previous
before-parent
after-parent
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,
or specifies a way to handle it?
For example in Rust, the before-parent action can behave strangely:
fn parent() { fn child() { } } // ^^^^^^^^^^^^^^^ // select this and call before-parent
Result:
fn parent() fn child() { }{ }
This is because the { } of the parent function are a block node, and that node is the parent of the selection.
{ }
block
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?
Not relevant unless #160 gets enough comments to justify restoring force moves
https://github.com/selfint/code-blocks/discussions/127#discussioncomment-6153519 :