I see there is a way to set scrolltop in monaco editor. How would one scroll to a specific line instead of a specific pixel?
3 Answers
As in the docs: https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.ICodeEditor.html
Scroll to top, in px:
editor.setScrollPosition({scrollTop: 0});
Scroll to a specific line:
editor.revealLine(15);
Scroll to a specific line so it ends in the center of the editor:
editor.revealLineInCenter(15);
Move current active line:
editor.setPosition({column: 1, lineNumber: 3});
2 Comments
AzureIP
revealLine and revealLineInCenter does nothing in my case.
Rajodiya Jeel
The link does not work