简体   繁体   English

使用“自定义 CSS 和 JS 加载程序”扩展隐藏 vscode 菜单项

[英]Hide vscode menu items using 'Custom CSS and JS Loader' extension

I want to disable the "Commit All", and "Commit All (amend)" and "Commit All (signed off)" menu options in vscode's source control tab.我想在 vscode 的源代码控制选项卡中禁用“全部提交”、“全部提交(修改)”和“全部提交(签名)”菜单选项。 The vscode team is not receptive to that: (1) , (2) . vscode 团队不接受: (1) , (2) My reasoning is the same as in those issues.我的推理与那些问题相同。

在此处输入图像描述

I installed the "Custom CSS and JS Loader" vscode extension.我安装了“自定义 CSS 和 JS 加载器” vscode 扩展。 I'm using it for various tweaks, it works.我正在使用它进行各种调整,它有效。

Those menu items are within the three dot menu in the anchor: #workbench\.view\.scm > div > div > div.monaco-scrollable-element > div.split-view-container > div:nth-child(1) > div > div.pane-header.expanded > div.actions > div > div > ul > li:nth-child(6) > div > div > a .这些菜单项位于锚点的三个点菜单中: #workbench\.view\.scm > div > div > div.monaco-scrollable-element > div.split-view-container > div:nth-child(1) > div > div.pane-header.expanded > div.actions > div > div > ul > li:nth-child(6) > div > div > a

But I don't know how to get at the menu that seems to be dynamically created when clicking that button.但我不知道如何获得单击该按钮时似乎是动态创建的菜单。

Can that be done?可以这样做吗?

I'll give you a direct solution for your problem, which isn't based on "Custom CSS and JS Loader" vscode extension.我将为您的问题提供直接解决方案,它不是基于“自定义 CSS 和 JS 加载器” vscode扩展。

The part of code for building the menu is:构建菜单的代码部分是:

git.commit": [
        {
          "command": "git.commit",
          "group": "1_commit@1"
        },
        {
          "command": "git.commitStaged",
          "group": "1_commit@2"
        },
        {
          "command": "git.commitAll",
          "group": "1_commit@3"
        },
        {
          "command": "git.undoCommit",
          "group": "1_commit@4"
        },
        {
          "command": "git.rebaseAbort",
          "group": "1_commit@5"
        },
        {
          "command": "git.commitNoVerify",
          "group": "1_commit@6",
          "when": "config.git.allowNoVerifyCommit"
        },
        {
          "command": "git.commitStagedNoVerify",
          "group": "1_commit@7",
          "when": "config.git.allowNoVerifyCommit"
        },
        {
          "command": "git.commitAllNoVerify",
          "group": "1_commit@8",
          "when": "config.git.allowNoVerifyCommit"
        },
        {
          "command": "git.commitStagedAmend",
          "group": "2_amend@1"
        },
        {
          "command": "git.commitAllAmend",
          "group": "2_amend@2"
        },
        {
          "command": "git.commitStagedAmendNoVerify",
          "group": "2_amend@3",
          "when": "config.git.allowNoVerifyCommit"
        },
        {
          "command": "git.commitAllAmendNoVerify",
          "group": "2_amend@4",
          "when": "config.git.allowNoVerifyCommit"
        },
        {
          "command": "git.commitStagedSigned",
          "group": "3_signoff@1"
        },
        {
          "command": "git.commitAllSigned",
          "group": "3_signoff@2"
        },
        {
          "command": "git.commitStagedSignedNoVerify",
          "group": "3_signoff@3",
          "when": "config.git.allowNoVerifyCommit"
        },
        {
          "command": "git.commitAllSignedNoVerify",
          "group": "3_signoff@4",
          "when": "config.git.allowNoVerifyCommit"
        }
      ],

It's inside vscode/extensions/git/package.json file in sources.它位于源代码中的vscode/extensions/git/package.json文件中。

  1. You can modify it either by removing the options you want to remove, or by adding a "when" condition (or extending the existing) with a new settings, say "config.git.allowCommitAll".您可以通过删除要删除的选项或通过使用新设置添加“何时”条件(或扩展现有条件)来修改它,例如“config.git.allowCommitAll”。
  2. You can also directly modify the built file, it's under <Microsoft VS Code>\resources\app\extensions\git\dist\main.js .您也可以直接修改构建的文件,它位于<Microsoft VS Code>\resources\app\extensions\git\dist\main.js
  3. In some cases you'd also have to modify the cache, it's under <user>\AppData\Roaming\Code\CachedExtensions\builtin in Windows (root cache for Mac is $HOME/Library/Application Support/Code/ and for Linux $HOME/.config/Code/ )在某些情况下,您还必须修改缓存,它位于 Windows 的<user>\AppData\Roaming\Code\CachedExtensions\builtin下(Mac 的根缓存是$HOME/Library/Application Support/Code/和 Linux $HOME/.config/Code/ )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM