Skip to content

IDE raw string literal feature list #58356

@allisonchou

Description

@allisonchou

Spec: https://github.com/dotnet/csharplang/blob/main/proposals/raw-string-literal.md
Championed issue: dotnet/csharplang#4304

IDE Feature List

  • Balance quotes (both in single-line and multi-line cases)

    Example:

    1. User has the following code:
    var s = """
    hello world
    """;
    
    1. User adds starting ":
    var s = """"
    hello world
    """;
    
    1. Roslyn should auto-add an ending ":
    var s = """"
    hello world
    """";
    
  • Balance curly braces in interpolated strings (both in single-line and multi-line cases)

    Example:

    1. User has the following code:
    var s = $$"""
                 {
                     hello world
                 };
                 """
    
    1. User adds {:
    var s = $$"""
                 {{
                     hello world
                 };
                 """
    
    1. Roslyn should auto-add an ending }:
    var s = $$"""
                 {{
                     hello world
                 }};
                 """
    
  • Indentation indication line

    Example:

    1. User has the following code:
    var xml = """
              <element attr="content">
                <body>
                </body>
              </element>
              """;
    
    1. Roslyn should add an option to show a visual line to show where the indentation of the raw string literal begins:
    var xml = """
              |<element attr="content">
              |  <body>
              |  </body>
              |</element>
              """;
    
  • Automatically add spaces to content if user adds spaces to last line

    Example:

    1. User has the following code:
    var xml = """
              <element attr="content">
                <body>
                </body>
              </element>
              """;
    
    1. User adds spaces to last line:
    var xml = """
              <element attr="content">
                <body>
                </body>
              </element>
                  """;
    
    1. Roslyn should auto-adjust contents to the right so the user avoids ending up in an error state:
    var xml = """
                  <element attr="content">
                    <body>
                    </body>
                  </element>
                  """;
    
  • Refactoring for converting a verbatim string with escapes to a raw string literal:

    Example:

    1. User has the following code:
    var s = @"hello "" world ";
    
    1. Roslyn should offer a refactoring to convert it to the following:
    var s = """hello " world""";
    

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions