CLIon Nova indenting with tab character when spaces is

Just tried CLion Nova and all my 4 space indents are converted to tab characters. In Settings → Editor → Code Style → C/C++ → Tabs and Indents → Indent style = Spaces. “How to align when tabs are used for indents" = “Use spaces”

WHY?! 

Perhaps the “Nova will soon be default” announcements should perhaps be postponed until you have sorted fundamental bugs like code formatting issues.

0
7 comments

Tried adding a .clang_format file, it “works sometimes”… I don't know if that did the trick or CLion Nova was just “in the mood for spaces” a that time.

0

Hi Ola Mattsson!

Sorry for the inconvenience caused. 

  1. Do I understand correctly that it works fine now?
  2. Could you please clarify what option is selected in Settings | Editor | Code Style | C/C++ > General? Is it CLion formatter or Clang-Format?
0

Hi Anna,

1, No, not unless random indent behaviour is intended, which I assume is not.

2. CLion formatter

0

1. Is the Detect and use existing file indents for editing option enabled or disabled in File | Settings | Editor | Code Style?

2. Please open any file where the issue occurs and provide a screenshot of the Indentation widget on the Status bar.

3. Please provide a screenshot of File | Settings | Editor | Code Style | C/C++ > General.

4. What CLion version do you use (Help | About CLion)?

5. Please create a default "Hello, World!" project (File | New Project > C++ Executable > Create). What indents are used in this project?

0

CLion 2025.2.3

Detect and use existing file indents for editing is disabled

 

.clang_format has these lines, added the file after the problem occurred 

UseTab: Never
IndentWidth: 4
TabWidth: 4
 

5. new project does 4 spaces.

 

0

Please disable the Read code style from .clang-format file option in File | Settings | Editor | Code Style | C/C++ > General, save the changes, open any file where the issue occurs in the editor, place the caret in the code of this file, and provide a screenshot of the Indentation widget on the Status bar:

Also, please clarify if this “all my 4 space indents are converted to tab characters” happens with the existing indents (i.e., during the code reformating), or it happens when you add a new line in the code.

0

For what it is worth, I've been dealing with the same issue. It will sometimes use spaces and sometimes tabs, even though my settings say to use spaces, all the files I edit use spaces already, and even though the indentation widget at the bottom says “4 spaces”. After finding this ticket, I tried disabling Nova and it seems to have fixed it.

I have “Detect and use existing file indents for editing” disabled. I also have “Read code style from .clang-format file” disabled. This is with C++ code.

With Nova, I have a function declaration in a C++ header that is indented (with spaces) and my cursor is at the end of the line. I hit Enter, the cursor goes to the next line, unindented (which isn't great already). Then I type a new function name and press Tab to ident it, it indents it using a Tab instead of spaces (incorrect).

After disabling Nova in the settings and restarting the IDE, when I hit Enter, the cursor is *indended* on the next line (same indentation as the previous line, which is ideal) and is indented with *spaces*, not tabs.

2

Please sign in to leave a comment.