Why is tab spacing different between languages!


#1

When editing in different language formats the tab spacing is different. In settings it’s set to represent tabs as 2 spaces, and tabs set to hard. The gif below shows a javascript file and a python file with the same text but you can see the python file looks like it has double (4 spaces) what the javascript file has.


#2

Because the language packages have different settings. language-python has a tabLength setting and language-javascript does not. You can override each of these settings locally, either globally or per language.


#3

Hmm, this should have worked but check this…


#4

It looks like it’s working. With no setting, the language-python setting is used. But when you set it to 1 or 2, that overrides the language.


#5

Well, the length I like is what is shown when I type 2 (before the plugin automatically changes it)… Must be a bug, should I submit an issue?


#6

You can just override the Python tab length. Each package has its own settings page (accessible via Settings -> Packages), and you can just add the following to the top level (unindented) of your config.cson:

'.source.python':
  editor:
    tabLength: 4

#7

Cheers, below worked a charm.

".python.source":
  editor:
    tabLength: 2