Exemple #1
0
    def OnFileReadyToParse(self, request_data):
        if (not self._omnisharp_port
                and self.user_options['auto_start_csharp_server']):
            self._StartServer(request_data)
            return

        filename = request_data['filepath']
        contents = request_data['file_data'][filename]['contents']
        if contents.count('\n') < MIN_LINES_IN_FILE_TO_PARSE:
            raise ValueError(FILE_TOO_SHORT_MESSAGE)

        if not filename:
            raise ValueError(INVALID_FILE_MESSAGE)

        errors = self._GetResponse('/codecheck',
                                   self._DefaultParameters(request_data))

        diagnostics = [
            self._QuickFixToDiagnostic(x) for x in errors["QuickFixes"]
        ]

        self._diagnostic_store = DiagnosticsToDiagStructure(diagnostics)

        return [
            responses.BuildDiagnosticData(x)
            for x in diagnostics[:self._max_diagnostics_to_display]
        ]
Exemple #2
0
    def OnFileReadyToParse(self, request_data):
        solutioncompleter = self._GetSolutionCompleter(request_data)

        # Only start the server associated to this solution if the option to
        # automatically start one is set and no server process is already running.
        if (self.user_options['auto_start_csharp_server']
                and not solutioncompleter._ServerIsRunning()):
            solutioncompleter._StartServer()
            return

        # Bail out if the server is unresponsive. We don't start or restart the
        # server in this case because current one may still be warming up.
        if not solutioncompleter.ServerIsHealthy():
            return

        errors = solutioncompleter.CodeCheck(request_data)

        diagnostics = [
            self._QuickFixToDiagnostic(request_data, x)
            for x in errors["QuickFixes"]
        ]

        self._diagnostic_store = DiagnosticsToDiagStructure(diagnostics)

        return [
            responses.BuildDiagnosticData(x)
            for x in diagnostics[:self._max_diagnostics_to_display]
        ]
    def OnFileReadyToParse(self, request_data):
        self._Reload(request_data)

        diagnostics = self.GetDiagnosticsForCurrentFile(request_data)
        filepath = request_data['filepath']
        with self._latest_diagnostics_for_file_lock:
            self._latest_diagnostics_for_file[filepath] = diagnostics
        return [responses.BuildDiagnosticData(x) for x in diagnostics]
Exemple #4
0
  def OnFileReadyToParse( self, request_data ):
    flags, filename = self._FlagsForRequest( request_data )
    if not flags:
      raise ValueError( NO_COMPILE_FLAGS_MESSAGE )

    with self._files_being_compiled.GetExclusive( filename ):
      diagnostics = self._completer.UpdateTranslationUnit(
        ToCppStringCompatible( filename ),
        self.GetUnsavedFilesVector( request_data ),
        flags )

    diagnostics = _FilterDiagnostics( diagnostics )
    self._diagnostic_store = DiagnosticsToDiagStructure( diagnostics )
    return [ responses.BuildDiagnosticData( x ) for x in
             diagnostics[ : self._max_diagnostics_to_display ] ]
Exemple #5
0
  def OnFileReadyToParse( self, request_data ):
    solutioncompleter = self._GetSolutionCompleter( request_data )

    if ( not solutioncompleter.ServerIsRunning() and
         self.user_options[ 'auto_start_csharp_server' ] ):
      solutioncompleter._StartServer()
      return

    errors = solutioncompleter.CodeCheck( request_data )

    diagnostics = [ self._QuickFixToDiagnostic( x ) for x in
                    errors[ "QuickFixes" ] ]

    self._diagnostic_store = DiagnosticsToDiagStructure( diagnostics )

    return [ responses.BuildDiagnosticData( x ) for x in
             diagnostics[ : self._max_diagnostics_to_display ] ]
Exemple #6
0
    def OnFileReadyToParse(self, request_data):
        filename = request_data['filepath']
        contents = request_data['file_data'][filename]['contents']
        if contents.count('\n') < MIN_LINES_IN_FILE_TO_PARSE:
            raise ValueError(FILE_TOO_SHORT_MESSAGE)

        if not filename:
            raise ValueError(INVALID_FILE_MESSAGE)

        flags = self._FlagsForRequest(request_data)
        if not flags:
            raise ValueError(NO_COMPILE_FLAGS_MESSAGE)

        diagnostics = self._completer.UpdateTranslationUnit(
            ToUtf8IfNeeded(filename), self.GetUnsavedFilesVector(request_data),
            flags)

        diagnostics = _FilterDiagnostics(diagnostics)
        self._diagnostic_store = DiagnosticsToDiagStructure(diagnostics)
        return [
            responses.BuildDiagnosticData(x)
            for x in diagnostics[:self._max_diagnostics_to_display]
        ]
Exemple #7
0
    def OnFileReadyToParse(self, request_data):
        self._Reload(request_data)

        diagnostics = self.GetDiagnosticsForCurrentFile(request_data)
        return [responses.BuildDiagnosticData(x) for x in diagnostics]