Skip to content

Commit 83d5026

Browse files
committed
Support going to a line/column in the Monaco editor
1 parent 50455fa commit 83d5026

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ui/frontend/editor/MonacoEditorCore.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ const MonacoEditorCore: React.FC<CommonEditorProps> = (props) => {
189189
}, []),
190190
);
191191

192+
useEditorProp(
193+
editor,
194+
props.position,
195+
useCallback((editor, _model, { line, column }) => {
196+
editor.setPosition({ lineNumber: line, column });
197+
editor.focus();
198+
}, []),
199+
);
200+
192201
return <div className={styles.monaco} ref={child} />;
193202
};
194203

0 commit comments

Comments
 (0)