Home > Mobile >  How to turn off vscode adding autocompletion "={}" after selecting a suggestion
How to turn off vscode adding autocompletion "={}" after selecting a suggestion

Time:01-16

working on a react native project here using VSCode. It appears than when a suggestion is selected: Selection It adds this ={} after: After selecting.

This gets annoying, as you would expect it to only populate key={innerIdx} instead of key={innerIdx={}}. I tried to turn off and on a bunch of stuff in the settings, but no luck.

Anyone knows how to solve this, without turning off the suggestion, just to kill the behaviour that adds that extra ={}?

CodePudding user response:

To turn off specific suggestions follow the instruction below:

  1. find your defaultSettings.json via Preferences: Open Default Settings (JSON).
  2. with ctrl f search this : "typescript.preferences.jsxAttributeCompletionStyle": "auto"
  3. then change it from auto to none

here is the full reference for all attributes in vs code. https://code.visualstudio.com/docs/getstarted/settings

// Preferred style for JSX attribute completions.

// - auto: Insert ={} or ="" after attribute names based on the prop type.

// - braces: Insert ={} after attribute names.

// - none: Only insert attribute names.

"typescript.preferences.jsxAttributeCompletionStyle": "auto",

you must change it to none.

  • Related