-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting while typing similar to Visual Studio IDE #6561
Comments
Hi @TryerGit . The C/C++ Extension supports two format engines, When using clang-format, the C/C++ Extension will only format on type when When using vcFormat, the extension will format on type when either
As vcFormat has features that collide with Is this issue a dupe of #1419 ? Does vcFormat provide the behavior you are looking for? If not, are there specific changes to these features you are suggesting? |
I am able to confirm that E.g. 1 and E.g. 2 get resolved with the However, E.g. 3 although contrived does not work completely. I agree this workflow is constructed and may not happen in normal Is there a way, short of hitting Ctrl Shift i to format E.g. 3 ? I am happy with 1 and 2 happening, so I will close this issue. Thanks! |
@TryerGit Changing the formatOnType setting to true fixed it. |
@TryerGit clang-format formatting mode only supports ';' for format on type. A related issue is #5982 . The braces appear for else because you invoked the else snippet. VS Code invokes completion/snippets when Enter is used (I don't know how to change that). We could reduce the priority/order of the else snippet to be less than the keyword priority. |
I filed a new issue to track the else issue: #6582 |
I switched format style to So, this works fine for me. I have to re-evaluate why I chose |
The issue #6582 is fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/1.2.0-insiders2 |
Type: LanguageService
Describe the bug
Steps
E.g. 1
E.g. 2
E.g. 3
All of these examples work and indent/format correctly automatically in Visual Studio IDE automatically.
I read through previous issue #883 but it is not clear to me whether that issue should have resolved the examples above or not.
In settings.json, I currently have
"C_Cpp.clang_format_fallbackStyle": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}"
I like to add that on hitting <Ctrl+Shift+i>, all of these do get formatted accurately. So, this is not a bug for sure and with the above settings.json entry, formatting on hitting <Ctrl+Shift+i> works just fine. This is more a question of whether this formatting can happen automatically as the user types. If that leads to a much heavier VSCode, I can understand.
Edited to add: Vim as C++ IDE with YCM and VimSpector plugins are able to correctly and automatically handle E.g. 1 and E.g. 2 above. I have not been able to get Vim to automatically handle E.g. 3 though.
The text was updated successfully, but these errors were encountered: