Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Commit 3f3c9b4

Browse files
committed
Remove duplicate code
1 parent dd1d702 commit 3f3c9b4

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/extension.ts

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ const getActivePythonFile = () => {
10661066
};
10671067

10681068
const updateCurrentFileFromEditor = async (
1069-
activeTextDocument: vscode.TextEditor | undefined,
1069+
activeTextDocument: Partial<vscode.TextEditor> | undefined,
10701070
currentPanel: vscode.WebviewPanel
10711071
) => {
10721072
if (
@@ -1097,20 +1097,12 @@ const updateCurrentFileIfPython = async (
10971097
activeTextDocument: vscode.TextDocument | undefined,
10981098
currentPanel: vscode.WebviewPanel
10991099
) => {
1100-
if (activeTextDocument && activeTextDocument.languageId === "python") {
1101-
setPathAndSendMessage(currentPanel, activeTextDocument.fileName);
1102-
currentTextDocument = activeTextDocument;
1103-
} else if (currentFileAbsPath === "") {
1104-
setPathAndSendMessage(currentPanel, getActivePythonFile() || "");
1105-
}
1106-
if (
1107-
currentTextDocument &&
1108-
utils.getActiveEditorFromPath(currentTextDocument.fileName) ===
1109-
undefined
1110-
) {
1111-
await vscode.window.showTextDocument(
1112-
currentTextDocument,
1113-
vscode.ViewColumn.One
1100+
if (activeTextDocument) {
1101+
await updateCurrentFileFromEditor(
1102+
{
1103+
document: activeTextDocument,
1104+
},
1105+
currentPanel
11141106
);
11151107
}
11161108
};

0 commit comments

Comments
 (0)