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

poloten4uk picture poloten4uk  路  3Comments

robclive picture robclive  路  3Comments

chengtie picture chengtie  路  3Comments

ststeiger picture ststeiger  路  3Comments

Panhaiwei picture Panhaiwei  路  3Comments