-
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 breaks after certain nesting level for tab indentation #630
Comments
@slaiyer The blank rendering with editor.renderIndentGuides seems like a bug with VS Code that is fixed with 1.12.0-Insiders (although with 1.11.0 I was only able to repro a dimmer Indent Guide). The issue with clang-format is "by design". You need to add a .clang-format file and change the settings appropriately, such as the TabWith, IndentWidth, and UseTab settings. If you're still having problems, let us know. |
@sean-mcmanus The issue persists even with only the native option |
@slaiyer What issue exactly? Do you have the C/C++ (cpptools) 0.10.5 installed? What version of VS Code are you using? Our extension doesn't have any effect on the renderIndentGuides, and it renders fine on 1.12-Insiders. Our extension calls clang-format to implement formatting for C++ files, but the settings have to be setup correctly in the .clang-format file to match the tab/spacing you want. |
@sean-mcmanus VS Code updated to 1.11.2 x64 on Windows 10. ms-vscode.cpptools0.10.5 installed and enabled by default. The original post in this thread has screenshots showing the tab-based indentation issue (of resetting visual indentation levels after 4 code nesting levels) that occurs with C/C++ sources. I have narrowed it down to 2 mutually exclusive triggers:
No other formatting/code beautifying extensions installed nor settings enabled to get this minimal example. |
@slaiyer What are the contents of the .clang-format file you are using? If your tabsSize isn't 4, you'll need to change the .clang-format settings to match VS Code's settings. Maybe our default "Visual Studio" style should take into account the Visual Studio Code tab settings. I'll re-open this issue to consider that, so we work better out of the box without a .clang-format file. |
@sean-mcmanus I apologize for the continued misunderstanding. I have stopped using clang-format in its entirety and the issue depicted in the screenshots still persists. Steps to reproduce:
Since the original post here is by @alexandrudima and I cannot edit it, I have updated the original issue post as well. EDIT: Without With either |
@slaiyer Our cpptools extension uses the clang-format.exe 3.8 under the covers (there's another clang-format extension that does something similar). VS Code and the cpptools extension do not provide any other means of formatting C++ code. |
@sean-mcmanus I was not aware of that. In that case, seeing as I hope you have seen the screenshots I have added to my previous post in this thread as an afterthought. Please let me know if I can do more troubleshooting at my end. Thanks a lot for your patience. |
@slaiyer Yes, I can repro the issue. You can work around this via using the setting: |
This issue should be fixed with v0.11.0. Please let us know if it is not. |
Moved from microsoft/vscode#24485
From @slaiyer
Steps to reproduce:
"editor.formatOnSave": true
and/or"C_Cpp.clang_format_formatOnSave": true
Tab indentation example (indentation is forcibly replaced with spaces when Step 2 is performed):
Space indentation example (missing indentation guides reappear when zoom level is brought back up):
It appears as though indentation levels reset (in a way) after 4 nesting levels, but only for tab indentation.
I have tried without success:
The text was updated successfully, but these errors were encountered: