Template formatting

Sysprogs forums Forums VisualGDB Template formatting

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13407
    andrew
    Participant

    Every time I type template {{ENTER}} the next line is indented. This is very irritating. How can it be disabled?

    • This topic was modified 6 years, 10 months ago by andrew.
    • This topic was modified 6 years, 10 months ago by support. Reason: Merging text from other post per user request
    #13421
    support
    Keymaster

    Hi,

    VisualGDB inserts extra indentation after incomplete statements (not ending with ‘;’ or ‘}’), so this is by design.

    If this is annoying, we could add an option to disable this behavior for templates. Could you give us an example of how you usually format your template declarations so that we could ensure the new option supports it?

    #13425
    andrew
    Participant

    With the template parameter list on one line followed by the declaration on the next as follows:

    template<class T>
    class Foo {
       // ...
    };
    #13426
    andrew
    Participant

    I should add that the problem occurs when formatting existing code. For example

    template<class T>
    class Foo {
     // ...
    };

    becomes

    template<class T>
       class Foo {
          // ...
       };

    after using the CTRL + K, CTRL + D shortcut to format the document.

    • This reply was modified 6 years, 10 months ago by andrew.
    #13515
    support
    Keymaster

    Hi,

    OK, we have added a partial workaround to this. Please try this build: http://sysprogs.com/files/tmp/VisualGDB-5.3.18.2009.msi

    You can disable template contents indentation via Tools->Options->Text Editor->C/C++ (VisualGDB)->Formatting->Don’t indent template contents.

    VisualGDB will still add indentations when you press ‘enter’ after starting a template declaration, however they will be removed once you enter the final ‘;’ or reformat the entire document via Ctrl-K, Ctrl-D.

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