Skip to content

Commit fc60dcf

Browse files
committed
fix doc open position
1 parent a532a73 commit fc60dcf

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/extension.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"use strict";
22
// The module 'vscode' contains the VS Code extensibility API
33
// Import the module and reference it with the alias vscode in your code below
4-
import * as vscode from "vscode";
54
import { PontManager } from "pontx-manager";
65
import PontMetaFetchPlugin from "pontx-meta-fetch-plugin";
6+
import * as vscode from "vscode";
7+
import { PontFileDecoration } from "./explorer";
8+
import { AlicloudAPIPontParserPlugin } from "./plugins/parser";
79
import { alicloudAPIMessageService } from "./Service";
810
import { findAlicloudAPIConfig, pontConsole, VSCodeLogger } from "./utils";
911
import { AlicloudAPISerializer, AlicloudAPIWebview } from "./webview";
10-
import { PontFileDecoration } from "./explorer";
11-
import { AlicloudAPIPontParserPlugin } from "./plugins/parser";
1212

1313
import { AlicloudApiMetaGeneratePlugin } from "./plugins/generate";
1414
import { getProductRequestInstance } from "./productExplorer";
@@ -48,7 +48,7 @@ export async function activate(context: vscode.ExtensionContext) {
4848

4949
const globalState = context.globalState;
5050
const lastPromptKey = "lastPromptTime";
51-
const currentVersion = vscode.extensions.getExtension("alibabacloud-openapi.vscode-alicloud-api").packageJSON.version
51+
const currentVersion = vscode.extensions.getExtension("alibabacloud-openapi.vscode-alicloud-api").packageJSON.version;
5252
const storedVersion = globalState.get("extensionVersion");
5353
const experienceQuestionnaireKey = "questionnaireExpiration";
5454
// 检查是否是第一次启动新版本,新版本更新后,需要重新开启问卷调查

src/webview.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import * as fs from "fs-extra";
2+
import { ObjectMap } from "pontx-spec";
13
import * as vscode from "vscode";
2-
import { htmlTemplate } from "./utils";
3-
import * as path from "path";
44
import { alicloudAPIMessageService } from "./Service";
5-
import { ObjectMap } from "pontx-spec";
6-
import * as fs from "fs-extra";
5+
import { htmlTemplate } from "./utils";
76
export type PanelConfig = {
87
specName: string;
98
modName: string;
@@ -47,13 +46,13 @@ export class AlicloudAPIWebview {
4746
openTab(extensionUri: vscode.Uri, panelConfig: PanelConfig) {
4847
const panelKey = getPanelKey(panelConfig);
4948
const activeEditor = vscode.window.activeTextEditor;
50-
const getViewColumn = () =>{
49+
const getViewColumn = () => {
5150
if (activeEditor && vscode.window.visibleTextEditors.length > 1) {
5251
return activeEditor.viewColumn;
5352
} else {
54-
return vscode.ViewColumn.Two;
53+
return activeEditor ? vscode.ViewColumn.Two : vscode.ViewColumn.Active;
5554
}
56-
}
55+
};
5756
const column = getViewColumn();
5857

5958
let webview = AlicloudAPIWebview.webviewPanels[panelKey];
@@ -71,7 +70,7 @@ export class AlicloudAPIWebview {
7170
{
7271
// Enable javascript in the webview
7372
enableScripts: true,
74-
retainContextWhenHidden: true
73+
retainContextWhenHidden: true,
7574
},
7675
);
7776
webview = AlicloudAPIWebview.webviewPanels[panelKey];
@@ -121,7 +120,7 @@ export class AlicloudAPIWebview {
121120
{
122121
// Enable javascript in the webview
123122
enableScripts: true,
124-
retainContextWhenHidden: true
123+
retainContextWhenHidden: true,
125124
},
126125
);
127126
const filewatcher = vscode.workspace.createFileSystemWatcher(filePath, true, false, true);

0 commit comments

Comments
 (0)