之前用过,我忘记插件名字了……Orz
vscode插件。
感谢!
比如在vscode下,
ctrl B 可以切换左侧导航
ctrl J 可以切换底部控制台
ctrl M 可以最大化组
这几个命令结合起来就可以把当前正在编辑的拆分窗口最大化,方便码字
但操作太费心了,我之前找到一个插件可以实现同样地功能,重做系统后忘了叫啥
还是自己写个吧……
package.json
{
"name": "toggle-panel",
"displayName": "toggle Panel",
"description": "Ctrl Space",
"version": "1.0.0",
"publisher": "zeronofreya",
"engines": {
"vscode": "^1.75.0"
},
"main": "./extension.js",
"activationEvents": [
"*"
],
"contributes": {
"commands": [{
"command": "togglePanel",
"title": "Toggle Panel"
}],
"keybindings": [{
"command": "togglePanel",
"key": "ctrl+space",
"mac": "cmd+space",
"when": "editorTextFocus"
}]
}
}
extension.js
const vscode = require("vscode");
function activate(context) {
let status = true;
vscode.commands.executeCommand("workbench.action.focusPanel");
let disposable = vscode.commands.registerCommand("togglePanel", async () => {
if (status) {
await vscode.commands.executeCommand("workbench.action.closePanel");
await vscode.commands.executeCommand("workbench.action.maximizeEditorHideSidebar");
status = false;
} else {
await vscode.commands.executeCommand("workbench.action.focusPanel");
await vscode.commands.executeCommand("workbench.action.evenEditorWidths");
await vscode.commands.executeCommand("workbench.view.explorer");
status = true;
}
await vscode.commands.executeCommand(
"workbench.action.focusActiveEditorGroup"
);
});
context.subscriptions.push(disposable);
}
module.exports = {
activate,
deactivate: function () {},
};
问题是我没找到判断面板是否显示的方法,暂时先这样