Use `on_close` timing instead of `on_pre_close`
@@ -187,22 +187,20 @@ class BackendController(sublime_plugin.EventListener):
hit(view, 'on_save')
- def on_pre_close(self, view):
+ def on_close(self, view):
# type: (sublime.View) -> None
bid = view.buffer_id()
filename = util.get_filename(view)
- buffers = []
open_filenames = set()
for w in sublime.windows():
for v in w.views():
- buffers.append(v.buffer_id())
- open_filenames.add(util.get_filename(v))
+ if v.buffer_id() == bid:
+ # abort since another view into the same buffer is open
+ return
- open_filenames -= {filename} # since we're running *pre* close
+ open_filenames.add(util.get_filename(v))
- # Cleanup the stores if this is the last view on the buffer
- if buffers.count(bid) <= 1:
# We want to discard this file and its dependencies but never a
# file that is currently open or still referenced by another
dependencies_per_file = {
@@ -218,7 +216,6 @@ class BackendController(sublime_plugin.EventListener):
persist.affected_filenames_per_filename.pop(fn, None)
persist.assigned_linters.pop(bid, None)
-
guard_check_linters_for_view.pop(bid, None)
buffer_filenames.pop(bid, None)
buffer_syntaxes.pop(bid, None)
