sublime_text icon indicating copy to clipboard operation
sublime_text copied to clipboard

Consider providing method stubs for all classes in `sublime_plugin`

Open intelfx opened this issue 1 year ago • 3 comments

Problem description

In sublime_plugin.py shipped with Sublime Text (at least the python3.8 version), some plugin classes (like sublime_plugin.CommandInputHandler) declare placeholders for all overridable methods, whereas other plugin classes (like sublime_plugin.EventListener) do not declare anything and only contain one giant docstring.

Preferred solution

All plugin base classes in sublime_plugin module should contain stubs for overridable methods.

Alternatives

N/A

Additional Information

Left: sublime_plugin.CommandInputHandler with method stubs Right: sublime_plugin.EventListener without stubs

Снимок экрана от 2024-02-24 05-58-03

intelfx avatar Feb 24 '24 05:02 intelfx

LSP package for Sublime Text provides stubs.

see https://github.com/sublimelsp/LSP/blob/main/stubs/sublime_plugin.pyi

deathaxe avatar Feb 24 '24 08:02 deathaxe

@deathaxe I was just told on the Sublime HQ discord that those are incomplete and for LSP's own use only, and 2) they target py33.

intelfx avatar Feb 24 '24 09:02 intelfx

@deathaxe I was just told on the Sublime HQ discord that those are incomplete and for LSP's own use only, and 2) they target py33.

It looks like it has been pretty different since I had check stubs from LSP. It does solve your issue.

jfcherng avatar Feb 24 '24 09:02 jfcherng