File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,14 @@ class FmCreateFileFromSelectionCommand(sublime_plugin.TextCommand):
3131 MATCH_JS_REQUIRE = re_comp (r"require\(\s*$" )
3232 MATCH_RUBY_REQUIRE = re_comp (r"require_relative\s*\(?\s*$" )
3333
34+ @property
35+ def settings (cls ):
36+ try :
37+ return cls .settings_
38+ except AttributeError :
39+ cls .settings_ = sublime .load_settings ("FileManager.sublime-settings" )
40+ return cls .settings_
41+
3442 def run (self , edit , event ):
3543 base_path , input_path = self .get_path (event )
3644 abspath = computer_friendly (os .path .join (base_path , input_path ))
@@ -139,7 +147,7 @@ def is_visible(self, event=None):
139147 if event is None :
140148 return False
141149 return (
142- self .settings .get ("show_create_from_selection_command" )
150+ self .settings .get ("show_create_from_selection_command" ) is True
143151 and self .view .file_name () is not None
144152 and self .get_path (event ) is not None
145153 )
Original file line number Diff line number Diff line change 55
66class FmWindowCommand (sublime_plugin .WindowCommand ):
77
8- settings = sublime .load_settings ("FileManager.sublime-settings" )
8+ @property
9+ def settings (cls ):
10+ try :
11+ return cls .settings_
12+ except AttributeError :
13+ cls .settings_ = sublime .load_settings ("FileManager.sublime-settings" )
14+ return cls .settings_
915
1016 def is_visible (self , * args , ** kwargs ):
11- show = self .settings .get (
12- "show_{}_command" .format (self .name ().replace ("fm_" , "" ))
13- )
17+ name = "show_{}_command" .format (self .name ().replace ("fm_" , "" ))
18+ show = self .settings .get (name )
1419 if show is None :
1520 # this should never happen, this is an error
1621 # we could nag the user to get him to report that issue,
You can’t perform that action at this time.
0 commit comments