rust-lang / rust-lang/rust-analyzer
rust-analyzer breaks tab completion on VSCode
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 0.3.1443-standalone
rustc version: rustc 1.67.1 (d5a82bbd2 2023-02-07)
relevant settings:
"rust-analyzer.completion.autoimport.enable": false,
"rust-analyzer.completion.callable.snippets": "none",
"rust-analyzer.completion.autoself.enable": false
I use intellisense's tab completion, which allows me to cycle through completions by pressing tab until the proper completion shows up, at which point I can continue typing. This prevents the editor from erroneously substituting completions when I've finished with a line and want to move on to the next. It essentially makes it so that I can trust that the enter key will always insert a newline so that I can type without worrying whether or not the enter key will do the thing that my brain expects it to do.
Completions offered by rust-analyzer break tab completion.
In one case, I press tab, the first completion is substituted (with parenthesis or brackets that I didn't ask for and can't disable) and subsequent presses of the tab key only insert spaces according to my indentation setting.
In the other case, I press tab, the first completion is substituted (without those pesky auto-parenthesis/brackets), and subsequent presses of the tab key do nothing as VSCode fights to keep the cursor in place until I continue typing and rust-analyzer destroys the suggestions queue.
This has effectively disabled the use of completions in my rust workflow, and now a language I was really excited to learn is an absolute pain to do anything in.
MWE:
- cargo new hello
- open hello/src/main.rs in VSCode
- set "editor.tabCompletion": "on" in settings.json
- type
prinand press tab twice, as if you were trying to get toprintln! - watch helplessly as you end up with
print!( ) - type a variable name that is the same as the beginning of another i.e.
beanvs.bean_can - watch helplessly as
beannever turns intobean_canno matter how many times you press tab- Note: this also pollutes the undo history!
Please let me know if there's anything else I can provide.
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 issue in cargo new hello using hello/src/main.rs, editor.tabCompletion set to on, and the listed rust-analyzer completion settings. Start by tracing how rust-analyzer completions interact with VSCode IntelliSense tab completion for prin and bean; done means repeated Tab presses cycle through suggestions without inserting unwanted text, spaces, or undo-history pollution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100