Monaco-editor: How to set tab width ?

Created on 21 Nov 2016  路  5Comments  路  Source: microsoft/monaco-editor

monaco-editor npm version: 0.7.0
Browser: Chrome 54.0.2840.99
OS: Windows 10

I want custom code tab width, use 2 spaces or 8 spaces.

Most helpful comment

model.updateOptions({ tabSize: 8 }). You can create a model yourself via monaco.editor.createModel(...) or use the one created by the editor on your behalf editor.getModel()

All 5 comments

Paging @alexandrudima. monaco.d.ts has no reference to any code tab width setting.

model.updateOptions({ tabSize: 8 }). You can create a model yourself via monaco.editor.createModel(...) or use the one created by the editor on your behalf editor.getModel()

Thanks a lot!

@alexandrudima Is your solution deprecated now? Because for me it works when I call updateOptions on the editor itself, not on the model.

@chinchang tabSize is a model property, so one must call updateOptions on the model instance in order to change tabSize.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kedyn picture Kedyn  路  3Comments

inf9144 picture inf9144  路  3Comments

ststeiger picture ststeiger  路  3Comments

Spongman picture Spongman  路  3Comments

galyech picture galyech  路  3Comments