-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-IDEFeature RequestIDE-CodeStyleBuilt-in analyzers, fixes, and refactoringsBuilt-in analyzers, fixes, and refactoringshelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
Milestone
Description
Currently, there is a code refactoring to convert to verbatim string.
Another possible code refactoring (should only be offered when the string contains { and } is to convert to interpolated string.
Example
I wanted something like this while working with unit tests in roslyn and roslyn-analyzer codebases. So, here is an example. Suppose there is an existing unit test like the following
[Fact]
public void TestSomething()
{
var code = @"
namespace Mynamespace
{
public class Program
{
public static void Main() {Console.WriteLine();}
}
}";
}For some reason, I want to update the unit test to:
[Theory]
[InlineData("")]
[InlineData("string[] args")]
public void TestSomething(string mainArgs)
{
var code = $@"
namespace Mynamespace
{{
public class Program
{{
public static void Main({mainArgs}) {{Console.WriteLine();}}
}}
}}";
}It would be much easier to make this update if the IDE can offer a refactoring that converts the original code to the following:
var code = $@"
namespace Mynamespace
{{
public class Program
{{
public static void Main() {{}}
}}
}}";Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-IDEFeature RequestIDE-CodeStyleBuilt-in analyzers, fixes, and refactoringsBuilt-in analyzers, fixes, and refactoringshelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on itThe issue is "up for grabs" - add a comment if you are interested in working on it
