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.

How force the editor to use spaces instead of tabs in CCS v6

In this thread

http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/105368/373606.aspx#373606

it shows how to create a new style to force the editor to insert spaces instead of tabs.  In v6 though, the preferences seems to have changed and I can't seem to find the right place, Code Style doesn't look the same:

Where did the "named" code style go?

Mike

  • Hi Mike,

    I can't see your attachment but is the below what you are looking for?

    Best Regards,

    Lisa

  • Lisa,

    Actually no, the reference thread talks about how that setting doesn't work, and in fact I've verified many times that the check box to insert spaces for tabs is in fact checked.  CCS seems to ignore that for some reason.  It was found in a previous version of CCS that creating a new "Code Style" allowed you to set the "spaces for tabs" there, apparently overriding the one on the page you show.  However, in CCS v6, I can't find the "Code Style" page, it seems to not be where it was referenced before.

    (Sorry about the attachment, I'm new to e2e and haven't figured out how to attach things yet)

    Mike

  • Hi Mike,

    have you tried (in the top filter) typing style or code?  Using that filer box I found a "name" code style.  Perhaps that might help?  Keep us posted.

    Best Regards,

    Lisa

  • Lisa,

    Yes, I've tried 'name', 'code style' and a variety of others, still can't find the v6 equivalent of a named code style in v5.  It had a 'K&R' style and one other that I don't recall the name of built into it.  And it allowed you to create a custom one and name it, then change its properties.  The referenced thread (if you scroll down far enough) shows how to force the tabs to be spaces in your new named code style.

    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/105368/373606.aspx#373606

    Mike

  • Well, I found it.  In preferences, C/C++ -> Code Style -> Formatter

    Not sure how I missed it before. I found it by right clicking in the editor and selecting preferences in the context menu that appeared.  Formatter was under the Code Style menu then.  I could swear it wasn't there when I looked yesterday by going Window->Preferences directly, but it is now. 

    Mike

  • Hi Mike,

    ok, thanks for the update and great to hear.

    All the best with development.

    Best Regards,

    Lisa

  • This post was very helpful to me. I want to support it by showing a screenshot of the dialog that people need to edit, from CCS v6.

  • Mike Stich said:

    Well, I found it.  In preferences, C/C++ -> Code Style -> Formatter

    Not sure how I missed it before. I found it by right clicking in the editor and selecting preferences in the context menu that appeared.  Formatter was under the Code Style menu then.  I could swear it wasn't there when I looked yesterday by going Window->Preferences directly, but it is now. 

    Mike

    Mike,

    The problem you had finding that particular item item is that it isn't usually visible. What I think is happening is that setting the tab indentation via Window->Preferences->General->Editors->Text_Editors here:

    is overridden by the Formatter settings: "Sure, I'll insert your tabs. As spaces. And then I'll re-format right over top of them to Make Things Look Neat." And it's tricky to find the Formatter settings, as you discovered -- even with the help of this and some other threads it has taken me several days of intermittent frustration and searching to figure it out. Here's how to get to the second set of tabbing options... for CCSv6.1.0.00104, anyway; YMMV for any other version:

    Starting from Window->Preferences:

    In order to see the C/C++ option, you need to click on Show advanced settings, at which point things look like this:

    Oh, look! There it is! <grin>

    Now find the Formatter settings and click on the [Edit] button:

    You want to change the values in the Indentation_size: and Tab_size: options which -- depending on your screen size -- may be hard to see:

    Scrolling things a bit shows the field value box:

    Change the values in those two boxes to be consistent with what you set on the other page and tabbing and re-formatting (e.g. automatic indentation) should work "as expected".

    Unless CCSv6.2 adds some new tab-related field, of course, at which point we'll all be on our own again. <grin>

    Hope this helps the next person who wants Something Other Than 4-Space Tabs.

    Frank McKenney, McKenney Associates

  • I am using Code Composer Studio 6.1.2 and for me the Preferences Dialog has no effect at all. Also there is no C/C++ section (I am editing C code).

    But I just saw that in the context menu in the editor Window I have a 'Use spaces for Tab' option which works as expected.

  • Hi Mike,

    It also happens to me... Certain options are not shown if "Hide advance settings" at lower left corner of Preferences dialog is pressed

    Marco

  • It *does* have an effect but apparently *only* after you have opened the context menu once! Not even restarting CCS made the formatter and/or input setting work... until I found this thread and looked into the context menu - where the option was already checked. Without touching the context menu further at all I re-tried entering a tab and behold it was working... it will forever remain a mystery who I should equitably hate more... the eclipse or TI guys. m(