Indentation not working?


#1

Hi,

I’ve just recently started using Atom and I really love it. Recently, for no apparent reason, indentation has stopped working for CSS and LESS files.

I tried messing around with Tab Length in Settings (has always been 2), Tab Length in Atom Beautify… but nothing works

HTML and JS files seem to be working fine (can’t figure out why)

What could’ve gone wrong?

Thanks !


#2

You’ll need to be more specific, “indentation” is a big feature area. Do you mean auto-indentation as you’re typing? Do you mean selecting text and executing the auto-indent command? Do you mean something to do with Atom Beautify?

Have you followed the suggestions in the Debugging document? Also, could you give the following information?

  • Which version of Atom are you using?
  • What OS and version are you running?
  • Do you have Emmet installed?
  • Can you reproduce the issue after completely exiting Atom and restarting using atom --safe?

#3

Hi,

I have followed the debugging document with no success.

I’m talking about the automatic indentation when you hit ‘enter’ and create a line return

Ex of what it looks like:

.test-class {
    .another { // I manually indented this one and hit enter
width: auto;
}
}
  • I am using Version 1.0.2 (and it didn’t seem to happen in 1.0)
  • I’m running Windows 7 Pro SP1
  • I do not have Emmet installed
  • I can reproduce the issue starting Atom in safe mode

Thank you !


#4

I’m not seeing what you’re reporting using Atom v1.0.3-6efb48d on Mac OS X 10.10.3. I opened my styles.less and typed what you describe:

Everything auto-indented as expected. Is there something I missed?


#5

You haven’t missed anything, it is the behavior I’m looking for (which was working in 1.0)

Now that I know that I’m not crazy, I’m really wondering what’s happening :smiley:


#6

I would try this:

  1. Close all instances of Atom
  2. Rename ~/.atom/config.cson to something else
  3. Rename ~/.atom/storage to something else
  4. Start Atom again using atom --safe

Perhaps it is part of your configuration or serialized state that is causing the issue.


#7

After comparing the ‘old’ file with the new, I noticed that disabling language-source is what is causing the issue.

Reading the description of the package pretty sums it up:

Adds basic comment, indent, and outdent patterns used as a fallback by all
source files in Atom.

So, it was my fault… but I’m hoping my mistakes will help somebody else :smile:


#8

I did the exact same thing. I had a hunch that was what my problem was, but wasn’t sure which disabled package was causing it. Thank you for finding out which package it was, haha.


#9

I had the same error for some reason I had this in my config.cson file:

  editor:
    autoIndent: false

Changed to true and problem solved!


#10

I had the same problem after changing atom version on my system. Solution given by @tomchambers2 worked for me. Although the same can be done from UI as well.

Just open editor settings (ctrl+shift+p -> Settings View: Editor) and the check Auto Indent


#11

This fixed my autoindent.

Open terminal and type:
atom ~/.atom/config.cson

search for
autoIndent

set it to true
autoIndent: true