Works great most of the time, but when typing a ( before a $variable ? $var->foo() : $default, I'd rather not see it immediately closed. Most definitely just forgot braces in the first place (because other languages may not need them to keep the correct meaning).
$variable ? $var->foo() : $default
This feature is actually provided by Visual Studio itself; I believe there is a configuration for it in Tools/Options - Text Editor.
Although, the right brace ) is "tracked" by the editor, and you can skip it with right arrow, or delete key.
@MarcHenderkes it seems brace completion actually respects the code on the current line;
If there is something on the line after the caret, the right brace is not completed.
The right brace is only completed if there is nothing else on the line.
Can you confirm that?
The expected functionality that I also got used to was that braces were closed immediately if the next character was a whitespace. At the time of creating this post (possibly still now, I can't tell as I'm on vacation) braces would always auto-close, no matter the next character or rest of the line.
I see, currently, this is provided by Visual Studio Core Editor itself; and it autocloses the brace only if it's at the end of the line.
We'll try to find if we can alter it somehow, anyways; have a nice vacation! and thanks
I wish that was the functionality, but since a few patches ago it isn't anymore.
Is it Visual Studio 2019 or 2022 (or both)?
Can you check if it's happening in other languages as well?
VS 2022, I switched about a month after release. This doesn't happen in other languages (C++/C#). There the behaviour is still as I've explained how it was before (brackets closing immediately when the next character is a whitespace or semicolon, but not before variables or ternary statements).