Skip to content

Use human-readable names in LSP and playground diagnostics - #26058

Merged
ntBre merged 5 commits into
mainfrom
brent/human-readable-lsp-playground
Jun 17, 2026
Merged

Use human-readable names in LSP and playground diagnostics#26058
ntBre merged 5 commits into
mainfrom
brent/human-readable-lsp-playground

Conversation

@ntBre

@ntBre ntBre commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR follows up on #25937 to display human-readable names in the LSP and playground too, when preview is enabled.

Test Plan

In VS Code with preview = true in my ruff.toml:

Screenshot 2026-06-16 at 16 28 50

with preview = false:

Screenshot 2026-06-16 at 16 29 13

In the playground with preview enabled:

Screenshot 2026-06-16 at 16 58 15

and with preview disabled:

Screenshot 2026-06-16 at 16 51 30

@ntBre ntBre added playground A playground-specific issue preview Related to preview mode features server Related to the LSP server diagnostics Related to reporting of diagnostics. labels Jun 16, 2026
@astral-sh-bot

astral-sh-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

severity: MarkerSeverity.Error,
tags:
diagnostic.code === "F401" || diagnostic.code === "F841"
diagnostic.code === "F401" ||

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Codex said this:

The clean fix is to expose the diagnostic’s existing primary_tags() through ruff_wasm and map Unnecessary/Deprecated to Monaco tags.

which sounds reasonable, especially now that we're setting tags in more rules, but I figured it could also be left for a later PR (and maybe someone who knows more typescript).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree, that makes the most sense. But this can also be done as a separate PR (codex is fairly capable at writing TypeScript)

@ntBre
ntBre marked this pull request as ready for review June 16, 2026 21:12
@ntBre
ntBre requested a review from MichaReiser June 16, 2026 21:13

@MichaReiser MichaReiser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks

It would be good to at at least one server E2E test that verifies this new behavior.

I'm also not sure if this is already on your list, but we also need to change the hover request handler to recognize rule names and the codeAction handler to use human readable names also

severity: MarkerSeverity.Error,
tags:
diagnostic.code === "F401" || diagnostic.code === "F841"
diagnostic.code === "F401" ||

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree, that makes the most sense. But this can also be done as a separate PR (codex is fairly capable at writing TypeScript)

@ntBre

ntBre commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Added a test! Those were not on my list, but I'll follow up on them and on the tags. Thanks!

@ntBre
ntBre merged commit 3aa9c26 into main Jun 17, 2026
45 checks passed
@ntBre
ntBre deleted the brent/human-readable-lsp-playground branch June 17, 2026 15:00
ntBre added a commit that referenced this pull request Jun 17, 2026
## Summary

Follow up to
#26058 (comment) to
use `DiagnosticTag`s directly in the playground instead of hard-coding a
couple of known `Unnecessary` cases.

## Test Plan

A new ruff_wasm test and manual testing in the local playground:


<img width="523" height="343" alt="Screenshot 2026-06-17 at 10 53 30"
src="https://github.com/user-attachments/assets/64cf0fa0-1eb4-4451-baeb-8f3f1e7622d6"
/>

The strikethrough seems a bit aggressive to me for deprecated tags.
Codex said we could either turn off `showDeprecated` in our Monaco
settings or just customize the CSS. Alternatively, I guess we could
filter out deprecated tags and only show the unnecessary ones, if we
were going to disable `showDeprecated`.

But I'm also fine with the default styling if others are.
ntBre added a commit that referenced this pull request Jun 22, 2026
…n code actions (#26114)

## Summary

This PR addresses the hover and code action parts of
#26058 (review),
as well as adding hover support for `ruff:ignore`-style comments in
general, which previously did not support hovering like `noqa` comments.

I went back and forth on whether to split the two commits into two PRs,
but they seemed interrelated enough to leave together.

## Test Plan

New e2e tests and manual testing in VS Code:


https://github.com/user-attachments/assets/d568527f-8e6c-482d-8417-13bd8c0d06b0

You'll probably notice a range issue like I did in this video. I fixed
that in the third commit but just recorded a short follow up video
instead of trying to redo the full video:

<details><summary>Updated range</summary>
<p>



https://github.com/user-attachments/assets/dfe54181-88d8-42a7-842e-855356ceea6b


</p>
</details>

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diagnostics Related to reporting of diagnostics. playground A playground-specific issue preview Related to preview mode features server Related to the LSP server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants