2

Hopefully this is the proper forum for this question...

I've searched the web to no avail - every link I find details turning autocomplete permanently off. Is there some way to toggle autocomplete on and off easily? I find the constant suggestions for everything extremely annoying, but I wouldn't mind the occasional assist. At this point my escape key is going to be the first key to wear out.

System Info: Linux Mint Uma - XFCE - with compiz and emerald

Visual Studio Code 1.63.2 from deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main

Any suggestions?

1 Answer 1

1

Answering my own question...

I looked over a few of the "Turn it off always" websites and settled on this one Our Code World - disable auto completion. As I said in my original question, I don't want it off all the time, I want a way to toggle it on and off. But I had hope based on the fact that the link shows the JSON content necessary rather than describing how to use GUI tools. As it turned out there were a few things I had to change from their settings (no doubt VSC has evolved since their code was written), but I was able to work out what I needed from such an excellent start.

Anyway, I'm using GNU/Linux, so my first step was to find the file "settings.json". I ran the following command and got surprisingly few results:

$ locate settings.json

It was fairly obvious that I wanted ~/.config/Code/User/settings.json . So first I made a safety copy of the original file. Then I edited it based on instructions provided in the link. That's when I noticed that VSC actively monitors the settings file. From there it was easy to whip up a couple of scripts that change the file from auto-complete on to auto-complete off.

This stuff appears to evolve, so what I present may not be valid indefinitely. However, the content below should help anyone get started:

The content of ~/.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
}

The content of ~/.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"

}

The content of ~/bin/ac_on (a bash shell script)

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

The content of ~/bin/ac_off (another bash shell script)

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

VSC has a bash prompt built in and ~/bin is in my personal path. The consequence is toggling Auto-Complete is as simple as typing "ac_on" or "ac_off".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .