如何让 vscode 知道 SCM 何时可见? [英] How can I let vscode know when SCM visible or not?

查看:63
本文介绍了如何让 vscode 知道 SCM 何时可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 VScode 的键绑定制作切换键.使用 alt + 1 到 5 切换资源管理器和搜索、scm、调试扩展

I would like to make toggle key with VScode's keybinding. with alt + 1 to 5 to toggle explorer and search, scm, debug extension

我可以找到explorerViewletVisible"或searchViewletVisible"但是我找不到 scm(源代码管理)和调试、扩展的可见性.我对这些键使用sideBarVisible",但这不是一个完美的解决方案.有谁知道这些情况的正确何时表达"?

I could find "explorerViewletVisible" or "searchViewletVisible" But I couldn't find visibilities of scm (source control) and debug, extensions. I use "sideBarVisible" for these key but it is not a perfect solution. Does Anyone know right 'when expression' of these situations?

  {
    "key": "alt+1",
    "command": "workbench.view.explorer",
  },
  {
    "key": "alt+1",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "explorerViewletVisible"
  },
  {
    "key": "alt+2",
    "command": "workbench.view.search",
  },
  {
    "key": "alt+2",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "searchViewletVisible"
  },
  {
    "key": "alt+3",
    "command": "workbench.view.scm",
  },
  {
    "key": "alt+3",
    "command": "workbench.action.toggleSidebarVisibility",
    "when": "sideBarVisible"
  },

推荐答案

我找到了自己的方式..用"when": "sideBarFocus && activeViewlet == 'workbench.view.explorer'"

I found the way my self.. use "when": "sideBarFocus && activeViewlet == 'workbench.view.explorer'"

这篇关于如何让 vscode 知道 SCM 何时可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆