Skip to content

Commit

Permalink
Support going to a line/column in the Monaco editor
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Feb 10, 2025
1 parent 50455fa commit 83d5026
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ui/frontend/editor/MonacoEditorCore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ const MonacoEditorCore: React.FC<CommonEditorProps> = (props) => {
}, []),
);

useEditorProp(
editor,
props.position,
useCallback((editor, _model, { line, column }) => {
editor.setPosition({ lineNumber: line, column });
editor.focus();
}, []),
);

return <div className={styles.monaco} ref={child} />;
};

Expand Down

0 comments on commit 83d5026

Please sign in to comment.