【发布时间】:2019-09-06 13:19:59
【问题描述】:
试图在 Visual Studio 代码中获取多根工作区条件下的项目文件夹路径,但很难找到路径。 以下脚本仅适用于单根工作区,但如何更改为多根工作区。
var vscode = require("vscode");
var path = require("path");
exports.activate = context => {
const searchoption =
vscode.commands.registerCommand('extension.search', () => {
let folderPath = vscode.workspace.rootPath; // get the open file's project folder path
});
}
【问题讨论】:
-
从所有打开的工作区文件夹中尝试匹配启动当前活动文件的文件夹 (
string.startsWith)。 -
在 1.38 发行说明中找到此链接 github.com/microsoft/vscode/wiki/…
标签: visual-studio-code vscode-extensions