Пример #1
0
	def palette_errors(self, view, direct=False):
		indent = '' if direct else '    '
		reps = {}
		fr = gslint.ref(view.file_name())
		if fr:
			reps = fr.reports.copy()
		keys = sorted(reps.keys())
		if keys:
			for k in keys:
				r = reps[k]
				loc = Loc(view.file_name(), r.row, r.col)
				m = []
				m.append("%sline %d:" % (indent, r.row+1))
				lc = 0
				for ln in r.msg.split('\n'):
					if ln:
						lc += 1
						if len(ln) > 50:
							m.append('\t%d: %s -' % (lc, ln[:50]))
							m.append('\t  %s' % ln[50:])
						else:
							m.append('\t%d: %s' % (lc, ln))

				self.add_item(m, self.jump_to, (view, loc))
		else:
			self.add_item(['', 'No errors to report'])

		self.do_show_panel()
Пример #2
0
    def palette_errors(self, view, direct=False):
        indent = '' if direct else '    '
        reps = {}
        fr = gslint.ref(view.file_name())
        if fr:
            reps = fr.reports.copy()
        keys = sorted(reps.keys())
        if keys:
            for k in keys:
                r = reps[k]
                loc = Loc(view.file_name(), r.row, r.col)
                m = []
                m.append("%sline %d:" % (indent, r.row + 1))
                lc = 0
                for ln in r.msg.split('\n'):
                    if ln:
                        lc += 1
                        if len(ln) > 50:
                            m.append('\t%d: %s -' % (lc, ln[:50]))
                            m.append('\t  %s' % ln[50:])
                        else:
                            m.append('\t%d: %s' % (lc, ln))

                self.add_item(m, self.jump_to, (view, loc))
        else:
            self.add_item(['', 'No errors to report'])

        self.do_show_panel()
Пример #3
0
	def palette_errors(self, view, direct=False):
		indent = '' if direct else '    '
		reps = {}
		fr = gslint.ref(view.file_name())
		if fr:
			reps = fr.reports.copy()
		for k in sorted(reps.keys()):
			r = reps[k]
			loc = Loc(view.file_name(), r.row, r.col)
			m = "%sline %d: %s" % (indent, r.row+1, r.msg)
			self.add_item(m, self.jump_to, (view, loc))
Пример #4
0
    def show_palette(self, palette, direct=False):
        view = gs.active_valid_go_view(self.window)
        if not view:
            return

        palette = palette.lower().strip()
        if palette == 'auto':
            palette = self.last_activate_palette
        elif palette == 'main':
            palette = ''

        pcb = None
        if palette:
            pcb = self.palettes.get(palette)
            if pcb:
                self.last_activate_palette = palette
            else:
                gs.notice(DOMAIN, 'Invalid palette `%s`' % palette)
                palette = ''

        if not direct and len(self.bookmarks) > 0:
            loc = self.bookmarks[-1]
            line = 'line %d' % (loc.row + 1)
            if view.file_name() == loc.fn:
                fn = ''
            else:
                fn = relpath(loc.fn, dirname(loc.fn))
                if fn.startswith('..'):
                    fn = loc.fn
                fn = '%s ' % fn
            self.add_item(u'\u2190 Go Back (%s%s)' % (fn, line),
                          self.jump_back, None)

        if not direct and palette:
            self.add_item(u'@%s \u21B5' % palette.title(), self.show_palette,
                          'main')

        li1 = len(self.items)
        if pcb:
            pcb(view, direct)

        if not direct:
            for k in sorted(self.palettes.keys()):
                if k:
                    if k != palette:
                        ttl = '@' + k.title()
                        if k == 'errors':
                            fr = gslint.ref(view.file_name())
                            if not fr or len(fr.reports) == 0:
                                continue
                            ttl = '%s (%d)' % (ttl, len(fr.reports))
                        itm = ttl
                        self.add_item(itm, self.show_palette, k)
Пример #5
0
	def show_palette(self, palette, direct=False):
		view = gs.active_valid_go_view(self.window)
		if not view:
			return

		palette = palette.lower().strip()
		if palette == 'auto':
			palette = self.last_activate_palette
		elif palette == 'main':
			palette = ''

		pcb = None
		if palette:
			pcb = self.palettes.get(palette)
			if pcb:
				self.last_activate_palette = palette
			else:
				gs.notice(DOMAIN, 'Invalid palette `%s`' % palette)
				palette = ''

		if not direct and len(self.bookmarks) > 0:
			loc = self.bookmarks[-1]
			line = 'line %d' % (loc.row + 1)
			if view.file_name() == loc.fn:
				fn = ''
			else:
				fn = relpath(loc.fn, dirname(loc.fn))
				if fn.startswith('..'):
					fn = loc.fn
				fn = '%s ' % fn
			self.add_item(u'\u2190 Go Back (%s%s)' % (fn, line), self.jump_back, None)

		if not direct and palette:
			self.add_item(u'@%s \u21B5' % palette.title(), self.show_palette, 'main')

		li1 = len(self.items)
		if pcb:
			pcb(view, direct)

		if not direct:
			for k in sorted(self.palettes.keys()):
				if k:
					if k != palette:
						ttl = '@' + k.title()
						if k == 'errors':
							fr = gslint.ref(view.file_name())
							if not fr or len(fr.reports) == 0:
								continue
							ttl = '%s (%d)' % (ttl, len(fr.reports))
						itm = ttl
						self.add_item(itm, self.show_palette, k)
Пример #6
0
    def show_palette(self, palette, direct=False):
        view = gs.active_valid_go_view(self.window)
        if not view:
            return

        palette = palette.lower().strip()
        if palette == "auto":
            palette = self.last_activate_palette
        elif palette == "main":
            palette = ""

        pcb = None
        if palette:
            pcb = self.palettes.get(palette)
            if pcb:
                self.last_activate_palette = palette
            else:
                gs.notice(DOMAIN, "Invalid palette `%s`" % palette)
                palette = ""

        if not direct and len(self.bookmarks) > 0:
            loc = self.bookmarks[-1]
            line = "line %d" % (loc.row + 1)
            if view.file_name() == loc.fn:
                fn = ""
            else:
                fn = relpath(loc.fn, dirname(loc.fn))
                if fn.startswith(".."):
                    fn = loc.fn
                fn = "%s " % fn
            self.add_item(u"\u2190 Go Back (%s%s)" % (fn, line), self.jump_back, None)

        if not direct and palette:
            self.add_item(u"@%s \u21B5" % palette.title(), self.show_palette, "main")

        li1 = len(self.items)
        if pcb:
            pcb(view, direct)

        if not direct:
            for k in sorted(self.palettes.keys()):
                if k:
                    if k != palette:
                        ttl = "@" + k.title()
                        if k == "errors":
                            fr = gslint.ref(view.file_name())
                            if not fr or len(fr.reports) == 0:
                                continue
                            ttl = "%s (%d)" % (ttl, len(fr.reports))
                        itm = ttl
                        self.add_item(itm, self.show_palette, k)