def on_pre_save(self, view): global scheduled, lastRun; print('OnPreSave', view.file_name()); if not view.is_dirty(): # No changes, not important. print('not dirty'); return; if not isJavascriptFile(view): # only js files. print('not js'); return; if not Settings.get('autoUpdate.enabled', False): print('not enabled'); return; filePath = view.file_name(); func = ClassFunctions(sublime, filePath); if not func.isValid(): # not valid. print('not valid') return; print('Just before save'); if scheduled: return; elif JsDuck.isActive(): scheduled = True; lastRun = time.time(); sublime.set_timeout(lambda: self.__doUpdate(filePath), self.__timeTillNext() * 1000); print('scheduled'); else: print('Running now'); self.__doUpdate(filePath);
def run(self, edit): if not isJavascriptFile(self.view): sublime.status_message('Active file is not a javascript file.') return active_file_path = self.active_file_path() self._funcs = ClassFunctions(sublime, active_file_path) if not self._funcs.isValid(): sublime.status_message( 'Active file path does not contain project.') return JsDuck.checkJsDuck(sublime, self._funcs.appRoot()) if JsDuck.isActive(): sublime.status_message('JsDuck is active...') return if active_file_path: self.load() self.window().show_quick_panel(self._funcs.descriptions(), self.open_file) else: sublime.status_message("No open file")
def on_pre_save(self, view): global scheduled, lastRun print('OnPreSave', view.file_name()) if not view.is_dirty(): # No changes, not important. print('not dirty') return if not isJavascriptFile(view): # only js files. print('not js') return if not Settings.get('autoUpdate.enabled', False): print('not enabled') return filePath = view.file_name() func = ClassFunctions(sublime, filePath) if not func.isValid(): # not valid. print('not valid') return print('Just before save') if scheduled: return elif JsDuck.isActive(): scheduled = True lastRun = time.time() sublime.set_timeout(lambda: self.__doUpdate(filePath), self.__timeTillNext() * 1000) print('scheduled') else: print('Running now') self.__doUpdate(filePath)
def run(self, edit): active_file_path = self.active_file_path(); root = JsDuck.detectRoot(sublime, active_file_path); if not root: sublime.status_message('Active file path does not contain project.'); return; if JsDuck.isActive(): sublime.status_message('JsDuck is already active...'); return; JsDuck.buildJsDuck(sublime, root);
def run(self, edit): active_file_path = self.active_file_path() root = JsDuck.detectRoot(sublime, active_file_path) if not root: sublime.status_message( 'Active file path does not contain project.') return if JsDuck.isActive(): sublime.status_message('JsDuck is already active...') return JsDuck.buildJsDuck(sublime, root)
def run(self, edit): if not isJavascriptFile(self.view): sublime.status_message('Active file is not a javascript file.'); return; active_file_path = self.active_file_path() self._funcs = ClassFunctions(sublime, active_file_path) if not self._funcs.isValid(): sublime.status_message('Active file path does not contain project.'); return; JsDuck.checkJsDuck(sublime, self._funcs.appRoot()); if JsDuck.isActive(): sublime.status_message('JsDuck is active...'); return; if active_file_path: self.load(); self.window().show_quick_panel(self._funcs.descriptions(), self.open_file) else: sublime.status_message("No open file")