如何从VSCode扩展中获取用户打开的ViewColumns数量?

时间:2019-07-09 23:10:59

标签: visual-studio-code

我正在开发VSCode扩展,并使用以下命令打开Web视图:

const panel = vscode.window.createWebviewPanel(
                'webviewName', // Identifies the type of the webview. Used internally
                'Webview Title', // Title of the panel displayed to the user
                vscode.ViewColumn.Two, // Editor column to show the new webview panel in.
                {} // Webview options.
            );

请注意传递给它的ViewColumn.Two参数。这会影响Web视图成为哪个视图列的一部分。

我想要的行为是因为Web视图总是向侧面打开。这意味着,如果用户打开了一个文件,则可以在ViewColumn 2中打开它。但是,如果他们有两个文件并排打开,则需要在ViewColumn 3中打开它,依此类推。 / p>

如何从VSCode API获取当前窗口中的ViewColumns数量?

还要注意:visual-studio-code-extensions标签不存在。我想创建它,但是我没有足够的代表。

1 个答案:

答案 0 :(得分:1)

也许您正在寻找vscode.ViewColumn.Beside

  

一个符号编辑器列,代表活动列旁边的列。