Skip to content

Introduce LspPlugin API - #2739

Merged
rchl merged 155 commits into
mainfrom
feat/new-plugin-api
Apr 28, 2026
Merged

rchl merged 155 commits into
mainfrom
feat/new-plugin-api

Conversation

@rchl

@rchl rchl commented Jan 27, 2026 •

Copy link
Copy Markdown
Member

"Introduce new plugin API" is a little over the top. I just wanted to jump-start it with one new method to allow for progressive enhancement and get early feedback.

The new handle_update_or_installation_async method combines needs_update_or_installation and install_or_update. Those were split because the code sets installing... status text if needs_update_or_installation returns true but that meant that various if checks had to be duplicated across those two and generally made the logic harder to read. With this one method, there is now a callable function passed that can be used to start the progress (perhaps unnecessary since user could use configuration.set_view_status but then that would likely lead to inconsistent status messages across packages).

The new method takes a dict with params. This is to allow adding new params without breaking API compatibility.

Most class methods are passed PluginContext now with configuration instance now to allow packages to get resolved configuration. Some packages currently read settings with sublime.load_settings but that has the problem of not considering project overrides.

Resolves #2039
Resolves #2491

@rchl
rchl force-pushed the feat/new-plugin-api branch from c8f89be to f1b0dee Compare January 27, 2026 08:07
@rchl

rchl commented Jan 27, 2026

Copy link
Copy Markdown
Member Author

Actually just dumped some old code that I had in stash.

Comment thread plugin/api.py Resolved
@jwortmann

This comment was marked as resolved.

Comment thread plugin/core/windows.py Resolved
Comment thread plugin/core/windows.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
@rchl
rchl marked this pull request as draft January 30, 2026 08:42
@rchl
rchl force-pushed the main branch 2 times, most recently from f806ca0 to 90081a4 Compare February 4, 2026 22:22
Comment thread plugin/api.py Resolved
@rchl rchl changed the title Introduce new plugin API New Plugin API Feb 12, 2026
Comment thread plugin/core/types.py Resolved
Comment thread docs/src/migrating_to_lsp_plugin.md Resolved
Comment thread plugin/core/sessions.py Resolved
Comment thread plugin/api.py Resolved
Comment thread plugin/api.py Resolved
Comment thread docs/src/migrating_to_lsp_plugin.md Resolved
Comment thread docs/src/migrating_to_lsp_plugin.md Resolved
rchl and others added 2 commits April 26, 2026 15:56
Co-authored-by: ΠŸΡ€Π΅Π΄Ρ€Π°Π³ Николић <idmpepe@gmail.com>
Co-authored-by: ΠŸΡ€Π΅Π΄Ρ€Π°Π³ Николић <idmpepe@gmail.com>
Comment thread docs/src/migrating_to_lsp_plugin.md Resolved
@rchl

rchl commented Apr 28, 2026

Copy link
Copy Markdown
Member Author

@predragnikolic all looks good to you?

@predragnikolic

Copy link
Copy Markdown
Member

Yes.
I will do just a final read tonight just to see if I can spot some minor things. But the PR is mergable

Comment thread docs/src/migrating_to_lsp_plugin.md Resolved
Comment thread plugin/__init__.py Resolved

@predragnikolic predragnikolic 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.

left 2 comments and an approve :)

@rchl
rchl merged commit 7bc9670 into main Apr 28, 2026
8 checks passed
@rchl
rchl deleted the feat/new-plugin-api branch April 28, 2026 20:49
Comment thread plugin/core/sessions.py
# Handle it now and use fake request ID since it shouldn't matter.
self._plugin.on_server_response_async('initialize', Response(-1, result))
if issubclass(self._plugin_class, AbstractPlugin):
self._plugin = self._plugin_class(weakref.ref(self))

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.

Why do we create a plugin instance here once again? Oh. Because it's AbstractPlugin. And the other one is LspPlugin. OK :)

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.

Provide Transport as parameter when invoking plugin.on_post_start Expose ClientConfig in more places in the Plugin API

4 participants