Skip to content

fix: playground not dimming unused using statements#10815

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/investigate-unused-using-dimming
Open

fix: playground not dimming unused using statements#10815
Copilot wants to merge 4 commits into
mainfrom
copilot/investigate-unused-using-dimming

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

The playground wasn't fading out unused using declarations the way the VS Code extension does, even though the language server was already detecting them correctly.

Root cause: The language server running in the playground (for completions, hover, semantic tokens, etc.) was sending LSP diagnostics with DiagnosticTag.Unnecessary for unused using statements, but sendDiagnostics in services.ts was a no-op — those tags were never forwarded to Monaco.

Changes

  • packages/playground/src/services.ts — Implement sendDiagnostics to filter diagnostics that carry visual tags and apply them as Monaco Hint-severity markers under a separate "lsp-tags" owner. Using Hint avoids duplicating the error/warning squiggles already managed by the playground's own compilation pass. DiagnosticTag values from LSP map directly to MarkerTag values in Monaco (Unnecessary = 1, Deprecated = 2).

  • packages/playground/src/react/playground.tsx — Fix a pre-existing bug where CompletionItemTag.Deprecated (value 1, from vscode-languageserver) was used as a Monaco marker tag. This coincidentally equals MarkerTag.Unnecessary (faded text) rather than the intended MarkerTag.Deprecated (strikethrough). Replaced with MarkerTag.Deprecated and removed the vscode-languageserver import.

image

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate missing information mapping for unused using in playground fix: playground not dimming unused using statements May 27, 2026
Copilot AI requested a review from timotheeguerin May 27, 2026 17:10
@timotheeguerin
Copy link
Copy Markdown
Member

/azp run typespec - pr tools

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/playground@10815

commit: 33bf589

@timotheeguerin
Copy link
Copy Markdown
Member

@copilot add changelog

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 27, 2026

@copilot add changelog

Added a changelog entry for @typespec/playground in .chronus/changes/fix-playground-unused-using-dimming-2026-5-27.md.

@timotheeguerin
Copy link
Copy Markdown
Member

/azp run typespec - pr tools

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented May 27, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@timotheeguerin timotheeguerin marked this pull request as ready for review May 27, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playground doesn't seem to dim unused using

2 participants