Single line if statement formatting

Sysprogs forums Forums VisualGDB Single line if statement formatting

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #27067
    crmabs
    Participant

    Hi there,

    Yesterday I spent quite a good few hours trying to figure out how to achieve single line if statements with document formatting (ctrl+k ctrl+d) and I did not succeed.
    I had Jetbrains Resharper C++ also running next to VisualGDB – by the way they work together perfectly – which might be an important detail. Normally setting up something like this takes just a little googling and some gut driven intuition. I think this is not the case here. Multiple sections for C/C++ and Cland tidy is also mixed into the picture.

    One test I’ve done one test though: i used a minimal main.c with a single line if statement in a function.

    1 – all extensions on  – VisualGDB off: formatting is good. It does what I expected. (well, I like single line ifs)

    2 – all extensions off – VisualGDB on:  formatting breaks the single line if statement in two lines.

    So this made me thinking that the formatting issue has something to do with VisualGDB. Please point me into the right direction! I’m sure it’s somewhere in front of me. 🙂

    Thanks!

     

     

    #27068
    crmabs
    Participant

    forgot to mention that VisualGDB 5.5 was used.

    #27072
    support
    Keymaster

    Hi,

    VisualGDB would normally use the clang-format engine to format the source code. Clang-format uses its own configuration files that are not 100% in sync with the regular Visual Studio formatting options (although VisualGDB does synchronize the main options).

    That said, VisualGDB comes with a graphical editor for the clang-format configuration files, so you can easily tweak the code formatting behavior by clicking the button shown below:

    Attachments:
    You must be logged in to view attached files.
    #27074
    crmabs
    Participant

    As per usual it was right in front of me… :]

    In the meanwhile I hacked my through c:\Users\andras\AppData\Local\VisualGDB\.clang-format

    by adding AllowShortIfStatementsOnASingleLine: true

    Now I go and check that formatting style editor. You can close this thread.

    Many thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.