How do I disable automatic closing of <> without disabling it for other brackets () {}?

Viewed 490

I am getting annoyed by the autocompletion of the <> brackets in VSCode for Rust. While it might be useful when specifying generic types, it really bothers me when it autocompletes ">" for my smaller than operators.

I know I can disable autoclosing brackets completely, but is there a way to specify which of them should be considered brackets? I have installed the Rust extension, and without it, this is not a problem.

1 Answers

Angular brackets were added to autoClosingPairs in this pull request on the premise that Rust developers write generics more than comparison logic. This choice was re-discussed here tp no avail. It seems that there is no way to differentiate between generics and comparisons with vscode's current configuration options. However, there are two ways to remove this behaviour manually. One is to disable auto closing for all brackets by adding this line to your settings.json:

"editor.autoClosingBrackets": "never"

The other solution is to disable autoclosing for only angular brackets by removing the rust extension's configuration locally:

// .vscode/extensions/rust-lang.rust-x.x.x/language-configuration.json

"autoClosingPairs": [
  { "open": "<", "close": ">" },
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ remove this line
]
Related