Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (51 sloc) 1.55 KB
import sublime
import sublime_plugin
from lint import persist
def error_command(f):
def run(self, edit, **kwargs):
vid =
if vid in persist.errors and persist.errors[vid]:
f(self, self.view, persist.errors[vid], **kwargs)
return run
def select_line(view, line):
sel = view.sel()
point = view.text_point(line, 0)
class sublimelint_next_error(sublime_plugin.TextCommand):
def run(self, view, errors, direction=1):
sel = view.sel()
if len(sel) == 0:
sel.add((0, 0))
line = view.rowcol(sel[0].a)[0]
errors = list(errors)
if line in errors: errors.remove(line)
errors = sorted(errors + [line])
i = errors.index(line) + direction
if i >= len(errors):
i -= len(errors)
select_line(view, errors[i])
class sublimelint_all_errors(sublime_plugin.TextCommand):
def run(self, view, errors):
options = []
option_to_line = []
for lineno, messages in sorted(errors.items()):
line = view.substr(
view.full_line(view.text_point(lineno, 0))
while messages:
[("%i| %s" % (lineno + 1, line.strip())).encode('ascii', 'replace')] +
[m.encode('ascii', 'replace') for m in messages[:2]]
messages = messages[2:]
def center_line(i):
if i != -1:
select_line(view, option_to_line[i])
view.window().show_quick_panel(options, center_line, sublime.MONOSPACE_FONT)
Jump to Line
Something went wrong with that request. Please try again.