Alternar autocompletar en Visual Studio Code (no desactivarlo permanentemente)

Alternar autocompletar en Visual Studio Code (no desactivarlo permanentemente)

Ojalá este sea el foro adecuado para esta pregunta...

He buscado en la web sin éxito: cada enlace que encuentro detalla desactiva automáticamente la función de autocompletar. ¿Hay alguna forma de activar y desactivar el autocompletado fácilmente? Encuentro las sugerencias constantes paratodoextremadamente molesto, pero no me importaría recibir ayuda ocasional. En este punto, mi llave de escape será la primera en desgastarse.

Información del sistema: Linux Mint Uma - XFCE - con compiz y esmeralda

Visual Studio Code 1.63.2 de deb [arch=amd64,arm64,armhf]http://packages.microsoft.com/repos/codeprincipal estable

¿Alguna sugerencia?

Respuesta1

Respondiendo a mi propia pregunta...

Revisé algunos de los sitios web "Apágalo siempre" y me decidí por este.Our Code World: deshabilitar la finalización automática. Como dije en mi pregunta original, no quiero que esté desactivado todo el tiempo, quiero una forma de activarlo y desactivarlo. Pero tenía esperanzas basadas en el hecho de que el enlace muestra el contenido JSON necesario en lugar de describir cómo usar las herramientas GUI. Resultó que hubo algunas cosas que tuve que cambiar en su configuración (sin duda, VSC ha evolucionado desde que se escribió su código), pero pude resolver lo que necesitaba desde un comienzo tan excelente.

De todos modos, estoy usando GNU/Linux, así que mi primer paso fue encontrar el archivo "settings.json". Ejecuté el siguiente comando y sorprendentemente obtuve pocos resultados:

$ locate settings.json

Era bastante obvio que quería ~/.config/Code/User/settings.json . Primero hice una copia de seguridad del archivo original. Luego lo edité según las instrucciones proporcionadas en el enlace. Fue entonces cuando noté que VSC monitorea activamente el archivo de configuración. A partir de ahí, fue fácil crear un par de scripts que cambian el archivo de autocompletar a autocompletar desactivado.

Esto parece evolucionar, por lo que lo que presento puede no ser válido indefinidamente. Sin embargo, el contenido a continuación debería ayudar a cualquiera a comenzar:

El contenido de ~/.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
}

El contenido de ~/.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"

}

El contenido de ~/bin/ac_on (un script de shell bash)

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

El contenido de ~/bin/ac_off (otro script de shell bash)

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

VSC tiene un indicador de bash integrado y ~/bin está en mi ruta personal. La consecuencia es que alternar Autocompletar es tan simple como escribir "ac_on" o "ac_off".

información relacionada