When installing the .NET Compiler Platform SDK you get Visual Studio templates for creating an "Analyzer with Code Fix (NuGet + VSIX)" and a "Code Refactoring (VSIX)".
Why isn't there a template for shipping a code refactoring with NuGet (like "Code Refactoring (NuGet + VSIX)")?
Is it even possible to add a code refactoring provider from a NuGet package (by creating the NuGet package manually)?
Doesn't it make sense to install a code refactoring provider on a project per project basis?
EDIT: My use case is a code refactoring that generates a C# type out of untyped data (like JSON). This is basically what F# type providers are (although they are much more powerful of course). This means that the user creates a class like the following
[JsonProvider("http://example.com/data.json")]
public class ExampleData
{
}
and the refactoring fills it with properties from the sample data it fetched from the url in the attribute:
[JsonProvider("http://example.com/data.json")]
public class ExampleData
{
public string Property1 { get; private set; }
public int Property2 { get; private set; }
public void Load(Uri uri) { ... }
public void FromData(string data) { ... }
...
}
The reason I don't want to create an analyzer is because the user should be able to decide when to update the C# type. Because I don't really know when the data the URL points to is changing. And I don't want to annoy the user with a squiggly line that she can't get rid of.
Distributing refactorings via NuGet is not currently supported, but is something we would like to add in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With