Skip to content

Include diagnostic code when copying diagnostic text - #2875

Merged
rchl merged 8 commits into
mainfrom
fix/copy-text
Apr 19, 2026
Merged

rchl merged 8 commits into
mainfrom
fix/copy-text

Conversation

@rchl

@rchl rchl commented Apr 18, 2026 •

Copy link
Copy Markdown
Member

We have not been copying diagnostic code when copying diagnostic text to clipboard which was inconsistent with text in hover popup and also annoying if one wants to lookup the code.

Before:

Could not assign item in TypedDict
  "Literal['jsonc']" is not assignable to "LanguageKind" (basedpyright)

After:

Could not assign item in TypedDict
  "Literal['jsonc']" is not assignable to "LanguageKind" (basedpyright[reportGeneralTypeIssues])

The formatting doesn't exactly match style in the hover popup but it's because we don't have colors in plain text so we can't just include source without parenthesis.

@rchl

rchl commented Apr 18, 2026

Copy link
Copy Markdown
Member Author

Feel free to suggest improvements to the formatting.

Comment thread plugin/core/views.py Resolved
@rchl

rchl commented Apr 18, 2026

Copy link
Copy Markdown
Member Author

I think a better formatting would be:

Could not assign item in TypedDict
  "Literal['jsonc']" is not assignable to "LanguageKind" basedpyright(reportGeneralTypeIssues - https://docs.basedpyright.com/v1.39.2/configuration/config-files/#reportGeneralTypeIssues)

when there is code and when there isn't then:

Could not assign item in TypedDict
  "Literal['jsonc']" is not assignable to "LanguageKind" (basedpyright)

@jwortmann

Copy link
Copy Markdown
Member

I would probably exclude the URL (codeDescription). You can click it in the popup to open the website, so I wouldn't find it useful to copy that too.

Maybe could use formatting like

(basedpyright[reportGeneralTypeIssues])

if there is code, and otherwise

(basedpyright)

@rchl
rchl merged commit d983eea into main Apr 19, 2026
8 checks passed
@rchl
rchl deleted the fix/copy-text branch April 19, 2026 09:39
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