Skip to content

Commit

Permalink
Re #167719. Avoid fetching whole editor content if the model is too l…
Browse files Browse the repository at this point in the history
…arge.
  • Loading branch information
rebornix committed Sep 17, 2023
1 parent 3b60c12 commit 0050fbb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ export function registerChatCodeBlockActions() {
}

const noSelection = editor.getSelections()?.length === 1 && editor.getSelection()?.isEmpty();

if (noSelection && editorModel.isTooLargeForTokenization()) {
return false;
}

const copiedText = noSelection ?
editorModel.getValue() :
editor.getSelections()?.reduce((acc, selection) => acc + editorModel.getValueInRange(selection), '') ?? '';
Expand Down

0 comments on commit 0050fbb

Please sign in to comment.