Any way to change how indentation with tab characters works?


#1

I indent my code with tabs instead of spaces. In Sublime Text, a tab character has a variable size that depends on its location. In this example, the tabbed indentation in this block comment displays in the correct format:

/**
	Example class
	@class		MyClass
	@extends	BaseClass
	@namespace	App
*/

In Atom a tab character has a fixed size, so the same comment is displayed like this

/**
    Example class
    @class         MyClass
    @extends    BaseClass
    @namespace    App
*/

which breaks the alignment.


#2

Looks like this is fixed in 0.65.0


#3

Doesn’t look like it


#4

These differing ideas of how the TAB character should be interpreted is why many people advocate spaces over tabs (as stored in the file). There is no one right way to handle a TAB character. There is only one right way to handle a SPC character.


#5

Yeah, I thought it was fixed. It’s not :frowning:


#6

@leedohm just to be clear. I use spaces (not tabs, as per PSR), it’s the way that alignment is working currently. In Sublime Text 3 when I press the tab key, it uses spaces, but it dynamically figures out how many spaces so that code lines up.


#7

Ok, so the issue is that you want the editor to align to the next non-whitespace column in the line above when you hit TAB even if you’ve already typed some text on the line?


#8

Yep, that’s correct.


#9

Ok, that makes much more sense. Thanks!


#10

I have the same issue. To be clear, it sounds like there are two issues. First, hitting tab should bring you to the next column that is a multiple of the tab spacing (rather than a fixed number of spaces), regardless of whether you have anything in the line already, and regardless of whether you are using soft tabs. But also, a tab character should display in that way.

So if the first column is 1, and your tab spacing is 4, and you have typed nothing, hitting tab should take you to column 5. If you are not using soft tabs, and you hit space space tab, you should also go to column 5, but the hidden character should be space space tab. In other words, a tab character should display as as many spaces as necessary to get to the next column.