dotnet / dotnet/roslyn

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

Open
#82,352 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-IDE Feature Request
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing StringSyntax support for the C#-test identifier and the semantic classifier that handles annotated C# string literals. Trace how language identifiers are validated and how embedded source is classified. Done means VB and VB-test are accepted in StringSyntax annotations and the example VB source receives semantic classification.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, visualbasic
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.