-
Notifications
You must be signed in to change notification settings - Fork 2
/
bump.py
48 lines (38 loc) · 1.25 KB
/
bump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import json
import os
from string import Template
import sublime
import sublime_plugin
from . import parser
from . import log
from . import request
from . import cache
from . import transfrom
from . import commands
from . import settings as conf
from . import persist
def plugin_loaded():
"""Entry point for SL plugins."""
conf.plugin_is_loaded = True
conf.settings.load()
log.printf('debug mode:', 'on' if conf.debug_mode() else 'off')
plugin = Bump.shared_plugin()
conf.settings.on_update_call(Bump.on_settings_updated)
class Bump(sublime_plugin.EventListener):
def __init__(self, *args, **kwargs):
"""Initialize a new instance."""
super().__init__(*args, **kwargs)
self.__class__.shared_instance = self
@classmethod
def shared_plugin(cls):
"""Return the plugin instance."""
return cls.shared_instance
@classmethod
def on_settings_updated(cls, setting):
persist.worker.log_version_for_active_view()
def on_selection_modified_async(self, view):
self.display_version_for_line(view, tooltip=True)
def display_version_for_line(self, view, tooltip=False):
if persist.worker.is_scratch(view):
return
persist.worker.log_version_for_view(view)