3

I'm using rust-analyzer 0.2.654 (latest) on VS Code 1.57.1 (also latest) on Windows 10.

The autocomplete displays all keywords, as shown below:

Screenshot

How can I hide the keywords, displaying only the actual struct members?

rodrigocfd
  • 6,450
  • 6
  • 34
  • 68

2 Answers2

2

You can disable this in the settings UI by navigating to Text Editor > Suggestions > Show Keywords:

enter image description here

Or alternatively disable it via settings.json by including:

"editor.suggest.showKeywords": false,
kmdreko
  • 42,554
  • 6
  • 57
  • 106
  • Wait, VS Code either suggests keywords in all contexts or not at all? It isn’t capable of being more contextual? – eggyal Jul 02 '21 at 21:20
  • @eggyal You can configure it per-language by putting it in `"[rust]": { ... }`. I don't know if there's more granular control. Rust-analyzer is already pretty contextual IMO and typically doesn't suggest irrelevant keywords. I don't know why it suggests them here. – kmdreko Jul 02 '21 at 22:33
0

You also need to disable "Postfix completions" otherwise you get a load of completions like dbg, match and so on which are really automatic snippets rather than actual struct members.

postfix completions

Timmmm
  • 88,195
  • 71
  • 364
  • 509