/ST-API-stubs

Sublime Text APIs stubs for developing plugins.

Primary LanguagePythonMIT LicenseMIT

Sublime Text API Stubs

With LSP proper configured, you can have something like the following screenshot.

LSP and pyright

You can also use these stub files to make mypy work better with your plugins.

How to Use

I personally use this with LSP + LSP-pyright setup.

  1. Install the LSP package via Package Control.

  2. You have to copy those .pyi stub files from this repository to YOUR_PROJECT_ROOT/typings/ directory.

  3. Make your preferred LSP server able to "see" them.

    • If you use LSP-pyright, configure the python.analysis.extraPaths:

      {
          "settings": {
              "python.analysis.extraPaths": [
                  // project's stubs
                  "$folder/typings",
                  // my custom stubs
                  "$packages/../typings",
              ],
              // a special predefined setup for developing ST plugins
              "pyright.dev_environment": "sublime_text",
          },
      }
    • If you use LSP-pylsp, configure the pylsp.plugins.jedi.extra_paths:

      {
          "settings": {
              "pylsp.plugins.jedi.extra_paths": [
                  // project's stubs
                  "$folder/typings",
                  // my custom stubs
                  "$packages/../typings",
              ],
          },
      }
  4. Restart your ST and happy coding ♥

Acknowledgment and Related Resources

This repository is initially mostly based on AmjadHD/sublime_dev's work.

Apart from @AmjadHD's work, there are also some other similar works: