Skip to content

feat: supports minus to underscore rename#21801

Open
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:minus-rename
Open

feat: supports minus to underscore rename#21801
A4-Tacks wants to merge 1 commit intorust-lang:masterfrom
A4-Tacks:minus-rename

Conversation

@A4-Tacks
Copy link
Member

Typing minus is usually much more convenient than typing underscore

Example

Rename to "a-b"

fn main() { let i$0 = 1; }

Before this PR

Invalid name a-b: not an identifier

After this PR

fn main() { let a_b = 1; }

Example
---
Rename to `"a-b"`
```rust
fn main() { let i$0 = 1; }
```

**Before this PR**

Invalid name `a-b`: not an identifier

**After this PR**

```rust
fn main() { let a_b = 1; }
```
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 11, 2026
Copy link
Member

@lnicola lnicola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks fine to me, but that's not a typo I've ever made and I'm not aware of other LSP servers that do this. The Python one in VS Code simply renames to a-b.

View changes since this review

@A4-Tacks
Copy link
Member Author

I'm not aware of other LSP servers that do this. The Python one in VS Code simply renames to a-b.

This feature is very useful, but there seems to be no other LSP or IDE implementation

PyCharm, jedils, tsserver, luals, ocamllsp and clangd have not implemented this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants