Comments (4)
I am having the same issue. With some packages where there are name conflicts its too easy to get the wrong using added silently and only noticing when the options of the method are not as expected.
from vscode-csharp.
I think this would help the problem you described dotnet/roslyn#66898
@dibarbet do we have the infrastructure to implement the proposal above in vscode?
from vscode-csharp.
Hmm, in a round-about way that could work, but is it guaranteed to return the file to the state it was in before the directive was added?
For instance, I like to space out my using
s into groups:
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DeltaQ.RTB.ActivityMonitor;
using DeltaQ.RTB.Diagnostics;
using DeltaQ.RTB.FileSystem;
using DeltaQ.RTB.Interop;
using DeltaQ.RTB.StateCache;
using DeltaQ.RTB.Storage;
using DeltaQ.RTB.SurfaceArea;
using DeltaQ.RTB.Utility;
If, in mistyping something, I accidentally refer to, say, ProvidedInstanceActivator
from Autofac.Core.Activators.ProvidedInstance
, then this will add a new using
directive in the gap between the two:
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Autofac.Core.Activators.ProvidedInstance;
using DeltaQ.RTB.ActivityMonitor;
using DeltaQ.RTB.Diagnostics;
using DeltaQ.RTB.FileSystem;
using DeltaQ.RTB.Interop;
using DeltaQ.RTB.StateCache;
using DeltaQ.RTB.Storage;
using DeltaQ.RTB.SurfaceArea;
using DeltaQ.RTB.Utility;
I correct my error and go on my merry way, and then when I save the document, the unused using
directive gets removed -- it's going to leave the code like this, right?
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DeltaQ.RTB.ActivityMonitor;
using DeltaQ.RTB.Diagnostics;
using DeltaQ.RTB.FileSystem;
using DeltaQ.RTB.Interop;
using DeltaQ.RTB.StateCache;
using DeltaQ.RTB.Storage;
using DeltaQ.RTB.SurfaceArea;
using DeltaQ.RTB.Utility;
This is not the same as if it hadn't touched it at all. So, I still have to be on the look-out for it and be careful not to commit changes with random noise as a result of this function.
from vscode-csharp.
If we're talking about ideals, it would actually be pretty cool if unimported types were listed in IntelliSense, and selecting one and pressing Tab inserted the text of the type name but not the using
directive, but popped open/switched to a submenu which can then either be ignored, or Tab can select an "automatically add the corresponding using
directive" menu item. That way, if you're doing it on purpose, you can still get the using
directive, but if it's because you mistyped something, it doesn't happen by default.
from vscode-csharp.
Related Issues (20)
- LSP server fails to initialize with: "Failed to find all versions of .NET Core MSBuild. Call to hostfxr_resolve_sdk2." HOT 9
- [MacOS] Unable to display source file when debugging .net dll compiled on Windows with portable pdb format and published as nuget HOT 4
- Debugger UX should show stack for current thread instead of a treeview with all threads HOT 1
- XML documentation (doc comment) creation is no longer working HOT 1
- vscode-maui.android.autosdk.configure HOT 1
- vscode-maui.android.autosdk.configure HOT 1
- Issue loading csproj projects if it includes linked files HOT 1
- Some code fixers failing on v2.33.17 HOT 1
- IntelliSense and code analysis broken with 2.33.17 HOT 13
- MSB4057 error HOT 2
- Microsoft.CodeAnalysis.LanguageServer Client: Couldn't create connection with server
- Many "Illegal Argument" errors in console HOT 3
- Provisional Completion in Razor should show full tooltip info
- [macOS 11 x64] Cannot compile or debug with VSCode for C# Program HOT 5
- getting error running/debugging dotnet application HOT 1
- False positive syntax errors for WPF HOT 5
- Blazor broken in newer versions (above v2.30.28) HOT 1
- Couldn't find .NET SDK HOT 4
- Cannot format .cshtml files (Razor logs an error) HOT 1
- Not all refactoring options available until C# Dev Kit disabled HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-csharp.