Why restrict tab length?


#1

I upgraded my atom to ver 0.135 and I found that the tabLength variable can only be one of these five numbers – 1,2,4,6,8 (in earlier versions it could be any number.)

Do you plan to keep it this way? For one of my projects I need to use tabLength = 3 so this is a pretty big deal for me…

Thank you,
Ted


#2

It looks like @benogle made this change:

While I consider a tab length of 3 heretical, I can understand needing to conform with an established standard. You may want to open a bug on Atom Core and reference this commit and Discuss topic.


#3

Thanks, 3 was certainly not my choice. Opened a bug – https://github.com/atom/atom/issues/3724


#4

As mentioned, this seems to be due to the new config schemas. A few quick tests show that there are no strict checks on the input, so writing the following in the console will set the tab length to 3: atom.workspace.getActiveEditor().setTabLength(3)

If you always want to have a special tab length for certain files, add this to your init script:

atom.workspaceView.eachEditorView (editorView) ->
  editor = editorView.getEditor()
  grammar = editor.getGrammar().name
  if grammar is 'Java'
    editor.setTabLength 4