def on_pre_close(self, view):
if view.file_name() is None:
return
window = view.window()
this_project_path = find_project_dir(view)
def perform():
all_views = [view for win in sublime.windows() for view in win.views()]
all_project_paths = [find_project_dir(v) for v in all_views]
all_project_paths = [p for p in all_project_paths if p is not None]
all_project_paths = list(set(all_project_paths))
if this_project_path not in all_project_paths:
stop_server(this_project_path)
window.status_message('Closed server for path:' + this_project_path)
# delay server closing for 0.5s, because we may be "switching" between files
sublime.set_timeout(perform, 500)
评论列表
文章目录