Skip to content

Refactor code action annotations#2835

Merged
jwortmann merged 9 commits intosublimelsp:mainfrom
jwortmann:code-action-annotations
Mar 31, 2026
Merged

Refactor code action annotations#2835
jwortmann merged 9 commits intosublimelsp:mainfrom
jwortmann:code-action-annotations

Conversation

@jwortmann
Copy link
Copy Markdown
Member

@jwortmann jwortmann commented Mar 27, 2026

This addresses the first point from #2800:
When new diagnostics from a server arrive, code actions for the selection are only requested again for that particular session, and not for all sessions.

I have also changed that if there are multiple code actions available, all of them are shown directly in the annotation now, instead of a "3 code actions" link that opens the quick panel. ST always displays the annotation as a single line anyway, with a "linebreak" icon if there are multiple lines, revealing the other lines on mouse hover.

Code actions are sorted so that actions with the isPreferred property are on top.

Before:

before

After:

after1

on mouse hover:

after2

We could revert this change if there is any advantage of the "3 code actions" style. But I think the multi-line annotation should be fine?


I have only tested with a single session. I'll maybe check again tomorrow that I haven't broken anything with these refactorings, but I think it should work.

@jwortmann
Copy link
Copy Markdown
Member Author

I added a new change that fixes a bug on main which causes to run the code action twice when you double click on an annotation (because the annotation gets only removed/updated when new diagnostics arrive).

The new code uses the encoded URIs for code action annotations, and I've modified that now to also include the version number of the view. That number can then be compared to the current change count of the view and prevent to run the code action if the version is outdated.

Comment thread plugin/code_actions.py Outdated
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 30, 2026

Deploy Preview for sublime-lsp ready!

Name Link
🔨 Latest commit 4648590
🔍 Latest deploy log https://app.netlify.com/projects/sublime-lsp/deploys/69cafd9d4b1d82000854ac0b
😎 Deploy Preview https://deploy-preview-2835--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.

Comment thread plugin/documents.py Outdated
@jwortmann jwortmann merged commit 40c9fe3 into sublimelsp:main Mar 31, 2026
8 checks passed
@jwortmann jwortmann deleted the code-action-annotations branch March 31, 2026 20:48
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