Indentation of namespace contents

Sysprogs forums Forums VisualGDB Indentation of namespace contents

This topic contains 6 replies, has 2 voices, and was last updated by  support 1 week, 2 days ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #20853

    aronrubin
    Participant

    How do I configure the VisualGDB formatter to not indent namespace contents? There are other advanced formatting issues like misaligned argument indentation but the namespace one is particularly frustrating.

    Thank you

    #20857

    support
    Keymaster

    Hi,

    VisualGDB tries to inherit the regular Visual C++ formatting settings under Tools->Options->Text Editor->C/C++, so please double-check that the indentation settings there match your expectations. If VisualGDB still indents the code the wrong way, please attach a screenshot of the relevant VC++ setting and a screenshot of a formatted code fragment and we will try investigating this further.

    #20910

    aronrubin
    Participant

    Everything matches. Looking into the problem further as it appeared intermittent I have found that the indentation (not just for namespaces) while typing (newline, semicolon, or close brace) is erratic. However if I have everything written and I select the same code and Edit -> Format Select I get the desired/expected formatting style. I do have settings expressed vi Text Editor -> C/C++, Text Editor -> C/C++ (VisualGDB), .editorconfig file, and .clang-format file. All are consistent as far as I can tell.

    Attachments:
    You must be logged in to view attached files.
    #20913

    aronrubin
    Participant

    Here is a small header that was funky as I wrote it. It is part of a cmake project that is being cross compiled for a Raspberry Pi (filesystem synchronized):

    #20918

    support
    Keymaster

    Hi,

    This looks consistent with your settings – the namespace contents are not indented, the class contents are. If you could narrow this down to some specific steps that lead to undesired behavior, we should be able to diagnose/fix this. Otherwise it is hard to see what exactly could be causing the trouble.

    #20920

    aronrubin
    Participant

    Sorry that version was after I fixed the formatting. Here are some artifacts if I just type enter after the curly brackets (lines 55 and 69):

    • This reply was modified 1 week, 5 days ago by  aronrubin.
    #20925

    support
    Keymaster

    Hi,

    Thanks for the repro case. It looks like VisualGDB is incorrectly picking up the indentation of the “width(width), height(height) {” line as a base instead of the “ImageRef( uint32_t fmt_4cc,” line. We are currently experimenting with switching our indentation engine to clang-format (that will also let you reuse the clang-format settings files), so this will likely resolve the issue once the switch is complete.

    If we decide to delay the switch to one of the next VisualGDB releases, we will improve our current indentation logic to locate the start of the statement properly.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.