def lint_view(cls, view_id, filename, code, sections, callback): if view_id in cls.linters: selectors = Linter.get_selectors(view_id) linters = tuple(cls.linters[view_id]) for linter in linters: if not linter.selector: linter.filename = filename linter.pre_lint(code) for sel, linter in selectors: if sel in sections: highlight = Highlight(code, scope=linter.scope, outline=linter.outline) errors = {} for line_offset, left, right in sections[sel]: highlight.shift(line_offset, left) linter.pre_lint(code[left:right], highlight=highlight) for line, error in linter.errors.items(): errors[line+line_offset] = error linter.errors = errors # merge our result back to the main thread sublime.set_timeout(lambda: callback(linters[0].view, linters), 0)
def lint_view(cls, view_id, filename, code, sections, callback): if view_id in cls.linters: selectors = Linter.get_selectors(view_id) linters = tuple(cls.linters[view_id]) linter_text = ", ".join(l.name for l in linters) persist.debug("SublimeLint: `%s` as %s" % (filename or "untitled", linter_text)) for linter in linters: if linter.settings.get("disable"): continue if not linter.selector: linter.filename = filename linter.pre_lint(code) for sel, linter in selectors: if sel in sections: highlight = Highlight(code, scope=linter.scope, outline=linter.outline) errors = {} for line_offset, left, right in sections[sel]: highlight.shift(line_offset, left) linter.pre_lint(code[left:right], highlight=highlight) for line, error in linter.errors.items(): errors[line + line_offset] = error linter.errors = errors # merge our result back to the main thread sublime.set_timeout(lambda: callback(linters[0].view, linters), 0)
def lint_view(cls, view_id, filename, code, sections, callback): if view_id in cls.linters: selectors = Linter.get_selectors(view_id) linters = tuple(cls.linters[view_id]) for linter in linters: if not linter.selector: linter.filename = filename linter.pre_lint(code) for sel, linter in selectors: if sel in sections: highlight = Highlight(code, scope=linter.scope, outline=linter.outline) errors = {} for line_offset, left, right in sections[sel]: highlight.shift(line_offset, left) linter.pre_lint(code[left:right], highlight=highlight) for line, error in linter.errors.items(): errors[line + line_offset] = error linter.errors = errors # merge our result back to the main thread sublime.set_timeout(lambda: callback(linters[0].view, linters), 0)
def lint_view(cls, view_id, filename, code, sections, callback): if view_id in cls.linters: selectors = Linter.get_selectors(view_id) linters = tuple(cls.linters[view_id]) linter_text = (', '.join(l.name for l in linters)) persist.debug('SublimeLint: `%s` as %s' % (filename or 'untitled', linter_text)) for linter in linters: if linter.settings.get('disable'): continue if not linter.selector: linter.filename = filename linter.pre_lint(code) for sel, linter in selectors: if sel in sections: highlight = Highlight(code, scope=linter.scope, outline=linter.outline) errors = {} for line_offset, left, right in sections[sel]: highlight.shift(line_offset, left) linter.pre_lint(code[left:right], highlight=highlight) for line, error in linter.errors.items(): errors[line + line_offset] = error linter.errors = errors # merge our result back to the main thread sublime.set_timeout(lambda: callback(linters[0].view, linters), 0)