ST3
A class that provides similar event handling to EventListener, but bound to a specific view. Provides class method-based filtering to control what views objects are created for.
The view is passed as a single parameter to the constructor. The default implementation makes the view available via self.view.
applies_to_primary_view_only()
# =>
bool
A @classmethod that should return a bool indicating if this class applies only to the primary view for a file. A view is considered primary if it is the only, or first, view into a file.
is_applicable(settings)
# =>
bool
A @classmethod that receives a Settings object and should return a bool indicating if this class applies to a view with those settings
on_activated_async()
# =>
None
Called when the view gains input focus. Runs in a separate thread, and does not block the application.
on_deactivated_async()
# =>
None
Called when the view loses input focus. Runs in a separate thread, and does not block the application.
on_hover(point, hover_zone)
# =>
None
Called when the user's mouse hovers over the view for a short period.
point is the closest point in the view to the mouse location. The mouse may not actually be located adjacent based on the value of hover_zone:
on_modified_async()
# =>
None
Called after changes have been made to the view. Runs in a separate thread, and does not block the application.
on_query_completions(prefix, locations)
# =>
list, tuple or None
Called whenever completions are to be presented to the user. The prefix is a unicode string of the text to complete.
locations is a list of points. Since this method is called for all completions no matter the syntax, self.view.match_selector(point, relevant_scope)
should be called to determine if the point is relevant.
The return value must be one of the following formats:
None: no completions are provided
return None
A list of 2-element lists/tuples. The first element is a unicode string of the completion trigger, the second is the unicode replacement text.
return [["me1", "method1()"], ["me2", "method2()"]]
The trigger may contain a tab character (\t) followed by a hint to display in the right-hand side of the completion box.
return [
["me1\tmethod", "method1()"],
["me2\tmethod", "method2()"]
]
The replacement text may contain dollar-numeric fields such as a snippet does, e.g. $0, $1.
return [
["fn", "def ${1:name}($2) { $0 }"],
["for", "for ($1; $2; $3) { $0 }"]
]
A 2-element tuple with the first element being the list format documented above, and the second element being bit flags from the following list:
return (
[
["me1", "method1()"],
["me2", "method2()"]
],
sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
)
on_query_context(key, operator, operand, match_all)
# =>
bool or None
Called when determining to trigger a key binding with the given context key. If the plugin knows how to respond to the context, it should return either True of False. If the context is unknown, it should return None.
operator is one of:
match_all should be used if the context relates to the selections: does every selection have to match (match_all == True), or is at least one matching enough (match_all == False)?
on_selection_modified()
# =>
None
Called after the selection has been modified in the view.
on_selection_modified_async()
# =>
None
Called after the selection has been modified in the view. Runs in a separate thread, and does not block the application.
Generated from the official documentation on Sat Oct 29 20:16:53 EEST 2016 by Leonid Shevtsov.