Skip to content

Commit

Permalink
refore: retain selectedText
Browse files Browse the repository at this point in the history
  • Loading branch information
车南 committed May 14, 2024
1 parent b1c0920 commit 08dba49
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/shared/editorSetCode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* @Author: ZtrainWilliams [email protected]
* @Date: 2023-08-18 13:44:10
* @Description:
*/
const vscode = require('vscode');

export const getPreviousEditorText = () => {
let activeEditor = vscode.window.activeTextEditor;
let previousEditor = activeEditor.document._savedDecorations[activeEditor.document._savedDecorations.length - 2];
// let previousFileUri = previousEditor.document.uri;

let selection = previousEditor.selection;
let selectedText = previousEditor.document.getText(selection);
console.log(previousEditor, selectedText);
return selectedText;
};

// do something with previousFileUri and selectedText

0 comments on commit 08dba49

Please sign in to comment.