Make `reason` available via `context`
@@ -280,7 +280,7 @@ def lint(view, view_has_changed, lock, reason):
This function MUST run on a thread because it blocks!
"""
- linters = get_linters_for_view(view)
+ linters = get_linters_for_view(view, reason)
with lock:
_assign_linters_to_view(view, {linter['klass'] for linter in linters})
@@ -424,8 +424,8 @@ def group_by_linter(errors):
return by_linter
-def get_linters_for_view(view):
- # type: (sublime.View) -> List[LinterInfo]
+def get_linters_for_view(view, reason):
+ # type: (sublime.View, str) -> List[LinterInfo]
"""Check and eventually instantiate linters for a view."""
bid = view.buffer_id()
@@ -440,6 +440,7 @@ def get_linters_for_view(view):
return []
ctx = linter_module.get_view_context(view)
+ ctx['reason'] = reason
wanted_linters = [] # type: List[LinterInfo]
for name, klass in persist.linter_classes.items():
settings = linter_module.get_linter_settings(klass, view, ctx)
