Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

The typevar attribute target specifier (C# 13) was not recognized, causing it to be incorrectly tokenized as separate type and var tokens.

Changes

  • Grammar: Added typevar to the attribute-section pattern in src/csharp.tmLanguage.yml
    • Positioned before type in the regex alternation to prevent premature matching
  • Tests: Added coverage for typevar attribute specifier

Example

class Foo<[typevar: MyAttribute] T, [typevar: MyAttribute] U>
{
    public static void F<[typevar: MyAttribute] X>() { }
}

Before: typevar highlighted as two separate tokens (type + var)
After: typevar highlighted as a single keyword attribute specifier

Original prompt

This section details on the original issue you should resolve

<issue_title>typevar keyword</issue_title>
<issue_description>## Details

What editor are you seeing the problem in? (e.g. Atom, Visual Studio Code, etc.)
vscode
What version of the editor are you using?
1.88.1
What color theme are you using?
dark-plus

Repro

[AttributeUsage(AttributeTargets.All)]
class MyAttributeAttribute : Attribute { }

class Foo<[typevar: MyAttribute] T, [typevar: MyAttribute] U>
{
    public static void F<[typevar: MyAttribute] X, [typevar: MyAttribute] Y>() { }
}

code

Please provide a code example and (optionally) a screenshot demonstrating the problem.</issue_description>

<agent_instructions>From the example, it appears the typevar attribute target is not being classified.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

- Added typevar to attribute-section pattern (placed before type to ensure proper matching)
- Added test cases for typevar attribute specifier
- All tests passing (895 tests)

Co-authored-by: JoeRobich <[email protected]>
Copilot AI changed the title [WIP] Fix classification issue for typevar keyword Add support for typevar attribute target specifier Dec 20, 2025
Copilot AI requested a review from JoeRobich December 20, 2025 00:14
@JoeRobich JoeRobich marked this pull request as ready for review December 20, 2025 01:39
@JoeRobich JoeRobich requested a review from dibarbet December 20, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

typevar keyword

2 participants