コード例 #1
0
	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);
コード例 #2
0
    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")
コード例 #3
0
    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)
コード例 #4
0
class ClassFuncBase(ClassBase):
    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")

    # Opens the file in path.
    def open_file(self, index):
        if index >= 0 and len(self._funcs.descriptions()) > index:
            curEntry = self._funcs.descriptions()[index]
            self.open(curEntry)
        # else:
        # 	sublime.status_message("Nothing found")

    def load(self):
        pass

    def open(self, curEntry):
        pass
コード例 #5
0
class ClassFuncBase(ClassBase):
	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")

	# Opens the file in path.
	def open_file(self, index):
		if index >= 0 and len(self._funcs.descriptions()) > index:
			curEntry = self._funcs.descriptions()[index]
			self.open(curEntry);
		# else:
		# 	sublime.status_message("Nothing found")

	def load(self):
		pass

	def open(self, curEntry):
		pass
コード例 #6
0
	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")