在 Visual Studio Code 中切換自動完成功能(不會永久關閉)

在 Visual Studio Code 中切換自動完成功能(不會永久關閉)

希望這是解決這個問題的正確論壇...

我在網上搜尋無果 - 我找到的每個連結都詳細說明了永久關閉自動完成功能。有什麼方法可以輕鬆開啟和關閉自動完成功能嗎?我發現不斷的建議一切非常煩人,但我不介意偶爾的幫助。此時我的退出鍵將成為第一個磨損的按鍵。

系統資訊:Linux Mint Uma - XFCE - 帶有 compiz 和 emerald

來自 deb 的 Visual Studio Code 1.63.2 [arch=amd64,arm64,armhf]http://packages.microsoft.com/repos/code穩定的主線

有什麼建議麼?

答案1

回答我自己的問題...

我瀏覽了幾個「始終關閉它」的網站,最後選擇了這個我們的程式碼世界 - 停用自動完成。正如我在最初的問題中所說,我不想一直關閉它,我想要一種打開和關閉它的方法。但我抱有希望,因為該連結顯示了必要的 JSON 內容,而不是描述如何使用 GUI 工具。事實證明,我必須從他們的設定中更改一些東西(毫無疑問,自從他們的程式碼編寫以來,VSC 已經不斷發展),但我能夠從如此出色的開始中找出我需要的東西。

不管怎樣,我使用的是 GNU/Linux,所以我的第一步是找到檔案「settings.json」。我運行了以下命令,但得到的結果卻出乎意料地少:

$ locate settings.json

很明顯,我想要 ~/.config/Code/User/settings.json 。所以首先我製作了原始文件的安全副本。然後我根據連結中提供的說明進行編輯。就在那時,我注意到 VSC 主動監控設定檔。從那裡可以輕鬆編寫幾個腳本,將文件從自動完成更改為自動完成關閉。

這些東西似乎不斷發展,所以我提出的內容可能不會無限期地有效。但是,以下內容應該可以幫助任何人入門:

~/.config/Code/User/settings.ac_on.json 的內容

{
"http.proxySupport": "fallback",
"http.proxy": "http://10.0.2.2:3128",
"workbench.startupEditor": "none",
    "[vue]": {
    "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"diffEditor.ignoreTrimWhitespace": false,
"eslint.format.enable": true,
"eslint.codeActionsOnSave.rules": [
    "autoFixOnSave=true"
],
"editor.formatOnSave": true,
"[javascript]": {
    "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"files.autoSave": "onFocusChange",
"vetur.completion.scaffoldSnippetSources": {
    "workspace": "",
    "user": "",
    "vetur": ""
},
"workbench.colorTheme": "Solarized Dark",
"debug.javascript.autoAttachFilter": "onlyWithFlag",
"livePreview.portNumber": 8000,
"livePreview.showServerStatusNotifications": false,
"editor.linkedEditing": true,
"editor.minimap.enabled": false,
"vetur.format.scriptInitialIndent": true,
"vetur.format.styleInitialIndent": true,
"vetur.ignoreProjectWarning": true,
"vetur.useWorkspaceDependencies": true,
"vetur.validation.templateProps": true,
"editor.tabSize": 2,
"editor.wrappingIndent": "indent",
"editor.detectIndentation": false
}

~/.config/Code/User/settings.ac_off.json 的內容

{
"http.proxySupport": "fallback",
"http.proxy": "http://10.0.2.2:3128",
"workbench.startupEditor": "none",
    "[vue]": {
    "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"diffEditor.ignoreTrimWhitespace": false,
"eslint.format.enable": true,
"eslint.codeActionsOnSave.rules": [
    "autoFixOnSave=true"
],
"editor.formatOnSave": true,
"[javascript]": {
    "editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"files.autoSave": "onFocusChange",
"vetur.completion.scaffoldSnippetSources": {
    "workspace": "",
    "user": "",
    "vetur": ""
},
"workbench.colorTheme": "Solarized Dark",
"debug.javascript.autoAttachFilter": "onlyWithFlag",
"livePreview.portNumber": 8000,
"livePreview.showServerStatusNotifications": false,
"editor.linkedEditing": true,
"editor.minimap.enabled": false,
"vetur.format.scriptInitialIndent": true,
"vetur.format.styleInitialIndent": true,
"vetur.ignoreProjectWarning": true,
"vetur.useWorkspaceDependencies": true,
"vetur.validation.templateProps": true,
"editor.tabSize": 2,
"editor.detectIndentation": false,

  // OPTIONAL WORD WRAPPING
  // Controls if lines should wrap. The lines will wrap at min(editor.wrappingColumn, viewportWidthInColumns).
  "editor.wordWrap": "off",
  
  // Controls the indentation of wrapped lines. Can be one of 'none', 'same' or 'indent'.
  "editor.wrappingIndent": "none",

  // TURN OFF AUTOCOMPLETION
  // Controls if quick suggestions should show up or not while typing
  "editor.quickSuggestions": false,

  // Controls the delay in ms after which quick suggestions will show up
  "editor.quickSuggestionsDelay": 90,

  // Enables parameter hints
  "editor.parameterHints": false,

  // Controls if the editor should automatically close brackets after opening them.
  // Can be one of 'always', 'languageDefined', 'beforeWhitespace', 'never'.
  "editor.autoClosingBrackets": "never",

  // Controls if the editor should automatically format the line after typing
  "editor.formatOnType": false,

  // Controls if suggestions should automatically show up when typing trigger characters
  "editor.suggestOnTriggerCharacters": false,

  // Controls if suggestions should be accepted 'Enter' - in addition to 'Tab'. Helps to avoid ambiguity between inserting new lines or accepting suggestions.
  "editor.acceptSuggestionOnEnter": "off"

}

~/bin/ac_on 的內容(bash shell 腳本)

#!/bin/bash
SOURCE=~/.config/Code/User/settings.ac_on.json
TARGET=~/.config/Code/User/settings.json
cat $SOURCE > $TARGET

~/bin/ac_off 的內容(另一個 bash shell 腳本)

#!/bin/bash
SOURCE=~/.config/Code/User/settings.ac_off.json
TARGET=~/.config/Code/User/settings.json
cat $SOURCE > $TARGET

VSC 內建了 bash 提示符,而 ~/bin 位於我的個人路徑中。結果是切換自動完成就像輸入“ac_on”或“ac_off”一樣簡單。

相關內容