示例#1
0
	def run(self, edit):
		if not (gs.setting('fmt_enabled', False) is True and gs.is_go_source_view(self.view)):
			return

		vsize = self.view.size()
		src = self.view.substr(sublime.Region(0, vsize))
		if not src.strip():
			return

		src, err = margo.fmt(self.view.file_name(), src)
		if err or not src.strip():
			return

		dirty, err = gspatch.merge(self.view, vsize, src)
		if err:
			gs.notice_undo(DOMAIN, err, self.view, dirty)
示例#2
0
	def run(self, edit):
		vsize = self.view.size()
		src = self.view.substr(sublime.Region(0, vsize))
		if not src.strip():
			return

		src, err = margo.fmt(self.view.file_name(), src)
		if err:
			gs.notice(DOMAIN, "cannot fmt file. error: `%s'" % err)
			return
		if not src.strip():
			gs.notice(DOMAIN, "cannot fmt file. it appears to contain syntax errors")
			return

		dirty, err = gspatch.merge(self.view, vsize, src)
		if err:
			gs.notice_undo(DOMAIN, "cannot fmt file. merge failure: `%s'" % err, self.view, dirty)
示例#3
0
	def run(self, edit):
		vsize = self.view.size()
		src = self.view.substr(sublime.Region(0, vsize))
		if not src.strip():
			return

		src, err = margo.fmt(self.view.file_name(), src)
		if err:
			gs.notice(DOMAIN, "cannot fmt file. error: `%s'" % err)
			return

		if not src.strip():
			gs.notice(DOMAIN, "cannot fmt file. it appears to contain syntax errors")
			return

		_, err = gspatch.merge(self.view, vsize, src)
		if err:
			msg = 'PANIC: Cannot fmt file. Check your source for errors (and maybe undo any changes).'
			sublime.error_message("%s: %s: Merge failure: `%s'" % (DOMAIN, msg, err))
示例#4
0
    def run(self, edit):
        vsize = self.view.size()
        src = self.view.substr(sublime.Region(0, vsize))
        if not src.strip():
            return

        src, err = margo.fmt(self.view.file_name(), src)
        if err:
            gs.notice(DOMAIN, "cannot fmt file. error: `%s'" % err)
            return

        if not src.strip():
            gs.notice(DOMAIN,
                      "cannot fmt file. it appears to contain syntax errors")
            return

        _, err = gspatch.merge(self.view, vsize, src)
        if err:
            msg = 'PANIC: Cannot fmt file. Check your source for errors (and maybe undo any changes).'
            sublime.error_message("%s: %s: Merge failure: `%s'" %
                                  (DOMAIN, msg, err))