| 717 | } |
| 718 | |
| 719 | static std::vector<LSPDiagnosticsCodeAction> parseDiagnosticsCodeAction( const json& result ) { |
| 720 | std::vector<LSPDiagnosticsCodeAction> ret; |
| 721 | const auto& codeActions = result; |
| 722 | for ( const auto& action : codeActions ) { |
| 723 | if ( !action.contains( MEMBER_COMMAND ) || !action.at( MEMBER_COMMAND ).is_string() ) { |
| 724 | auto title = action.at( MEMBER_TITLE ).get<std::string>(); |
| 725 | auto kind = action.value( MEMBER_KIND, "" ); |
| 726 | auto isPreferred = action.value( "isPreferred", false ); |
| 727 | auto edit = action.contains( MEMBER_EDIT ) |
| 728 | ? parseWorkSpaceEdit( action.at( MEMBER_EDIT ) ) |
| 729 | : LSPWorkspaceEdit{}; |
| 730 | LSPDiagnosticsCodeAction _action = { title, kind, isPreferred, edit }; |
| 731 | ret.push_back( _action ); |
| 732 | } |
| 733 | } |
| 734 | return ret; |
| 735 | } |
| 736 | |
| 737 | static std::vector<LSPCodeLens> parseCodeLens( const json& result ) { |
| 738 | if ( result.empty() || !result.is_array() ) |
no test coverage detected