Skip to content

Commit

Permalink
fix:Adjust where the editor opens
Browse files Browse the repository at this point in the history
  • Loading branch information
yini-chen committed Jun 20, 2024
1 parent 4b3ddff commit 547fc07
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ export class AlicloudAPIService {

async openInCode(codeInfo: { code: string; language: string }) {
const { language, code } = codeInfo;
const getViewColumn = () => {
if (vscode.window.visibleTextEditors.length > 0) {
return vscode.ViewColumn.One;
} else {
return vscode.ViewColumn.Beside;
}
};
const column = getViewColumn();

// 创建新的文件
vscode.workspace
.openTextDocument({
Expand All @@ -175,7 +184,7 @@ export class AlicloudAPIService {
})
.then((newDocument) => {
vscode.window.showTextDocument(newDocument, {
viewColumn: vscode.ViewColumn.Beside,
viewColumn: column,
});
});
return {};
Expand Down

0 comments on commit 547fc07

Please sign in to comment.