Skip to content

Commit e4e3e85

Browse files
Reloading project settings on_pre_save if the project file changed
1 parent 4255eb1 commit e4e3e85

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

phpcs.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,3 +679,25 @@ def on_selection_modified(self, view):
679679
cmd = PhpcsCommand.instance(view, False)
680680
if isinstance(cmd, PhpcsCommand):
681681
cmd.set_status_bar()
682+
683+
def on_pre_save(self, view):
684+
current_project_file = sublime.active_window().project_file_name();
685+
686+
if current_project_file == None:
687+
debug_message('Skipping config reload because no project file is loaded')
688+
return
689+
690+
if hasattr(pref, 'last_project_file'):
691+
last_project_file = pref.last_project_file
692+
else:
693+
last_project_file = None
694+
695+
debug_message('Current project file: ' + str(current_project_file));
696+
debug_message('Last project file: ' + str(last_project_file));
697+
698+
if last_project_file == current_project_file:
699+
debug_message('Skipping reload. Project file did not change')
700+
else:
701+
debug_message('Reloading config because the project changed')
702+
pref.load();
703+
setattr(pref, 'last_project_file', current_project_file)

0 commit comments

Comments
 (0)