Skip to content

Commit 547fc07

Browse files
committed
fix:Adjust where the editor opens
1 parent 4b3ddff commit 547fc07

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Service.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ export class AlicloudAPIService {
167167

168168
async openInCode(codeInfo: { code: string; language: string }) {
169169
const { language, code } = codeInfo;
170+
const getViewColumn = () => {
171+
if (vscode.window.visibleTextEditors.length > 0) {
172+
return vscode.ViewColumn.One;
173+
} else {
174+
return vscode.ViewColumn.Beside;
175+
}
176+
};
177+
const column = getViewColumn();
178+
170179
// 创建新的文件
171180
vscode.workspace
172181
.openTextDocument({
@@ -175,7 +184,7 @@ export class AlicloudAPIService {
175184
})
176185
.then((newDocument) => {
177186
vscode.window.showTextDocument(newDocument, {
178-
viewColumn: vscode.ViewColumn.Beside,
187+
viewColumn: column,
179188
});
180189
});
181190
return {};

0 commit comments

Comments
 (0)