Skip to content

StringSyntax support for VB and VB-test in C# strings #82352

@Rekkonnect

Description

@Rekkonnect

Summary

Support semantic classification for strings annotated with the StringSyntax attribute with VB and VB-test

Background and Motivation

When working with Roslyn, string literals are often used to denote source files. C#-test is already present which also handles Roslyn-specific markup, and C# is something that is also being supported although not yet present in VS.

Proposed Feature

The proposal allows the user to use VB or VB-test as valid identifiers in StringSyntax attributes, and Roslyn to offer semantic classification for strings annotated with these language identifiers. This feature will be valid at least for C#, where the semantic classifier will respect and properly classify string literals that are annotated with any of the above VB identifiers.

For example consider this C# source,

// lang=vb-test
const string source = """
    Imports System

    Public Sub Method()
        Const greetings As String = "Hello World!"
        Console.WriteLine(greetings)
    End Sub
    """;

In the string literal itself, since it's annotated with lang=vb-test, Roslyn will offer semantic classification for the source as a VB source, thus enabling IDEs to highlight parts of the string literal accordingly.

Alternative Designs

None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions