How to make vscode stop overriding closing parentheses on insertion - visual-studio-code

When I try to add closing parentheses, it always override the next parentheses to the right.
Here is a screen capture (it looks like I hit the right-key on the keyboard, but I'm actually inserting a new closing parentheses):
Is it possible to change this behavior?

As of version 1.38, the answer is yes, you can turn it off completely, while still keeping the autoclosing brackets.
That version introduced a new setting, editor.autoClosingOvertype, which can take three possible values:
always - always overtype closing parens (the old, classic, Sublime-Text-inspired behavior)
auto - "smart" overtype which tries to detect whether a closing paren was automatically inserted by the editor, and overtypes only those parens (this is the default)
never - never overtype closing parens
The current default behavior was introduced in version 1.37. At that time, there was no setting available, you just got the "smart" overtype behavior no matter what.
I'm leaving the material below for historical purposes.
No, it's not possible (yet), and this is by design. When you are typing brand-new code, and you type an opening bracket, you get the closing bracket automatically (when you have editor.autoClosingBrackets on, of course). Then, when you are finished with typing whatever you want inside those brackets, how are you going to "exit" and leave the closing bracket where it is? The most natural way is to type a closing bracket! Some disagree, but many typists find this much easier than moving their hand all the way out to the arrow keys or mouse to move past it.
Note that this behavior is largely inspired by and modeled after what Sublime Text does.
It may be helpful to understand that the autoclosing brackets feature isn't primarily for saving keystrokes. Rather, its main purpose is to improve the stability of syntax highlighting (which can get wonky when there is an unclosed bracket), and secondarily to help prevent you from forgetting to type the closing bracket. If you happen to navigate away for some other reason without typing it, then congratulations, you do get that bracket for free!
The two simplest options you have if you want to add a bracket (and let me note that in your example, you'd be adding a mismatched bracket) are to either (1) put the cursor after the cluster of closing brackets before you type a new bracket, or (2) put the cursor where you did, but just keep typing closing brackets until a new one is added. In either case, any new brackets will only be added to the end of the cluster.
Update (now obsolete):
For what it's worth, there's now an issue for this on the tracker, as well as a pull request to create a setting which allows you to turn off the "bracket-swallowing". For anyone who is reading this, if it's something you're interested in, you should give your feedback on the pull request.
Further update (now obsolete):
There is currently new code being tested which will make the bracket overtyping more sophisticated. The plan is for the editor to keep track of which brackets have automatically been generated, and only type over those brackets. Once the cursor leaves the bracketed area, the editor stops keeping track of those brackets and they become "full-fledged" characters that can no longer be typed over. Hopefully, this will retain the overtyping where it's useful and get rid of it where it's not. Note that the current plan is for this new behavior to become standard, and to not have a setting to control whether it is in effect.

Try setting:
"editor.autoClosingBrackets": "never"
to disable the autoclosing brackets feature entirely.

Vscode has finally fixed this issue, and you don't need to do anything in order to get the new behaviour. Now it will swallow only brackets that were automatically added, so everything works as expected. If you already disabled the autoClosingBrackets option from the settings, it is recommended to turn it on again now.

The way to work with the VSCode original setting is to add new parenthesis at the end of a list of parenthesis.
...if (test === funFunction(data))| /* <- here */ {...
You should be able to type a new parenthesis and it won't override the old one. This doesn't solve your problem, but if you wanted to follow the paradigm that VSCode is using then there you go.
(personally I disable it like the other comments say)

There's another option available now called autoClosingBrackets beforewhitespace. This will overtype an automatically added parenthesis but it will not overtype of there's any characters to the right of that closing parenthesis. This is perhaps a step closer to the OPs intended behavior, it certainly saved me from going totally bald.

Related

VS Code: Autofill (in Scala / Metals) forces the cursor to jump *after* the parentheses

I don't think this is just Scala, or the Metals plugin. I remember this happening with Python, too, but my current situation is with Scala.
I really like using autofill and suggestions; it's my favorite part of any IDE, including VS Code.
VS Code autofill works great, it's just really frustrating where it puts the cursor after autofilling. And I feel like I must be doing something wrong, since I couldn't find any search of others having this problem.
Example:
Below I am writing println, just as a dummy, but it happens with any autofill. I type enough so that I can see the autocomplete options appear.
Then I hit to autocomplete on the highlighted option, and it fills with the cursor after the closing parenthesis:
But, of course, when I autofill, I want the cursor to be inside the parentheses, not after them.
What can I do to get autocomplete to be more friendly in VS Code?
Argh!! I eventually figured out what was happening, and why it seemed so inconsistent:
If I choose an autofilled function that requires no arguments, then it will autofill and place the cursor at the end of the parentheses. If I choose one that does require arguments, then it will go inside the parentheses.
That makes sense, except that there are several functions which can be used without arguments, but rarely are, and VS Code will always put the no-argument case as the top choice. So, if you see the top one and are "happy" with it and choose it, the cursor will jump to the end.
As you can see above, there is a no argument println() which is the top of the autofill list. Not ideal, but at least now I understand what was going on. Not sure of a fast way to fix it, since again, this is something that I will be typing a bunch. Probably just avoiding autofill will be fastest. :(

After VS Code auto closes a quote, parentheses, or bracket, what key do i hit to move to the next position after that closing mark?

Sorry for roughly worded question.
I'll start typing something in VS Code like class="bob", and as soon as I type the opening " mark, VS Code will auto populate the closing " mark as well. Very helpful! BUT, once I'm done entering my string of information, I find myself having to adjust my keys on my keyboard to arrow right past the character that was automatically added, then hit a space, and continue on my coding way.
However this can interrupt my typing flow, as it would be just as easy if not easier for me to type the closing " mark myself without adjusting my hand from the default keyboard position.
This happens with other characters, too, not just quotes. Parentheses, brackets, single quotes, and similar items that show up in pairs.
When I watch videos of some people coding, they seem to gracefully whiz by those auto-added closing punctuation marks, so it makes me think there is something I'm missing in how I accept that automated input. Some way that is more zen like than using a right arrow.
Any guidance is much appreciated.
This worked for me;
Go to VS Code settings
Search "autoclose"
Disable "Auto Closing Tags"
Change "Auto Closing Quotes" from 'always' to 'never'
Change "Auto Closing Brackets" from 'always' to 'never'
You have several options:
Type the character that added automatically. For example, if you type { and automatically VS Code added } you can also type } to continue typing whatever you want. VS Code is smart to not doubling the automatically added character
Use End key
Use arrow right key
I think the VS Code team didn't find it needed to add some special key for this need, since all these options are also one key each.

Visual Studio Code bracket auto completion

This has been annoying me for a while. VSCode doesn't let me type a closing bracked or parenthesis or the like ( ")", "]", "}") when there is already a closing symbol of the same type.
In this WEBM you see me try to set another set of brackets and VSCode skips the closing bracket that I typed. This is extremely annoying.
WEBM
How do I disable this behaviour in VSCode? (Or correct it, so VSCode closes the inner bracket for me.)
Edit: I know I can disable auto closing brackets in VSCode with "editor.autoClosingBrackets": false. But I don't want to disable it altogether. I just want to disable the overtyping.
TL;DR: As of June 2019, it's not possible to disable only the overtyping part of the autocloseBrackets function. You can only disable auto
bracket closing altogether.
Some people suggest using the TabOut Extension for Visual Studio Code to tab out of quotes, brackets, etc.
Ok, so what I found out over at the VSC Github is this:
[...] This can be turned off via editor.autoClosingBrackets. The feature
consists of multiple parts:
one is that when ( is typed, the result is (|).
the other part that is hit here, is that when ) is typed and ) follows the cursor, ) will be overtyped.
The feature is implemented language agnostic and looks only locally at
the next character. It does not count brackets to determine if the
code is "bracket unbalanced".
(Source: https://github.com/Microsoft/vscode/issues/35799)
At the moment, it's not possible to fix this, without losing the auto
bracket closing feature. The above thread has since been closed. New one is here: https://github.com/Microsoft/vscode/issues/37315 , but no patch has come out yet.
I face the same issue,
It's because of the GIT COPILOT once I uninstall and restart the VS CODE it's working properly now

How can i get libreoffice writer to automatically add a closed bracket when I open a bracket?

I am currently writing my bachelor's thesis in Libreoffice Writer. To make the working process easier I wondered if there is a way to get writer to automatically add an closed bracket when I type an open one. This would be useful, because I have to quote many times and I do this by writing the quote in "..." followed by the last name of the Author e.g. (STEPHEN 2005: 44).
To keep my writing flow going on I would find it easier if I don't have to hop with my fingers so many times to simply write the source of my quote.
So, is there a way to make libreoffice add the second bracket in the moment I enter the first one and then move the cursor back into the brackets so I can continue writing?
Regards, Mario
You can set up AutoCorrect Options in the Tools menu to add in parenthesis. As a test I set up ppp to change to (). However the cursor does not end up inside.
To do this in a single key press, you would need to set up a custom shortcut key (Tools -> Customize, Keyboard tab) to call a macro. The macro would be pretty simple and could be created by recording it. This would allow you to move the cursor to end up inside, as you requested.
Instead of maintaining the references manually, for scholarly writing I recommend you use a tool such as Zotero. It has a plugin for LibreOffice. In my experience, maintaining the references manually will eventually lead to mistakes. Zotero reference stylesheets allow you to use a consistent citation style, something your professors will appreciate.

Disable parenthesis matching in emacs

When I'm typing in emacs, in particular when I'm editing a LISP file, emacs automatically matches parentheses for me. This would be fine, except that it doesn't let me delete a parenthesis if it would cause a parenthesis imbalance. I suppose there might be people out there who find this a pleasant feature, but to me it's just terrible. I'm fine with it automatically writing a closing parenthesis for me, but I want to be able to delete a parenthesis when I want. It does something similar for quotes as well. This is really obnoxious! How do I stop it?
Emacs doesn't do that by default, that sounds like ParEdit. You might be able to derive from the installation description how to get rid of it.