| 735 | } |
| 736 | |
| 737 | static std::vector<LSPCodeLens> parseCodeLens( const json& result ) { |
| 738 | if ( result.empty() || !result.is_array() ) |
| 739 | return {}; |
| 740 | |
| 741 | std::vector<LSPCodeLens> codeLens; |
| 742 | |
| 743 | for ( const auto& codeLen : result ) { |
| 744 | if ( !codeLen.contains( "range" ) ) |
| 745 | continue; |
| 746 | LSPCodeLens cl; |
| 747 | cl.range = parseRange( codeLen["range"] ); |
| 748 | if ( codeLen.contains( "command" ) ) |
| 749 | cl.command = parseCommand( codeLen["command"] ); |
| 750 | if ( codeLen.contains( "data" ) ) |
| 751 | cl.data = codeLen["data"]; |
| 752 | |
| 753 | codeLens.emplace_back( cl ); |
| 754 | } |
| 755 | |
| 756 | return codeLens; |
| 757 | } |
| 758 | |
| 759 | static json codeActionParams( const URI& document, const TextRange& range, |
| 760 | const std::vector<std::string>& kinds, const json& diagnostics ) { |
no test coverage detected