예제 #1
0
	def on_post_save(self, view):
		# this will reload submodules if they are saved with sublime text
		for name, module in self.modules.modules.items():
			if os.name == 'posix' and (
				os.stat(module.__file__).st_ino == os.stat(view.file_name()).st_ino
			) or module.__file__ == view.file_name():
				self.modules.reload(module)
				Linter.reload(name)
				break
예제 #2
0
 def on_post_save(self, view):
     # this will reload submodules if they are saved with sublime text
     for name, module in self.modules.modules.items():
         if os.name == 'posix' and (os.stat(
                 module.__file__).st_ino == os.stat(view.file_name(
                 )).st_ino) or module.__file__ == view.file_name():
             self.modules.reload(module)
             Linter.reload(name)
             break
예제 #3
0
    def on_new(self, view):
        # handle new user preferences file
        if view.file_name() and os.path.split(view.file_name())[1] == "SublimeLint.sublime-settings":
            if view.size() == 0:
                edit = view.begin_edit()
                view.insert(edit, 0, default_user_settings)
                view.end_edit(edit)

        vid = view.id()
        self.loaded.add(vid)
        self.last_syntax[vid] = view.settings().get("syntax")
        Linter.assign(view)
	def on_new(self, view):
		# handle new user preferences file
		if view.file_name() and os.path.split(view.file_name())[1] == 'SublimeLint.sublime-settings':
			if view.size() == 0:
				edit = view.begin_edit()
				view.insert(edit, 0, default_user_settings)
				view.end_edit(edit)

		vid = view.id()
		self.loaded.add(vid)
		self.last_syntax[vid] = view.settings().get('syntax')
		Linter.assign(view)
예제 #5
0
    def lint(self, view_id):
        view = Linter.get_view(view_id)

        sections = {}
        for sel, _ in Linter.get_selectors(view_id):
            sections[sel] = []
            for result in view.find_by_selector(sel):
                sections[sel].append((view.rowcol(result.a)[0], result.a, result.b))

        if view is not None:
            filename = view.file_name()
            persist.debug("SublimeLint: running on `%s`" % os.path.split(filename or "untitled")[1])
            code = Linter.text(view)
            thread.start_new_thread(Linter.lint_view, (view_id, filename, code, sections, self.finish))
예제 #6
0
	def lint(self, view_id):
		view = Linter.get_view(view_id)

		sections = {}
		for sel, _ in Linter.get_selectors(view_id):
			sections[sel] = []
			for result in view.find_by_selector(sel):
				sections[sel].append(
					(view.rowcol(result.a)[0], result.a, result.b)
				)

		if view is not None:
			filename = view.file_name()
			code = Linter.text(view)
			thread.start_new_thread(Linter.lint_view, (view_id, filename, code, sections, self.finish))
예제 #7
0
    def lint(self, view_id):
        view = Linter.get_view(view_id)

        sections = {}
        for sel, _ in Linter.get_selectors(view_id):
            sections[sel] = []
            for result in view.find_by_selector(sel):
                sections[sel].append(
                    (view.rowcol(result.a)[0], result.a, result.b))

        if view is not None:
            filename = view.file_name()
            code = Linter.text(view)
            thread.start_new_thread(
                Linter.lint_view,
                (view_id, filename, code, sections, self.finish))
	def lint(self, view_id):
		view = Linter.get_view(view_id)

		sections = {}
		for sel, _ in Linter.get_selectors(view_id):
			sections[sel] = []
			for result in view.find_by_selector(sel):
				sections[sel].append(
					(view.rowcol(result.a)[0], result.a, result.b)
				)

		if view is not None:
			filename = view.file_name()
			persist.debug('SublimeLint: running on `%s`' % os.path.split(filename or 'untitled')[1])
			code = Linter.text(view)
			thread.start_new_thread(Linter.lint_view, (view_id, filename, code, sections, self.finish))
예제 #9
0
    def hit(self, view):
        self.linted.add(view.id())
        if view.size() == 0:
            for l in Linter.get_linters(view.id()):
                l.clear()

            return

        persist.queue.hit(view)
예제 #10
0
    def hit(self, view):
        self.linted.add(view.id())
        if view.size() == 0:
            for l in Linter.get_linters(view.id()):
                l.clear()

            return

        persist.queue.hit(view)
예제 #11
0
    def check_syntax(self, view, lint=False):
        vid = view.id()
        syntax = view.settings().get('syntax')

        # syntax either has never been set or just changed
        if not vid in self.last_syntax or self.last_syntax[vid] != syntax:
            self.last_syntax[vid] = syntax

            # assign a linter, then maybe trigger a lint if we get one
            if Linter.assign(view) and lint:
                self.hit(view)
예제 #12
0
    def check_syntax(self, view, lint=False):
        vid = view.id()
        syntax = view.settings().get("syntax")

        # syntax either has never been set or just changed
        if not vid in self.last_syntax or self.last_syntax[vid] != syntax:
            self.last_syntax[vid] = syntax

            # assign a linter, then maybe trigger a lint if we get one
            if Linter.assign(view) and lint:
                self.hit(view)
예제 #13
0
 def on_new(self, view):
     self.on_open_settings(view)
     vid = view.id()
     self.loaded.add(vid)
     self.last_syntax[vid] = view.settings().get('syntax')
     Linter.assign(view)
예제 #14
0
	def on_new(self, view):
		self.on_open_settings(view)
		vid = view.id()
		self.loaded.add(vid)
		self.last_syntax[vid] = view.settings().get('syntax')
		Linter.assign(view)