Closed rchl closed 8 months ago
Hello Rafal, I noticed two issues.
it messes the undo history. Lets say I have 4 lines.
fn main() {
println!("Hello, world!"); | // cursor is here
println!("Hello, world!");
println!("Hello, world!");
println!("Hello, world!");
}
If i trigger the rust_analyzer_join_lines
command 24x. I would expect that only 3 edits occur, so I would need to undo 3 times. Instead, I need to undo 24x to undo the change...
Interestingly, the native join lines command only requires one undo to undo the 3 join lines.
If you quickly trigger the rust_analyzer_join_lines
command, text can get lost:
That looks like it needs changes purged before triggering the request.
Latest update should address undo but I still see it sometimes breaking the code when triggering command very quickly. I might have to add some manual change_count check as server doesn't specify document version in the edit it returns so it's not possible to know whether the edit is outdated.
Wrong edits should be also fixed.
Just for fun I've implemented handling for one more custom request for joining lines.
It's bound to default join lines key binding but it will fall back to the native one if server is not active or returns an error for some reason.
The placement of the command differs from already implemented commands but I would rather use that approach and convert existing commands to use the same way in the future for more clarity.
Fixes #29