This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCSv6.1.1: formatter is adding newline after namespace resolution operator

Guru 20045 points


Hello,

The source code formatter is adding a newline after the namespace resolution operator.

for example,

Before format:

 SomeNameSpace::functionInNameSpace();

After format:

SomeNameSpace
::functionInNameSpace();

What setting do I need to change to stop the formatter from adding the newline?

Stephen

  • Window > Preferences > Show advanced settings
    Window > Preferences > C/C++ > Code Style > Formatter > Edit...

    seems like where this would be configured.  Unfortunately it is not obvious to me which setting would be giving the behavior you describe.

    I am guessing this behavior is inherited from Eclipse/CDT.  If you can't get a satisfactory answer here, you might try an Eclipse forum.

  • I think all the built in formatters do the same thing for this situation.
  • Does anyone at TI have any idea how to stop it from behaving this way?

  • Ok, I think I found out what is causing the issue.

    The file I was trying to format has a .c file extension. The problem goes away if I change the extension to .cpp.

    I had thought that the treat c as cpp option would allow the formatter to work properly, however, that is not the case. This make sense since the formatter is a separate plug-in.

    I am wondering if the the treat c as cpp option should be moved to the preferences c/c++ section.

    Stephen