How to surround selection with parenthesis?
Hey folks!
I have Surround selection on typing a brace or parenthesis enabled, but it only seems to work for braces and not parenthesis.
Say I have this line:
var foo = "foo";
If I select "foo" then press {, I end up with:
var foo = {"foo"};
...which is great! But if I select "foo" then press ( instead, I end up with:
var foo = (;
...which isn't what the documentation claims:
If this checkbox is selected, you can select a code block or an expression, then type an opening
{or a closing}brace to put the selection inside braces, or type an opening(or a closing)parenthesis to put the selection inside parentheses.
What am I doing wrong?
Thanks!
Please sign in to leave a comment.
Hi, Cariad
To make it behave as you want, please check the checkbox "Auto-insert pair brackets, parentheses and quotes" in Settings:
Editor | General | Typing Assistance-> Auto-insert pair brackets, parentheses and quotes
Let me know if you have any questions.
Thanks Dmitry Kazantsev! I'm clearly too stupid to use Rider. I lost half of my evaluation period trying to figure out how to configure the editor and waiting for support. My evaluation licence has since expired, and I've found myself far more productive in VS Code.
Thanks for sharing your experience, Cariad . Please feel free to contact us via Sales Support and we'll see what we can do about possibly extending the evaluation period.
Moreover, the new version of Rider 2021.2 is coming (around the end of July), so you will be able to retake your evaluation period.
Hey Dmitry Kazantsev, I know this is an old post but I'm going to jump on this post as it's similar to the issue I'm having, let me know if you want me to move this elsewhere.
I'm noticing that when I try to surround my selection with brackets while the selection is wrapped in quotes it is replacing the text. Is there an option to have this behavior work while working within quotes?
For example when i do:
if I were to surround this string in brackets by selecting the string and pressing "(" or "{", i get:
("Hello World"){"Hello World"}
as expected.
but if i wanted to wrap from within the quotes i get:
"(""{"
which isn't the consistent behavior i would expect. Is there a setting for this somewhere?
On another note, the "[" bracket doesn't follow any of this behavior at all. Repeating the above examples, i get:
this is while using C# in Rider, I haven't tested on another language.
It would be nice if this behavior was consistent or could at least be made consistent, if there isn't already.
Thanks!
Edit:
I have also noticed that this behavior also doesn't work for "<" brackets and follows the same behavior as "[" brackets.
Hello Dean,
Thank you for your feedback. We have the following tickets on our tracker:
Support "Surround selection on typing a quote, brace or parenthesis" in strings
Add surround selection with angle braket '<'
Add surround selection with square braket '['
We would appreciate it if you could upvote these issues to demonstrate the additional interest.
Thanks Dmitry Kazantsev, I have added my interest to those tickets. Hopefully these small changes can find their way into Rider someday.
Thank you for your feedback.
Should you have any other questions or difficulties in the future, do not hesitate to contact support.
Have a great day!.