Monaco-editor: Current Line Info and Line Change Event

Created on 31 Aug 2016  路  2Comments  路  Source: microsoft/monaco-editor

Hello,
I want to know if you can guide me how can i get Current Line Information i mean text and Line Change Event in the Editor.

Also how can i Indent / outdent the line Text

Regards,
Khurram

Most helpful comment

@itskhurram

You can get the current line text via: editor.getModel().getLineContent(editor.getPosition().lineNumber)

There are many events on the editor such as editor.onDidChangeModelContent(function(e) { console.log(e); })

You can invoke the indent action via editor.trigger('anyString', 'editor.action.indentLines', null) and the outdent via editor.trigger('anyString', 'editor.action.outdentLines', null)

All 2 comments

@itskhurram

You can get the current line text via: editor.getModel().getLineContent(editor.getPosition().lineNumber)

There are many events on the editor such as editor.onDidChangeModelContent(function(e) { console.log(e); })

You can invoke the indent action via editor.trigger('anyString', 'editor.action.indentLines', null) and the outdent via editor.trigger('anyString', 'editor.action.outdentLines', null)

Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabiospampinato picture fabiospampinato  路  3Comments

PinkyJie picture PinkyJie  路  3Comments

Spongman picture Spongman  路  3Comments

andreymarchenko picture andreymarchenko  路  3Comments

brandalorian picture brandalorian  路  3Comments