diff --git a/stubs/sublime_plugin.pyi b/stubs/sublime_plugin.pyi new file mode 100644 index 0000000..6e6cf37 --- /dev/null +++ b/stubs/sublime_plugin.pyi @@ -0,0 +1,114 @@ +import sublime +from typing import Optional, Union, List, Dict, Tuple + + +class CommandInputHandler(): + def name(self) -> str: ... + def next_input(self, args: dict) -> Optional[CommandInputHandler]: ... + def placeholder(self) -> str: ... + def initial_text(self) -> str: ... + def preview(self, arg: dict) -> Union[str, sublime.Html]: ... + def validate(self, arg: dict) -> bool: ... + def cancel(self) -> None: ... + def confirm(self, arg: dict) -> None: ... + + +class BackInputHandler(CommandInputHandler): + pass + + +class TextInputHandler(CommandInputHandler): + def description(self, text: str) -> str: ... + + +class ListInputHandler(CommandInputHandler): + def list_items(self) -> list: ... + def description(self, v: object, text: str) -> str: ... + + +class Command(): + def is_enabled(self) -> bool: ... + def is_visible(self) -> bool: ... + def is_checked(self) -> bool: ... + def description(self) -> str: ... + def input(self, args: dict) -> Optional[CommandInputHandler]: ... + def input_description(self) -> str: ... + + +class ApplicationCommand(Command): + def run(self) -> None: ... + + +class WindowCommand(Command): + window: sublime.Window + + def run(self) -> None: ... + + +class TextCommand(Command): + view: sublime.View + + def run(self, edit: sublime.Edit) -> None: ... + def want_event(self) -> bool: ... + + +class EventListener(): + def on_new(self, view: sublime.View) -> None: ... + def on_new_async(self, view: sublime.View) -> None: ... + def on_clone(self, view: sublime.View) -> None: ... + def on_clone_async(self, view: sublime.View) -> None: ... + def on_load(self, view: sublime.View) -> None: ... + def on_load_async(self, view: sublime.View) -> None: ... + def on_pre_close(self, view: sublime.View) -> None: ... + def on_close(self, view: sublime.View) -> None: ... + def on_pre_save(self, view: sublime.View) -> None: ... + def on_pre_save_async(self, view: sublime.View) -> None: ... + def on_post_save(self, view: sublime.View) -> None: ... + def on_post_save_async(self, view: sublime.View) -> None: ... + def on_modified(self, view: sublime.View) -> None: ... + def on_modified_async(self, view: sublime.View) -> None: ... + def on_selection_modified(self, view: sublime.View) -> None: ... + def on_selection_modified_async(self, view: sublime.View) -> None: ... + def on_activated(self, view: sublime.View) -> None: ... + def on_activated_async(self, view: sublime.View) -> None: ... + def on_deactivated(self, view: sublime.View) -> None: ... + def on_deactivated_async(self, view: sublime.View) -> None: ... + def on_hover(self, view: sublime.View, point: int, hover_zone: int) -> None: ... + def on_query_context(self, view: sublime.View, key: str, operator: int, operand: str, match_all: bool) -> Optional[None]: ... + def on_query_completions(self, view: sublime.View, prefix: str, locations: List[int]) -> Union[None, list, tuple]: ... + def on_text_command(self, view: sublime.View, command_name: str, args: dict) -> Tuple[str, dict]: ... + def on_post_text_command(self, view: sublime.View, command_name: str, args: dict) -> None: ... + def on_window_command(self, view: sublime.Window, command_name: str, args: dict) -> Tuple[str, dict]: ... + def on_post_window_command(self, view: sublime.Window, command_name: str, args: dict) -> None: ... + + +class ViewEventListener(): + view: sublime.View + + @classmethod + def is_applicable(cls, settings: sublime.Settings) -> bool: ... + + @classmethod + def applies_to_primary_view_only(cls) -> bool: ... + + def on_load(self) -> None: ... + def on_load_async(self) -> None: ... + def on_pre_close(self) -> None: ... + def on_close(self) -> None: ... + def on_pre_save(self) -> None: ... + def on_pre_save_async(self) -> None: ... + def on_post_save(self) -> None: ... + def on_post_save_async(self) -> None: ... + def on_modified(self) -> None: ... + def on_modified_async(self) -> None: ... + def on_selection_modified(self) -> None: ... + def on_selection_modified_async(self) -> None: ... + def on_activated_modified(self) -> None: ... + def on_activated_modified_async(self) -> None: ... + def on_deactivated_modified(self) -> None: ... + def on_deactivated_modified_async(self) -> None: ... + def on_hover(self, point: int, hover_zone: int) -> None: ... + def on_query_context(self, key: str, operator: int, operand: str, match_all: bool) -> Optional[None]: ... + def on_query_completions(self, prefix: str, locations: List[int]) -> Union[None, list, tuple]: ... + def on_text_command(self, command_name: str, args: dict) -> Tuple[str, dict]: ... + def on_post_text_command(self, command_name: str, args: dict) -> None: ...