Improve go-to-definition scroll to position the cursor near the viewport top

This commit is contained in:
Jonatan Kłosko 2024-09-05 22:13:10 +07:00
parent 2468fa3397
commit 7430843c9b

View file

@ -365,11 +365,16 @@ const Cell = {
scrollEditorCursorIntoViewIfNeeded() {
const element = this.currentEditor().getElementAtCursor();
// Scroll to the cursor, positioning it near the top of the viewport
element.style.scrollMarginTop = "128px";
scrollIntoView(element, {
scrollMode: "if-needed",
behavior: "instant",
block: "center",
block: "start",
});
element.style.scrollMarginTop = undefined;
},
};