Visual studio code 正在监视vscode扩展中的文件夹创建
有没有办法监听VSCode扩展中的文件夹创建 例如,我想触发newFolder命令,如下所示:Visual studio code 正在监视vscode扩展中的文件夹创建,visual-studio-code,vscode-extensions,Visual Studio Code,Vscode Extensions,有没有办法监听VSCode扩展中的文件夹创建 例如,我想触发newFolder命令,如下所示: vscode.commands.executeCommand('explorer.newFolder'); 并读取创建的文件夹以在该文件夹内执行其他操作 我试过什么 executeCommand返回一个Thenable,我向then方法传递了一个回调: vscode.commands.executeCommand('explorer.newFolder') .then(f=> {
vscode.commands.executeCommand('explorer.newFolder');
并读取创建的文件夹以在该文件夹内执行其他操作
我试过什么
executeCommand返回一个Thenable,我向then方法传递了一个回调:
vscode.commands.executeCommand('explorer.newFolder')
.then(f=> {
console.log('folder:', f);
});
但是IDE会等待文件夹的名称,然后在创建文件夹之前以及未定义日志记录文件夹时引发方法执行
我尝试的另一个选项是注册到工作区更改文件夹事件:
vscode.workspace.onDidChangeWorkspaceFolders(e => {
for(const f of e.added) {
console.log('added folder: ', f);
}
});
但这一事件从未发生
有人有线索吗?你得到答案了吗,我也很感兴趣:)没有,我还没有答案,项目暂停了。。。