Skip to content

Update style for diagnostic annotations#2839

Merged
jwortmann merged 2 commits intosublimelsp:mainfrom
jwortmann:update-diagnostic-annotation-style
Mar 31, 2026
Merged

Update style for diagnostic annotations#2839
jwortmann merged 2 commits intosublimelsp:mainfrom
jwortmann:update-diagnostic-annotation-style

Conversation

@jwortmann
Copy link
Copy Markdown
Member

@jwortmann jwortmann commented Mar 28, 2026

This is probably a controversal change, because I seem to be the only one who prefers the proportional font for diagnostic messages. But besides aesthetics, I think here this has a real advantage, because these annotation messages are sometimes cut off if they are too long and don't fit into the view.

I also applied the muted color to the [source] and moved that to the end of the message, because it is less important than the message itself.

Before:

before

After:

after

It also looks more consistent if there are code actions shown as annotations too (these screenshots also show how much space is saved):

Before:

before2

After:

after2

message = text2html(diagnostic.get('message') or '')
source = diagnostic.get('source')
line = f"[{text2html(source)}] {message}" if source else message
line = f'{message} <span class="color-muted">[{text2html(source)}]</span>' if source else message
Copy link
Copy Markdown
Member

@rchl rchl Mar 30, 2026

Choose a reason for hiding this comment

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

Lets remove square brackets since the color itself makes it stand out enough and also it will match better the appearance of diagnostics in the popup.

While writing this, I also though to maybe try to match appearance in the popup even more by making background colored. I'll try it out locally.

EDIT: Second suggestion doesn't work because ST adds some margins that can't be removed when there are multiple annotations on the same line. Also it changes text color of non-hovered items that makes text look bad.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I thought about simply using the same style as in the popup. So for example pyright(E001) or pyright(reportSomethingHere). If a link for the linter rule is provided, it should even be possible to make that clickable. Maybe we should try that. It would take a bit more space, but if the message is too long, that information would be cut off first anyway.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've tested that, but I think it looks to busy with the link and it takes a bit too much space. So I'll just remove the brackets instead.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 31, 2026

Deploy Preview for sublime-lsp ready!

Name Link
🔨 Latest commit 3ea3241
🔍 Latest deploy log https://app.netlify.com/projects/sublime-lsp/deploys/69cbc98af972260008b3c314
😎 Deploy Preview https://deploy-preview-2839--sublime-lsp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jwortmann jwortmann merged commit e98bca6 into sublimelsp:main Mar 31, 2026
8 checks passed
@jwortmann jwortmann deleted the update-diagnostic-annotation-style branch March 31, 2026 16:03
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