Пример #1
0
    def run(self, edit):
        path = os.path.realpath(self.view.file_name().decode('utf-8'))
        if os.path.splitext(path)[1] != '.css':
            sublime.error_message('Not a CSS file!')
            return

        cmd = getCkstylePath() + ' check "' + path + '"'
        os.popen3(cmd)
        resultFile = self.view.file_name() + '.ckstyle.txt'
        if os.path.exists(resultFile):
            self.view.window().open_file(self.view.file_name() + '.ckstyle.txt')
        else: 
            sublime.message_dialog('No mistake found in this CSS, NB!')
Пример #2
0
    def run(self, edit):
        path = os.path.realpath(self.view.file_name().decode('utf-8'))
        if os.path.splitext(path)[1] != '.css':
            sublime.error_message('Not a CSS file!')
            return

        cmd = getCkstylePath() + ' check "' + path + '"'
        os.popen3(cmd)
        resultFile = self.view.file_name() + '.ckstyle.txt'
        if os.path.exists(resultFile):
            self.view.window().open_file(self.view.file_name() +
                                         '.ckstyle.txt')
        else:
            sublime.message_dialog('No mistake found in this CSS, NB!')
Пример #3
0
    def run(self, edit):
        path = os.path.realpath(self.view.file_name().decode('utf-8'))
        if os.path.splitext(path)[1] != '.css':
            sublime.error_message('Not a CSS file!')
            return
        cmd = getCkstylePath() + ' fix -p "' + path + '"'
        returnValue = os.popen3(cmd)

        returnValue = returnValue[1].read() + returnValue[2].read()

        if returnValue.find('[console.error]') != -1:
            sublime.error_message(returnValue)
        else:
            region = sublime.Region(0, self.view.size())
            msg = self.getRealMsg(returnValue)
            try:
                self.view.replace(edit, region, msg)
            except Exception:
                sublime.error_message('ERROR, maybe because file encoding charset is not utf-8');
            self.view.end_edit(edit)
Пример #4
0
    def run(self, edit):
        path = os.path.realpath(self.view.file_name()).decode('utf-8')
        if os.path.splitext(path)[1] != '.css':
            sublime.error_message('Not a CSS file!')
            return
            
        cmd = getCkstylePath() + ' fix -p --singleLine "' + path + '"'
        returnValue = os.popen3(cmd)

        returnValue = returnValue[1].read() + returnValue[2].read()

        if returnValue.find('[console.error]') != -1:
            sublime.error_message(returnValue)
        else:
            region = sublime.Region(0, self.view.size())
            msg = self.getRealMsg(returnValue)
            try:
                self.view.replace(edit, region, msg)
            except Exception:
                sublime.error_message('ERROR, maybe because file encoding charset is not utf-8');
            self.view.end_edit(edit)