Sometimes tab inserts spaces, even with soft tabs off


It only happens with cs files. I installed the Language Css package, maybe a bug in that?


Do you mean CSS files? Or CSharp files?


CSharp files (.cs extension).


For some reason the editor will autodetect spaces/tabs in each file, and that overrides the preference setting. It will switch to inserting spaces for a file where any line begins with any number of spaces. This happened to me with a file that contained multiline comments with lines beginning with a space and asterisk. It is very annoying.


I agree.

I find it unacceptable, and have had to stop using atom until I can turn it off. :frowning:


If you want to force it to use your soft tabs setting, you can make a change in /Applications/
In TextBuffer.prototype.usesSoftTabs on line 825, just add a return false; at the start of the function.

Unfortunately this will break when Atom updates.



I filed an issue here:


Perhaps you could submit a pull request for the Text Buffer package?


Rather than just returning false, we should probably look to see the if the user is using softTabs. As a result I think the following would be a more appropriate fix than simply returning false.

TextBuffer.prototype.usesSoftTabs = function() {
      if (!atom.config.get('editor.softTabs')) { return false; }
      var match, row, _i, _ref1;

or in CoffeeScript

return false  unless atom.config.get("editor.softTabs")

Updated: Pull Request at


This also seems to be the case in javascript files. Related?


Happens in PHP, HTML, as well as mixed HTML/PHP. It probably happens in most syntax modes to be quite honest. It’s a maddening bug.


So is there a work around or solution to this? Maybe something in the config.cson or


couldn’t we put this in the file?


@middle8media I haven’t tested this at all, but if you wanted to do this in the file, you would add the following:

editor = atom.workspace.getActiveEditor()
editor.buffer.usesSoftTabs = ->
      return false unless atom.config.get("editor.softTabs")
      for row in [0..@getLastRow()]
            if match = @lineForRow(row).match(/^\s/)
                  return match[0][0] != '\t' 


Regarding the pull request that was denied due to use of the atom global - couldn’t the issue therefore be solved in one of two ways:

  1. The ‘uses soft tabs’ setting is passed to TextBuffer as a constructor parameter or a setter-like method. This way we don’t rely on the atom global, only the fact that TextBuffer should care about soft tabs or not.

  2. The code that actually calls TextBuffer::usesSoftTabs() needs to have the code from the PR so the reliance on the atom global is no longer in TextBuffer but in whatever calls it. If whatever calls it is also in the atom/text-buffer package, then maybe whatever calls that and so on up the chain till it’s the atom/atom package. Obviously it could be the case that that won’t work as it’s all done in atom/text-buffer but if that’s the case then surely it needs to know about the soft tabs preference anyway so has it stored somewhere passed in from atom’s core. Anyway, I’m not sure how easy it is to tell what actually calls TextBuffer::usesSoftTabs() (I tried setting a breakpoint and then opening a file and it didn’t stop so I’m out of ideas) so can’t tell how viable this solution is.

Just a couple of ideas, anyway.


Just putting in another vote here that a fix for this is needed. As far as I’m concerned, it’s a bug that makes disabling the “soft tabs” option a bit of a farce.


Please, another vote to fix this. It’s an incredible pain point when editing C# files here.


I’m pretty sure this was fixed:

It works perfectly for me now.


I’m using the latest public released version am seeing the behavior still (and the usesSoftTabs hack isn’t working now).



The new work around involves editing:


and hacking Editor.prototype.usesSoftTabs = function() {

to return false.

Could we get a “Really never use soft tab option?”