Skip to content

Commit

Permalink
highlight.ERROR -> const.ERROR in SL4
Browse files Browse the repository at this point in the history
  • Loading branch information
braver committed Feb 1, 2018
1 parent b25fced commit b286284
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@
"""This module exports the Annotations plugin class."""

import re
from SublimeLinter.lint import highlight, Linter
import SublimeLinter

if getattr(SublimeLinter, 'VERSION', 3) > 3:
from SublimeLinter.lint import const, Linter
ERROR = const.ERROR
WARNING = const.WARNING
else:
from SublimeLinter.lint import highlight, Linter
ERROR = highlight.ERROR
WARNING = highlight.WARNING


class Annotations(Linter):
Expand Down Expand Up @@ -77,10 +86,10 @@ def run(self, cmd, code):
message = match.group('message')

if word:
error_type = highlight.ERROR
error_type = ERROR
else:
word = match.group('warning')
error_type = highlight.WARNING
error_type = WARNING

output.append('{}:{}: {} {}'.format(i + 1, col + 1, error_type, message))

Expand Down

0 comments on commit b286284

Please sign in to comment.