Highlight unused variables in the editor
jchannon opened this issue ยท 10 comments
Environment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview2-1-003177)
Product Information:
Version: 1.0.0-preview2-1-003177
Commit SHA-1 hash: a2df9c2576
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64
VS Code version: 1.10.2
C# Extension version:1.8.0
Steps to reproduce
Create a variable and assign it a value. Don't use that variable.
Expected behavior
A highlighted or slightly greyed out variable name
Actual behavior
Nothing
@Pilchie: Is there an equivalent request for roslyn?
No - the compiler already issues a warning, so there should be a squiggle (maybe not if it's initialized to an expression that might have side-effects though).
We did just take a PR to support a code fix to remove unused variables with that warning though.
That's what I was thinking. Also, we don't have the ability to fade things out in VS Code. FWIW, it'd be great if Roslyn marked that particular diagnostic with an Unnecessary tag. Any chance we could get @CyrusNajmabadi to do that? ๐
๐
I have this line in C#:
List<IndicadorConFecha> indicadores = await _tipoCambio.GetIndicadores(desde, hasta);
The variable indicadores
gets assigned by an asynchronous method. But never gets used.
Why I don't get a warning or a squiggle?
This should light up once analyzers are moved over to the .NET SDK
Any ETA on this? Thanks guys!
knock knock
I don't believe there's been any progress on this. I imagine a PR would be accepted to enable that behavior if someone wanted to contribute it.
@CyrusNajmabadi See here :) #3733