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

Add option to make 'unnecessary using directive' diagnostics to appear #1429

Closed
bakakaba opened this issue Apr 26, 2017 · 8 comments
Closed

Comments

@bakakaba
Copy link
Contributor

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.1)

Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1

Runtime Environment:
OS Name: fedora
OS Version: 25
OS Platform: Linux
RID: fedora.24-x64
Base Path: /opt/dotnet/sdk/1.0.1

VS Code version: 1.11.2
C# Extension version: 1.9.0

Steps to reproduce

Add an unnecessary using statement.

Expected behavior

A diagnostic info message about the unnecessary using statement.
using

Actual behavior

No diagnostic info message is shown and the using statement is not highlighted.

@Leopotam
Copy link
Contributor

vscode 1.12.0, c# extension 7439ef4 commit (after 1.9.0 release) - same behaviour.

@DustinCampbell
Copy link
Member

This is by design. We suppressed this message in the PR to #1231. Eventually, we hope to have faded code support in VS Code so we can provide this information a bit more unobtrusively (microsoft/vscode#20219 tracks this).

Note that the light bulb still appears and works if you move it to an unnecessary using, but we will no longer spam unnecessary using diagnostics.

@cateyes99
Copy link

cateyes99 commented Apr 26, 2017

At least don't agree with removing the wavy underline in the editor for those unnecessary using directives! without those signs in the editor so we cannot spot them anymore, would u expect us to move the cursor each line by line in each .cs file to find out unnecessary using directives?! this change makes the Remove Unnecessary Usings totally useless.

@DustinCampbell
Copy link
Member

I appreciate your passion @cateyes99! Unfortunately, VS Code doesn't make it possible to remove the item from the Problems list (which many complained about) while keeping the squiggle in the editor.

If you like, you can file an issue (or submit a PR) to make this behavior optional. And, eventually, I hope we'll have the ability to fade code as I mentioned before to make this behave more like it does in Visual Studio (in VS, we fade unnecessary using directives but don't just the message in the Error List).

@bakakaba
Copy link
Contributor Author

@DustinCampbell pull request to make this configurable.

@DustinCampbell
Copy link
Member

Nice! I've re-opened, assigned to you, and put in our 1.10 milestone. Thanks very much for the contribution!

@DustinCampbell DustinCampbell changed the title Missing Unnecessary using statement message. Add option to make 'unnecessary using directive' diagnostics to appear Apr 27, 2017
@DustinCampbell
Copy link
Member

Adding the same comment I put in the PR here:

I'm planning to release a new C# for VS Code beta later today or early tomorrow. That will have this setting in it.

@eamodio
Copy link
Contributor

eamodio commented May 24, 2017

@DustinCampbell Probably don't want to go down this route, but this extension could provide unused usings via decorations rather than diagnostics. The TypeLens extension currently does this: https://github.com/kisstkondoros/typelens/blob/master/src/extension.ts#L96

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

No branches or pull requests

5 participants