Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 20, 2025

The fixed keyword in fixed-size buffer field declarations was not being highlighted, appearing in default text color instead of as a storage modifier like public and unsafe.

Changes

  • Grammar: Added fixed-size-buffer-declaration pattern to handle the distinct syntax of fixed-size buffers (fixed <type> <name>[<size>])

    • Captures fixed as storage.modifier.fixed.cs
    • Parses buffer type, name, and size expression in brackets
    • Positioned before field-declaration to match correctly
  • Tests: Added test token and three test cases covering:

    • Basic fixed-size buffer: public fixed byte Buffer[30]
    • With unsafe modifier: public unsafe fixed byte Buffer[30]
    • With const size reference: public unsafe fixed byte Buffer[length]

Example

unsafe struct B
{
    public fixed byte Buffer[30];  // 'fixed' now highlighted as storage modifier
}

struct C
{
    public const int length = 30;
    public unsafe fixed byte Buffer[length];  // works with const references
}
Original prompt

This section details on the original issue you should resolve

<issue_title>fixed-size buffer syntax</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.0
What color theme are you using?
dark plus

Repro

unsafe struct B
{
    public fixed byte Buffer[30];
}
struct C
{
    public const int length = 30;
    public unsafe fixed byte Buffer[length];
}

code
image

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

<agent_instructions>From the example, it appears the fixed keyword 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.

Copilot AI changed the title [WIP] Fix fixed-size buffer syntax highlighting in VSCode Add syntax highlighting for fixed-size buffer declarations Dec 20, 2025
Copilot AI requested a review from JoeRobich December 20, 2025 02:39
@JoeRobich JoeRobich marked this pull request as ready for review December 20, 2025 03:16
@JoeRobich JoeRobich requested a review from dibarbet December 20, 2025 03:16
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.

fixed-size buffer syntax

2 participants