Tagged: clang format
June 10, 2022 at 00:41 #32738
I have cmake project with clang format setup (.clangformat in attachment)
There is annoying issue. I am in state as first image in imgur and I have cursor between curly braces then when I press enter the curly braces it does not properly align (as shown in second image). I think that the formatting engine does not respect clang format file.
I also had problem that I must change in Options->Text Editor->C/C++ (VisualGDB)->Tabs indent size to match the one in clang format file. When I have different settings in clang format and in visual studio settings then it does not work. I had to run Edit->Advanced->Format document to apply the correct formatting settings. I think there is some issue with formatting engine (during typing) so it does not respect clang format settings at all.
Thanks for help
I have version 5.6r6June 10, 2022 at 04:05 #32739June 10, 2022 at 09:20 #32742
Unfortunately, it is hard to suggest anything specific based on the description you provided.
In order for us to provide any help with this, we need to be able to reproduce the problem on our side.
Please provide complete and detailed steps to reproduce the issue as described below:
- The steps should begin with launching Visual Studio. They should include every step necessary to create the project from scratch and reproduce the issue.
- Please make sure the steps do not involve any 3rd-party code as we will not be able to review it. If the problem only happens with a specific project, please make sure you can reproduce it on a clean project created from scratch.
- The steps should include uncropped screenshots of all wizard pages, VisualGDB Project Properties pages and any other GUI involved in reproducing the problem. This is critical for us to be able to reproduce the problem on our side.
You can read more about the best way to report VisualGDB issues in our problem reporting guidelines, If you do not wish to document the repro steps and save the screenshots, please consider recording a screen video instead and sending us a link to it.June 13, 2022 at 02:50 #32747
There are videos of all steps. I used a xbox gamebar on windows and it cannot record across multiple windows so its splitted into multiple videos. Used clang format is in the attachment.
There is some inconsistencies that the intellisense formatting does not use clang format rules. But format document works properly.
Thanks for helpJune 13, 2022 at 07:19 #32749
I noticed that there was some error
[+0:18:05.330] Starting operation: Determining code formatting settings for C:\Users\otodu\Downloads\VisualGdbTest\VisualGdbTest.cpp
[+0:18:05.331] Error HRESULT E_FAIL has been returned from a call to a COM component. while trying load C:\Users\otodu\Downloads\VisualGdbTest\.clang-format
[+0:18:05.331] Stack trace:
[+0:18:05.331] Server stack trace:
[+0:18:05.331] at hs2.c(Byte b, Int32 a)
[+0:18:05.331] at sj3.d(String a)
[+0:18:05.331] at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object args, Object server, Object& outArgs)
[+0:18:05.331] at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
[+0:18:05.331] Exception rethrown at :
[+0:18:05.331] at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[+0:18:05.331] at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[+0:18:05.331] at sj3.d(String a)
[+0:18:05.331] at wn1.t4.a()
[+0:18:05.331] Operation completed: Determining code formatting settings for C:\Users\otodu\Downloads\VisualGdbTest\VisualGdbTest.cpp [0 msec]
Maybe there should be some warning that it cannot load .clang-format file
But even if i provide correct clang format file intellisense does not apply formatting settings from there
[+0:18:05.329] Indentation size: 3, will insert spaces
for example it uses indentation size 3 instead 2June 13, 2022 at 14:13 #32753
Thanks for the detailed repro steps. It looks like your .clang-format file is corrupt or contains statements that are not supported by Clang 6.0 used by VisualGDB:C++1Error HRESULT E_FAIL has been returned from a call to a COM component. while trying load C:\Users\otodu\Downloads\VisualGdbTest\.clang-format
Please try narrowing this down to a specific statement/line that prevents the file from being loaded. E.g. you can remove half of the statements and check if the file still loads. If yes, restore half of the previously removed ones, and try again.
If you can pinpoint a specific statement that is not loaded properly, please let us know and we will provide more details.June 13, 2022 at 23:46 #32755
Yeah in previous message I wrote that I figured it out. But even with correct clang format it does not work. The correct clang format in the attachmentJune 14, 2022 at 09:13 #32759
Sorry about the confusion.
The indentation settings shown in the diagnostic log are taken from Tools->Options->Text Editor->C/C++ (VisualGDB)->Tabs. The clang-format file should normally override them, but if it’s not happening, you can always change them manually via the VS Options window.
You must be logged in to reply to this topic.