簡體   English   中英

VSCode:有沒有辦法隱藏頂部操作菜單欄?

[英]VSCode: Is there a way to hide top action menu bar?

在 VSCode 中,有沒有辦法隱藏出現在選項卡行中的頂部操作菜單欄 我很少使用它,我發現它擠滿了本已有限的可用於瀏覽打開標簽的空間。 此外,它的呈現方式也不一致,尤其是在激活拆分窗格時。

我不確定我是否正確地引用了這個 VSCode 功能,所以這里有一個截圖展示了我在說什么(由於 NDA 原因,文件名必須模糊):

vscode 頂部操作菜單欄

謝謝你。

語境

它被稱為編輯器操作,在標准/本機 VSCode 設置中,您無法隱藏它。

自 2018 年 3 月以來,隱藏此煩人欄的設置是 VScode 的 GitHub 的一個未解決問題

修復

刪除整個欄

我感覺到你的痛苦。 這對我有用:

  1. 安裝自定義 UI 擴展
  2. 打開你的用戶設置 JSON: cmd + shift + P / ctrl + shift + P首選項:打開設置 (JSON)
  3. 添加此設置:
  "customizeUI.stylesheet": {
    ".editor-actions": "display: none !important;",
  },

它不見了!

刪除特定圖標,由 position

最左邊的圖標是數字1

普通 CSS 示例:

.menu-item-action-item-icon-1,
.menu-item-action-item-icon-3 {
  display: none !important;
}

使用自定義 UI 擴展的示例:

  "customizeUI.stylesheet": {
    ".menu-item-action-item-icon-1": "display: none !important;",
    ".menu-item-action-item-icon-3": "display: none !important;",
  },

僅刪除 Gitlens 圖標

Gitlens 圖標可以隱藏在 Gitlens 的設置中:

"gitlens.menus": {
    "editorGroup": {
        "blame": false,
        "compare": false
    },
},

我想出了一個稍微不同的方法:不是隱藏按鈕,而是將它們下移一層到面包屑欄:

面包屑欄中的圖標

這是使用具有以下配置的自定義 UI擴展來完成的:

"customizeUI.stylesheet": {
    ".tabs-and-actions-container": {
        "background-color": "inherit",
    },
    ".tabs-and-actions-container .editor-actions": {
        "position": "absolute",
        "top": "100%",
        "right": "0px",
        "height": "22px !important",
        "z-index": "1",
        "background-color": "inherit",
    },
    ".tabs-and-actions-container .editor-actions .action-item": {
        "margin-right": "3px !important",
    },
    ".tabs-and-actions-container .editor-actions .action-item a": {
        "font-size": "13px",
    },
    ".tabs-and-actions-container .editor-actions .action-item .codicon": {
        "width": "13px",
        "height": "13px",
    },
    ".tabs-and-actions-container .tab:last-child": {
        "margin-right": "0 !important",
    },
    ".title.tabs.show-file-icons": {
        "overflow": "unset !important",
    },
}

此解決方案與主題無關,因此它應該適用於所有顏色組合。 按鈕的背景顏色始終與選項卡欄的背景顏色相同。 如果您只使用一個 static 主題,您可以將.tabs-and-actions-container.editor-actions選擇器的background-color硬編碼為面包屑欄的確切顏色,以獲得更無縫的設計。 但是,這在切換主題時不起作用。

這個解決方案的唯一缺點是按鈕會溢出最右邊的面包屑信息,但我對此很好。 至少標簽欄不再調整大小,而我仍然有這些按鈕。

嗨,我刪除了 GitLens 插件,它消失了

對於使用自定義 UI 並且在定位".editor-actions"后沒有讓圖標消失的任何人,我可以通過選擇".monaco-toolbar"讓操作圖標消失:

"customizeUI.stylesheet": {
   ".monaco-toolbar": "display: none !important"
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM