Skip to content

Conversation

@jwortmann
Copy link
Member

This PR adds a function to notifiy plugins when the selection in a relevant view has changed, using the same debouncing that is used for textDocument/documentHighlight and textDocument/codeAction requests.

Closes #2655

if not self._is_in_higlighted_region(first_region.b):
self._clear_highlight_regions()
self._clear_code_actions_annotation()
if userprefs().document_highlight_style or userprefs().show_code_actions:
Copy link
Member Author

@jwortmann jwortmann Oct 7, 2025

Choose a reason for hiding this comment

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

Note that I removed this if-condition here for simplicity (otherwise we would need to check beforehand whether there is at least one session with a plugin). Iirc I added this condition a while ago to reduce unnecessary debouncing calls if neither highlights nor code actions are enabled in the user settings. But I assume that typically at least one of those features is enabled, so probably this condition was relatively useless in almost all cases anyway.

Co-authored-by: Rafał Chłodnicki <rchl2k@gmail.com>
@jwortmann jwortmann merged commit 97ae309 into sublimelsp:main Oct 8, 2025
11 of 12 checks passed
@jwortmann jwortmann deleted the api-on-selection-modified-async branch October 8, 2025 16:15
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.

Expose debounced on_selection_modified_async to plugins

2 participants