In latest vscode-insiders and cpp extension insider version, I noticed that open curly braces will also trigger formating?
Like this:
if (in_the_past) {
|
}
-------------------
if (it_s_now) {
|}
This is very inconvenient as it format immediately after I entered a { and put the cursor and } on the next line.
I've disabled editor.formatOnType for [cpp] in my current workspace to avoid this for now.
_Originally posted by @escape0707 in https://github.com/microsoft/vscode-cpptools/issues/1419#issuecomment-673282829_
@Colengms can you investigate? I thought the additional format on type characters should only apply to vcFormat (the original comment talked about clang-format and these new characters shouldn't apply).
We may also want to evaluate whether { is a good trigger character. I was thinking we wanted } instead.
Yeah, "{" and "}" got added and applies for clang-format too. I don't think we want either for clang-format, but "}" seems okay for vcFormat.
@bobbrow For clang-format, I've reverted to the original behavior of only doing format-on-type for semi-colon. However, for vcFormat, it's by-design that some formatting occurs when an open curly is typed. In that case we call a dedicated function: perform_format_on_open_brace(). I believe this behavior should be retained for vcFormat. Let me know if that is not the case.
Correct, we're not changing the trigger characters for vcFormat right now. Thanks!
Most helpful comment
@Colengms can you investigate? I thought the additional format on type characters should only apply to vcFormat (the original comment talked about clang-format and these new characters shouldn't apply).
We may also want to evaluate whether
{is a good trigger character. I was thinking we wanted}instead.