Do not insert matching }
See original GitHub issueAlthough I’m very happy with intellij-rust, one feature annoys me.
Intellij-rust inserts {}
when I type {
. It is annoying, because most of the time I need to erase that matching brace.
E. g. I have a code like this:
match foo {
Bar(x) <CURSOR HERE> if x => 1,
}
I want to type => {
at cursor position to convert code to:
match foo {
Bar(x) => { if x { 1 } else { 2 } },
}
However, Intellij-rust inserts:
match foo {
Bar(x) {} if x => 1,
}
so I need to immediately erase }
.
Also, intellij-rust is very good at inserting matching }
when I press Enter, e. g. in this case:
match foo {
Bar(x) {<CURSOR HERE if x => 1,
}
So matching }
right after {
is almost never needed.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (9 by maintainers)
Top Results From Across the Web
How to disable automatically adding a closing curly brace or ...
I don't want it to auto insert any closing character or any indentations. I basically just want it to stop helping me and...
Read more >auto closing brackets not working on vscode 1.57 #127739
Steps to Reproduce: open a js file on code; type a opening bracket (; expected result (); actually getting (; bracket is not...
Read more >How disable auto closing of brackets, quotes, curly braces etc ...
I have disabled 'Insert pair quote' but it still auto-closes quotes in css files and within the css-section of the SmartKeys-Options, there is...
Read more >Insert () and Closing } ) ] ' " - Documentation for Visual Assist
Visual Assist places your caret between the parentheses if your selection takes an argument, and after if not. Press Undo to revert the...
Read more >VS Code tips — The Auto Closing Delete setting - YouTube
Today's VS Code setting: Auto Closing DeleteConfigure what the delete ... Don't delete anything • always — Always delete matching brackets.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I never paid much attention to that, but for Java, IDEA only inserts matching
}
s in some predefined contexts. Unfortunately, it sometimes doesn’t insert them when I would expect it to do, but at least it doesn’t annoy me when I do some nontrivial refactoring. Kotlin only analyzes the following symbol, CLion seems to not care about it at all and just throws}
everywhere.What do you think about such approach: try to insert a
}
and if it causes a syntax error nearby, remove it? I never looked into this part of the plugin, so not sure if there could be a reliable implementation.Yeah, I think we need just to be more smart and do the same thing that Java does. I am in general against adding more options, I would prefer IDE to just do the right thing.
By the way, @la10736 there’s a nice option “surround selection on typing quote or brace”, which is a little bit nicer to use than surrounders.