Skip to content

Classify private identifiers in semantic tokens - #64349

Open
Jake Bailey (jakebailey) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-privateidentifier-semantic-classifications
Open

Jake Bailey (jakebailey) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-privateidentifier-semantic-classifications

Conversation

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

ECMAScript private names are PrivateIdentifier nodes, so the semantic-token collector omitted them while classifying ordinary identifiers. Consequently, private fields and methods fell back to TextMate highlighting.

class Foo {
    #field = 1;
    #method() {}

    test() {
        this.#field;
        this.#method();
    }
}

Changes

  • Include PrivateIdentifier nodes in the existing symbol-classification path.
  • Classify private fields as property and private methods as method.
  • Apply the declaration modifier to private member declarations.
  • Add regression coverage for declarations and references.

Semantic classification for public members

Missing semantic classification for private members

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix omission of PrivateIdentifier nodes in semantic classifications Classify private identifiers in semantic tokens Sep 19, 2026
@jakebailey
Jake Bailey (jakebailey) marked this pull request as ready for review September 19, 2026 15:13
Copilot AI balanced review requested due to automatic review settings September 19, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused implementation matches existing classification behavior and is covered by an appropriate fourslash regression test.

Review effort: Balanced
Findings: None

What changed in this PR

Adds semantic-token classification for ECMAScript private identifiers.

Changes:

  • Routes private identifiers through symbol classification.
  • Adds regression coverage for private fields and methods.
File Description
tsc/​internal/​ls/​semantictokens.go Includes private identifiers in semantic-token collection.
tsc/​internal/​fourslash/​tests/​semanticModernClassificationPrivateIdentifiers_test.go Verifies declaration and reference classifications.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PrivateIdentifier nodes are omitted from 2020 semantic classifications

3 participants