Skip to content

Restore accurate C# semantic token kinds in LSP and excerpt output #4852

Description

@Widthdom

Summary

C# semantic classification is wrong again across surfaces: private is emitted as a variable, a method name as a type, and CLI excerpt labels using as a variable.

Audit ID: G-27. Reproduced on v1.40.3.

Existing issue relationship

Direct regression of closed #4444, which covered C# keyword/declaration semantic-token kinds.

Expected behavior

C# keywords/modifiers, namespaces/types, methods, properties, parameters, and variables must map consistently in both decoded LSP tokens and excerpt metadata.

PR scope

Keep this to the shared C# semantic token classifier/mappers.

Implementation guide for Codex 5.6 sol xhigh

  • Build focused source fixtures and decode LSP delta tokens back to absolute spans/types in tests.
  • Share one classification source between excerpt and LSP writers; coordinate encoding must not choose semantic kind.
  • Cover using directives, access modifiers, method declarations/calls, generics, records, and contextual keywords.
  • Preserve token ordering/non-overlap and supported legend compatibility.
  • Add regression tests, run full suites, and add a bilingual changelog fragment referencing Emit accurate C# semantic token types for keywords and declarations #4444.

Acceptance criteria

  • The reproduced modifiers/methods/using tokens have correct kinds.
  • Excerpt and decoded LSP classifications agree.
  • No token range or legend-index regression occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codebugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions