Skip to content

fix: Move cursor position when using item movers #8510

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

Merged
merged 1 commit into from
Apr 15, 2021
Merged

fix: Move cursor position when using item movers #8510

merged 1 commit into from
Apr 15, 2021

Conversation

jonas-schievink
Copy link
Contributor

This updates the cursor position when moving items around to stay in the same location within the moved node.

I changed the moveItem response to SnippetTextEdit[], since that made more sense to me (the file was ignored by the client anyways, since the edits always apply to the current document). It also matches onEnter, which seems logical to me, but please let me know if this doesn't make sense.

There's still a bug in the client-side snippet code that will cause the cursor position to be slightly off when moving parameters in the same line (presumably we don't track the column correctly after deleting $0). Not really sure how to fix that immediately, but this PR should already be an improvement despite that bug.

@matklad
Copy link
Member

matklad commented Apr 13, 2021

didn't do the review, but all this sounds reasonable!

@jonas-schievink
Copy link
Contributor Author

Hmm, seems like there are still some rather annoying bugs in applySnippetTextEdits that are easy to run into with this PR

@matklad
Copy link
Member

matklad commented Apr 14, 2021

I sense a smell of broken glass here?

@jonas-schievink
Copy link
Contributor Author

I cannot for the life of me figure out how that typescript code works, but since the r-a part of these changes seems to be working fine, I guess we can land this. The cursor movement isn't really worse than it was before, at least.

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 15, 2021

@bors bors bot merged commit 3af3036 into rust-lang:master Apr 15, 2021
@lnicola lnicola changed the title Move cursor position when using item movers fix: Move cursor position when using item movers Apr 18, 2021
@jonas-schievink jonas-schievink deleted the move-item-cursor branch May 12, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants