rust-lang / rust-lang/rust-analyzer
Unexpected curly brace insertion in rust-analyzer completions causes issues with auto-pairs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I am using rust-analyzer with Neovim, and cmp as my completion tool.
The problem is that when rust-analyzer provides completions for functions and other constructs, it unnecessarily includes an opening curly brace. This behavior is very inconvenient.
For example, when writing a method for a struct and using auto-pairs functionality, this extra opening curly brace gets interpreted as a pair with the curly brace from the impl block. This makes inputting the closing curly brace very cumbersome.
Here's a GIF demonstrating the issue:
This leads to issues with brace pairing and indentation.
Questions:
Why does rust-analyzer exhibit this behavior?
How can we avoid this problem?
Desired Outcome:
I would like to remove this extra opening curly brace from the completion suggestions. Ideally, the completion should only provide the function signature without any additional braces.
Environment:
Neovim version: v0.10.0
rust-analyzer version: 0.3.2089-standalone
nvim-cmp version: commit id -> a110e12d0b58eefcf5b771f533fc2cf3050680ac
Any insights or suggestions on how to address this issue would be greatly appreciated. Thank you for your time and assistance.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the completion behavior using Neovim v0.10.0, rust-analyzer 0.3.2089-standalone, and the reported nvim-cmp commit. Compare function completion output with auto-pairs enabled; done means the completion provides the function signature without an unwanted opening curly brace and no longer disrupts brace pairing or indentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- neovim, rust
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100