refactor: calculate document content separately

This commit is contained in:
Jacob Kim 2025-07-25 10:21:16 -07:00
parent c172170569
commit f319a40c64

View file

@ -829,6 +829,8 @@ const getCommandsMap: (
return;
}
const documentContent = editor.document.getText();
// Calculate the editable region boundaries around the current cursor position/
const editableRegionStartLine = Math.max(
currentPosition.line - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN,
@ -840,8 +842,7 @@ const getCommandsMap: (
);
// Get the current text in the editable region.
const oldEditRangeSlice = editor.document
.getText()
const oldEditRangeSlice = documentContent
.split("\n")
.slice(editableRegionStartLine, editableRegionEndLine + 1)
.join("\n");