如何在Visual Studio Code中以编程方式关闭编辑器?文档说int* integerArray = stackalloc int[n];
已被弃用,我们应该“使用命令TextEditor.hide()
代替”,但我找不到workbench.action.closeActiveEditor
API。
答案 0 :(得分:1)
它不是" API",而是命令面板中命令的标识符(有关列表,请参阅keybindings.json
)。扩展可以通过executeCommand()
调用命令:
vscode.commands.executeCommand("workbench.action.closeActiveEditor");
这相当于手动选择View: Close Editor
命令或按相关的快捷键: