MCPcopy Create free account
hub / github.com/SpartanJ/eepp / parseDiagnostics

Function parseDiagnostics

src/tools/ecode/plugins/lsp/lspclientserver.cpp:649–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649static std::vector<LSPDiagnostic> parseDiagnostics( const json& result ) {
650 std::vector<LSPDiagnostic> ret;
651 for ( const auto& vdiag : result ) {
652 const auto& diag = vdiag;
653 auto range = parseRange( diag.at( MEMBER_RANGE ) );
654 auto severity = static_cast<LSPDiagnosticSeverity>( diag.value<int>( "severity", 0 ) );
655 std::string code;
656 if ( diag.contains( "code" ) ) {
657 if ( diag["code"].is_number_integer() )
658 code = String::toString( diag["code"].get<int>() );
659 else
660 code = diag.value( "code", "" );
661 }
662
663 auto source = diag.value( "source", "" );
664 auto message = diag.value( MEMBER_MESSAGE, "" );
665 std::vector<LSPDiagnosticRelatedInformation> relatedInfoList;
666 if ( diag.contains( "relatedInformation" ) ) {
667 const auto& relatedInfo = diag.at( "relatedInformation" );
668 for ( const auto& related : relatedInfo ) {
669 auto relLocation = parseLocation( related.at( MEMBER_LOCATION ) );
670 auto relMessage = related.value( MEMBER_MESSAGE, "" );
671 relatedInfoList.push_back( { relLocation, relMessage } );
672 }
673 }
674 json data;
675 if ( diag.contains( "data" ) )
676 data = diag["data"];
677 ret.push_back( { std::move( range ),
678 std::move( severity ),
679 std::move( code ),
680 std::move( source ),
681 std::move( message ),
682 std::move( relatedInfoList ),
683 {},
684 std::move( data ) } );
685 }
686 return ret;
687}
688
689static std::vector<LSPCodeAction> parseCodeAction( const json& result ) {
690 std::vector<LSPCodeAction> ret;

Callers 2

parseCodeActionFunction · 0.85

Calls 7

parseRangeFunction · 0.85
parseLocationFunction · 0.85
atMethod · 0.80
push_backMethod · 0.80
toStringFunction · 0.50
containsMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected