Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fadeout unused variable names #3733

Merged
merged 2 commits into from
Apr 21, 2020

Conversation

JoeRobich
Copy link
Member

Currently unused variables are only faded out when omnisharp.enableRoslynAnalyzers is enabled. This change adds it to the list of compiler diagnostics we fadeout even when analyzers are disabled.

fixes #1324

@codecov
Copy link

codecov bot commented Apr 20, 2020

Codecov Report

Merging #3733 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3733   +/-   ##
=======================================
  Coverage   87.00%   87.00%           
=======================================
  Files          59       59           
  Lines        1777     1777           
  Branches      209      209           
=======================================
  Hits         1546     1546           
  Misses        176      176           
  Partials       55       55           
Flag Coverage Δ
#integration 100.00% <ø> (ø)
#unit 87.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9776856...59dd38a. Read the comment docs.

@JoeRobich
Copy link
Member Author

@brettfo PTAL

@filipw
Copy link
Contributor

filipw commented Apr 21, 2020

nice

@JoeRobich JoeRobich merged commit fe918bb into dotnet:master Apr 21, 2020
@marcospgp
Copy link

I still don't see this functionality in VSCode as of today, is there a planned release date?

@JoeRobich
Copy link
Member Author

@marcospgp If you are not seeing these in your vscode, it is most likely that the WarningLevel configured in your csproj is lower than 4. The compiler only reports these diagnostics when warning level is set to 4.

@marcospgp
Copy link

marcospgp commented Sep 23, 2020

@JoeRobich Ok I think I found a bug with this functionality then, take a look at this:

image

When you create a variable that references a field of the class, it no longer is identified as never used, even if you do never use it in the function.

@JoeRobich
Copy link
Member Author

@marcospgp This seems to be a case covered by dotnet/roslyn#15695

@marcospgp
Copy link

Revisiting this today, I double checked that:

  • My .csproj has a warning level of 4 (this is controlled by Unity automatically)
  • I have enabled omnisharp.enableRoslynAnalyzers

But unused fields still are not faded out:

image

@JoeRobich @filipw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Highlight unused variables in the editor
4 participants