dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 669 forks source link

Console.WriteLine snippet always prepends System #104

Open billwert opened 8 years ago

billwert commented 8 years ago

When you use the 'cw' snippet to insert Console.WriteLine in VSCode, you always get 'System.Console.WriteLine()', regardless of the presence of 'using System' in the file.

DustinCampbell commented 8 years ago

This'd be nice to do, but I don't think there's a way to do this with VS Code snippets today. AFAIK, there's no way to run code when a snippet expands.

billwert commented 8 years ago

Hmm, that's too bad. It may be worth trying to push a request down into VSCode to enable this. I am going to open another issue pertaining to the exception snippet: it currently includes the serialization ctor, which isn't supported on .NET Core. I'd love to see the snippet support include TFMs somehow so you can get appropriate snippets for the platform you're targeting. Perhaps we just need a meta issue for "have snippets work better in the context of the project they're being used in", which would drive the right platform support?