Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code doesn't gray out unused variables

As far as I know it seems this is the setting you enter in your settings.json to enable unused variables & imports that aren't used to appear grayed out.

"editor.showUnused": true,

I do get an underline and if you hover I get an underline and message on hover.

What am I missing?

enter image description here

like image 701
Antonio Pavicevac-Ortiz Avatar asked Apr 02 '19 14:04

Antonio Pavicevac-Ortiz


3 Answers

In my settings.json apparently I commented that the following did the trick.

 "javascript.validate.enable": true,

/* this controls having your unused imports or variables to appear grey */
like image 150
Antonio Pavicevac-Ortiz Avatar answered Oct 08 '22 20:10

Antonio Pavicevac-Ortiz


* builtin language features extension solution:

I am adding this just in case someone gets stuck like me. I had the same issue and the following was the problem.

vscode has @builtin extensions. One of them is typescript and javascript language features. If it is disabled the features will not work. So just go to extension and search @builtin typescript and javacsrtipt language feature`, click the cog icon and enable the extension.

like image 45
aviya.developer Avatar answered Oct 08 '22 22:10

aviya.developer


September 2020

For me, adding "editor.showUnused": true, in settings.json in the .vscode directory worked.

like image 2
Davis Jones Avatar answered Oct 08 '22 21:10

Davis Jones