Automatic code formatting

Sysprogs forums Forums VisualGDB Automatic code formatting

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21162
    Jensa
    Participant

    Hi,

    We’re getting some weird issues with the auto-formatting of code if there is a c++ style comment on the previous line before an if statement.

    For example this code works fine and is how we want it:

    if ( something ) {

      return;

    }

    But if we add a comment on the line before like this it changes to the following when it’s auto formatted on the ending curly brace:

    // comment

    if( something )

    {

      return;

    }

    Any ideas what could be wrong?

    Regards

    Jens Nilsson

    • This topic was modified 6 years, 6 months ago by Jensa.
    • This topic was modified 6 years, 6 months ago by Jensa.
    • This topic was modified 6 years, 6 months ago by Jensa.
    #21168
    support
    Keymaster

    Hi,

    Please try this build: http://sysprogs.com/files/tmp/VisualGDB-5.4.3.2323.msi

    It supports using clang-format instead of our regular code formatter (it also features a convenient GUI editor for the formatting styles with live preview). You can enable clang-format for VisualGDB projects via Tools->Options->Text Editor->C/C++ (VisualGDB)->Formatting Engine and then use the format icon in the upper right corner of the source editor to launch the interactive style editor.

    #21191
    Jensa
    Participant

    Hi,

     

    Thanks, that works a bit more consistently indeed and it supports most things that we want from it.

    I guess now I just gotta pester the CLANG team to implement the last few strange things our coding standards want 🙂

     

    Regards

    Jens Nilsson

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