Skip to content

Commit

Permalink
Using new settings functions to get settings
Browse files Browse the repository at this point in the history
hot fix. Missed 2 setting calls that were still using the old load settings method.
  • Loading branch information
LordBrom authored Oct 20, 2017
1 parent a68649a commit 2ca8052
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions hightlight_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def count_lines(lines, view):
'''
counts = defaultdict(list)
for line in lines:
if bool(settings.get('ignore_white_space', DEFAULT_IS_ENABLED)):
if ignoreWhiteSpace():
string = view.substr(line).strip()
else:
string = view.substr(line)
Expand Down Expand Up @@ -59,8 +59,7 @@ def show_lines(regions, view):
all_regions = []
for r in regions:
all_regions.extend(r)
color_scope_name = settings.get('highlight_duplicates_color',
DEFAULT_COLOR_SCOPE_NAME)
color_scope_name = getHighlightColor()
view.add_regions('DuplicatesHighlightListener',
all_regions, color_scope_name, '',
sublime.DRAW_OUTLINED)
Expand Down Expand Up @@ -100,17 +99,23 @@ def downlight_duplicates(view):
'''Removes any region highlighted by this plugin accross all views.'''
view.erase_regions('DuplicatesHighlightListener')


def update_settings(newSetting):
settings = sublime.load_settings('highlight_duplicates.sublime-settings')
settings.set('highlight_duplicates_enabled', newSetting)
sublime.save_settings('highlight_duplicates.sublime-settings')


def isEnabled():
settings = sublime.load_settings('highlight_duplicates.sublime-settings')
return bool(settings.get('highlight_duplicates_enabled', DEFAULT_IS_ENABLED))

def ignoreWhiteSpace():
settings = sublime.load_settings('highlight_duplicates.sublime-settings')
return bool(settings.get('ignore_white_space', DEFAULT_IS_ENABLED))

def getHighlightColor():
settings = sublime.load_settings('highlight_duplicates.sublime-settings')
return settings.get('highlight_duplicates_color', DEFAULT_COLOR_SCOPE_NAME)


class HighlightDuplicatesCommand(sublime_plugin.WindowCommand):
'''Actual Sublime command. Run it in the console with:
Expand Down

0 comments on commit 2ca8052

Please sign in to comment.