예제 #1
0
 def EchoErrorMessageForCurrentLine(self):
     vimsupport.EchoText('')
     if not self.isAlive():
         return
     current_line, current_column = vimsupport.CurrentLineAndColumn()
     if not current_line in self.lined_diagnostics:
         return ''
     diagnostic = self.NearestDiagnostic(current_line, current_column)
     vimsupport.EchoTruncatedText(diagnostic['text'])
예제 #2
0
 def UpdateCurrentBuffer(self):
     if not self.isAlive():
         return
     buf = vimsupport.CurrentBuffer()
     try:
         self.UpdateSpecifiedBuffer(buf)
     except TimedOutError:
         log.exception('failed to update curent buffer')
         vimsupport.EchoTruncatedText('unable to update curent buffer')
예제 #3
0
    def OpenFile(self, file_name):
        if not self.isAlive():
            return True

        uri = GetUriFromFilePath(file_name)
        try:
            buf = vimsupport.GetBufferByName(file_name)
            self.didOpenFile(buf)
        except TimedOutError:
            log.exception('failed to open %s' % file_name)
            vimsupport.EchoTruncatedText('unable to open %s' % file_name)
            return False

        return True
예제 #4
0
    def GotoDefinition(self):
        if not self.isAlive():
            return

        line, column = vimsupport.CurrentLineAndColumn()
        #TODO we may want to reparse source file actively here or by-pass the
        # reparsing to incoming source file monitor?

        response = self.wc.GetDefinition(vimsupport.CurrentBufferFileName(),
                                         line, column)
        if not response:
            log.warning('unable to get definition at %d:%d' % (line, column))
            vimsupport.EchoTruncatedText('unable to get definition at %d:%d' %
                                         (line, column))
            return
        location = response.location
        file_name = location.file_name
        line = location.line
        column = location.column
        vimsupport.GotoBuffer(file_name, line, column)
예제 #5
0
    def ShowCursorDetail(self):
        if not self.isAlive():
            return

        line, column = vimsupport.CurrentLineAndColumn()
        #TODO we may want to reparse source file actively here or by-pass the
        # reparsing to incoming source file monitor?
        response = self.wc.GetCursorDetail(vimsupport.CurrentBufferFileName(),
                                           line, column)
        if not response:
            log.warning('unable to get cursor at %d:%d' % (line, column))
            vimsupport.EchoTruncatedText('unable to get cursor at %d:%d' %
                                         (line, column))
            return
        detail = response.detail
        message = 'Type: %s Kind: %s' % (detail.type, detail.kind)
        brief_comment = detail.brief_comment
        if brief_comment:
            message += '   '
            message += brief_comment
        vimsupport.EchoText(message)