Navigation Menu

Skip to content

Commit

Permalink
Added option to refresh folders / sidebar when creating file.
Browse files Browse the repository at this point in the history
For some users, the sidebar does not update as files and folders change. New option allows refreshing of sidebar.
  • Loading branch information
Rory Green committed Mar 28, 2013
1 parent a09ea16 commit e8d8d4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
*.pyc
.DS_Store
13 changes: 12 additions & 1 deletion AdvancedNewFile.py
Expand Up @@ -18,7 +18,8 @@
"alias_root",
"alias_path",
"alias_folder_index",
"debug"
"debug",
"auto_refresh_sidebar"
]
VIEW_NAME = "AdvancedNewFileCreation"
WIN_ROOT_REGEX = r"[a-zA-Z]:(/|\\)"
Expand All @@ -43,6 +44,7 @@ def run(self, is_python=False):
settings = get_settings(self.view)
self.aliases = self.get_aliases(settings)
self.show_path = settings.get("show_path")
self.auto_refresh_sidebar = settings.get("auto_refresh_sidebar")
self.default_folder_index = settings.get("default_folder_index")
self.alias_folder_index = settings.get("alias_folder_index")
default_root = self.get_default_root(settings.get("default_root"))
Expand Down Expand Up @@ -265,6 +267,15 @@ def entered_filename(self, filename):
else:
self.window.open_file(file_path)
self.clear()
self.refresh_sidebar()

def refresh_sidebar(self):
if self.auto_refresh_sidebar:
try:
self.window.run_command("refresh_folder_list")
except:
pass


def clear(self):
if self.view != None:
Expand Down
8 changes: 7 additions & 1 deletion AdvancedNewFile.sublime-settings
Expand Up @@ -70,5 +70,11 @@

// A boolean specifying if case should be ignored when building
// auto complete list.
"ignore_case": false
"ignore_case": false,

// A boolean specifying if folders should automatically refresh and update the sidebar.
// In some builds, the sidebar does not refresh when contents of project folder are updated.
// This setting is required to refresh the sidebar in these circumstances.
// false by default
"auto_refresh_sidebar": false
}

0 comments on commit e8d8d4f

Please sign in to comment.