-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't move item command in some circumstances #8236
Comments
Movability of some nodes (like attributes) can be added by adding its node to this list https://github.com/rust-analyzer/rust-analyzer/blob/5dd6b931388dac00d272a41a139c4f0cc3c449dc/crates/ide/src/move_item.rs#L44-L70 |
I can work on that, though it would be awesome if someone collected a list of some common movability inconsistencies. |
I think you can check if the selection range is empty and in that case take a biased(biased towards non whitespace) token, via |
I'll take a look at it, thanks! |
Move item command was recently added to rust-analyzer.
If the cursor is on the left side of the
#
symbol, the move item action cannot be performed. Same goes for the keywordsfn
orimpl
(or anenum
without an attribute above it).With the cursor on the left side of a
const
however, the move action works without needing to "be inside" it (i.e. cursor to the right side ofc
).Interestingly, if the cursor is on the right side of the ending curly brace of a function (what could be considered "not inside" the function), the move action still succeeds.
I don't know if this all expected behavior, but I thought I'd mention it as it seems inconsistent.
Thanks.
rust-analyzer nightly 01dc53a (2021-03-29)
The text was updated successfully, but these errors were encountered: