Skip to content

Commit

Permalink
add old settings detection and messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Sep 15, 2020
1 parent 9101fbb commit 12e81f3
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions hyper_click_annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,46 @@ def on_query_context(self, view, key, operator, operand, match_all):

def on_hover(self, view, point, hover_zone):
self.annotate(point, view)


def plugin_loaded():
window = sublime.active_window()
if not window:
return
view = window.active_view()
if not view:
return

settings = sublime.load_settings('hyper_click.sublime-settings')
project_settings = view.settings().get('hyper_click', {})
old_keys = [
'supported_syntaxes',
'import_line_regex',
'valid_extensions',
'default_filenames',
'vendor_dirs',
'aliases',
'lookup_paths'
]
msg = ''

for key in old_keys:
if settings.has(key):
msg += key + '\n'
if project_settings.get(key, False):
msg += key + ' (in project)\n'

if msg != '':
panel = window.create_output_panel('HyperClickSettings', True)
panel.set_read_only(False)
panel.run_command('append', {
'characters': 'Old HyperClick settings detected:\n'
})
panel.run_command('append', {
'characters': msg
})
panel.run_command('append', {
'characters': '\nPlease refer to the HyperClick README on how to upgrade\nhttps://github.com/aziz/SublimeHyperClick/blob/master/README.md#upgrading-settings-for-20'
})
panel.set_read_only(True)
window.run_command("show_panel", {"panel": 'output.HyperClickSettings'})

0 comments on commit 12e81f3

Please sign in to comment.