Stefan Cronje · Feb 7

VSCode defaults to "spaces: 4" on new Class files, not tab

Hi all,

In the days when I was still using studio, the indentation character of choice was tab, due to misalignment of code when using non-monospaced fonts.

In VSCode when I create new class files, this defaults to 4 spaces. Where and how do I set the default indentation for ObjectScript class files?

Also, with python it should be spaces. So what is recommended when doing python script inside objectscript classes?

Thank you.

0 55
Discussion (2)1
Log in or sign up to continue

In VS Code the "editor.insertSpaces" boolean setting governs whether or not pressing Tab will insert a tab character or a number of space characters (specified in the "editor.tabSize" setting).

"editor.insertSpaces" is one of the settings which can be specified per-language. The command "Preferences: Configure Language Specific Settings..." gives you a language picker, then seeds the Settings Editor filter so you can easily set a language-specific value. Below is a screenshot showing how I can make the Tab key enter the tab character when in a document set to the objectscript-class language.

You make a good point about how Python-coded methods must be space-indented. VS Code can't help you with this, as it sees the entire .cls document as being objectscript-class language. So I suggest you leave "editor.insertSpaces" at its default (checked / true). The ObjectScript-coded methods won't mind being space-indented.

I would recommend using .editorconfig, it's supported by VSCode. And it's very useful in this thing, when would like to have a control on indention settings in the entire project.