Skip to content

Commit

Permalink
Adding validation for new setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
LordBrom committed Feb 26, 2020
1 parent 5dabb66 commit 3406e8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hightlight_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
DEFAULT_COLOR_SCOPE_NAME = "invalid"
DEFAULT_IS_ENABLED = True
DEFAULT_IS_DISABLED = False
DEFAULT_MIN_LINE_LENGTH = 3
DEFAULT_MIN_LINE_LENGTH = 4

def count_lines(lines, view, minLineLength):
'''Counts line occurrences of a view using a hash.
Expand Down Expand Up @@ -168,7 +168,12 @@ def getHighlightColor():

def getMinLineLength():
settings = sublime.load_settings('highlight_duplicates.sublime-settings')
return settings.get('min_line_length', DEFAULT_MIN_LINE_LENGTH)
minLength = settings.get('min_line_length', DEFAULT_MIN_LINE_LENGTH)
if isinstance(minLength, int):
return minLength
else:
return DEFAULT_MIN_LINE_LENGTH



class HighlightDuplicatesCommand(sublime_plugin.WindowCommand):
Expand Down

0 comments on commit 3406e8c

Please sign in to comment.