intellij-rust / intellij-rust

Rust plugin for the IntelliJ Platform
https://intellij-rust.github.io
MIT License
4.54k stars 380 forks source link

Renaming lifetimes should not select ' as part of the name #6570

Open KarelPeeters opened 3 years ago

KarelPeeters commented 3 years ago

Consider an impl like this:

impl<'a> Foo for Bar<'a> {}

When the rename action is applied to 'a, the entire thing is selected and available for renaming as if the ' is part of the name itself. After the rename the ' is automatically added back again, so the code doesn't actually break.

It would be slightly more ergonomical and less confusing if the ' was never editable to begin with though.

For clarity, some screenshots of the rename process as it works currently:

clion64_qVxthDDqG7 clion64_IomXaN7ZVc clion64_dVwAg5Iawo

KarelPeeters commented 3 years ago

This problem recently got worse, now when you blindly type 'b and press enter you get 'b' which is (correctly) not accepted. So now I have to type b instead, which is counter-intuitive because it looks like I'll be replacing 'a.

I think the cause is that the automatic quote completion is triggered during this rename, which adds an extranious ' at the end.

I'm seeing this new behaviour on CLion version 2021.1.1, Rust plugin version 0.3.146.3826-211, I'm not sure when it first appeared.