With LSP properly configured and type annotations provided, you can have something like the following screenshot.
You can also use these stub files in mypy to do static analysis for your plugin.
Setup for LSP-pyright
-
Configure the
pyright.dev_environment
:ST stubs have been bundled in
LSP-pyright
so you just have to activate the setup.{ "settings": { // a special predefined setup for developing ST plugins "pyright.dev_environment": "sublime_text", }, }
-
Restart the language server (by restarting ST).
Setup for LSP-pylsp
-
Copy
typings/
from this repository toYOUR_PROJECT_ROOT/typings/
directory. -
Make the language server able to see them.
Configure the
pylsp.plugins.jedi.extra_paths
:{ "settings": { "pylsp.plugins.jedi.extra_paths": [ // $folder is the first project folder in your ST project folders "$folder/typings", ], }, }
-
Restart the language server (by restarting ST).
Setup for mypy
-
Copy
typings/
from this repository asYOUR_PROJECT_ROOT/typings/
directory. -
In your
mypy.ini
, in the[mypy]
section, set the stub directories.[mypy] mypy_path = typings:stubs
-
mypy
should be able to understandsublime
andsublime_plugin
modules now.
This repository is initially mostly based on AmjadHD/sublime_dev's work.
Apart from @AmjadHD's work, there are also some other similar works: