Skip to content

Add LSP semantic token support for Power Query#274

Merged
JordanBoltonMN merged 6 commits intomasterfrom
dev/jobolton/semanticTokens
Apr 1, 2026
Merged

Add LSP semantic token support for Power Query#274
JordanBoltonMN merged 6 commits intomasterfrom
dev/jobolton/semanticTokens

Conversation

@JordanBoltonMN
Copy link
Copy Markdown
Contributor

Enables semantic highlighting by implementing the standard LSP textDocument/semanticTokens/full protocol, replacing
the previously scaffolded but disabled custom request approach.

Changes:

  • server/src/semanticTokens.ts (new) — Token legend and delta-encoding logic, extracted into its own module.
    Encodes PartialSemanticToken[] from PQLS into the LSP wire format.
  • server/src/server.ts — Advertises semanticTokensProvider capability and handles textDocument/semanticTokens/full
    via connection.languages.semanticTokens.on(...). Removed commented-out custom powerquery/semanticTokens handler.
  • client/src/extension.ts — Removed commented-out client-side provider registration (vscode-languageclient handles
    this automatically when the server advertises the capability).
  • package.json — Added semanticTokenScopes mapping 14 token types to TextMate scopes for theme coloring.
  • server/src/test/semanticTokens.test.ts (new) — Tests covering legend correctness, real PQLS analysis output for
    all emitted token types (variable, function, parameter, keyword, number, string, type, operator), and encoding
    invariants (monotonic positions, legend bounds, immutability).

Token legend: 13 types (variable, function, parameter, property, keyword, number, string, comment, type, namespace,
operator, typeParameter, modifier) and 5 modifiers (declaration, definition, readonly, defaultLibrary, deprecated).

Jordan Bolton (jobolton) added 4 commits March 30, 2026 11:52
…icTokens

# Conflicts:
#	client/package-lock.json
#	client/package.json
#	package-lock.json
#	package.json
#	scripts/package-lock.json
#	scripts/package.json
#	server/package-lock.json
#	server/package.json
@JordanBoltonMN JordanBoltonMN merged commit 6865f98 into master Apr 1, 2026
5 checks passed
@JordanBoltonMN JordanBoltonMN deleted the dev/jobolton/semanticTokens branch April 1, 2026 14:23
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.

2 participants