.png)
願わくば、これがこの質問に対する適切なフォーラムであることを願っています...
ウェブで検索してみましたが、どれもオートコンプリートを永久にオフにする方法が書かれていました。オートコンプリートのオンとオフを簡単に切り替えられる方法はありますか?すべて非常に迷惑ですが、時々助けになるのは構いません。この時点で、エスケープ キーが最初に摩耗するキーになります。
システム情報: Linux Mint Uma - XFCE - compiz および emerald 搭載
Visual Studio Code 1.63.2 (deb から) [arch=amd64,arm64,armhf]出典: microsoft.com安定したメイン
助言がありますか?
答え1
私自身の質問に答えます...
私は「常に電源を切る」ウェブサイトをいくつか見て、これに決めましたOur Code World - 自動補完を無効にする元の質問で述べたように、常にオフにしたいわけではなく、オンとオフを切り替える方法が必要です。しかし、リンクには GUI ツールの使用方法が記載されているのではなく、必要な JSON コンテンツが示されているという事実に基づいて、私は希望を持っていました。結局のところ、設定を変更する必要があったことがいくつかありました (コードが書かれてから 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 シェル スクリプト) の内容
#!/bin/bash
SOURCE=~/.config/Code/User/settings.ac_on.json
TARGET=~/.config/Code/User/settings.json
cat $SOURCE > $TARGET
~/bin/ac_off の内容 (別の bash シェル スクリプト)
#!/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」と入力するだけで簡単に行えます。