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

Method codeAction

src/tools/ecode/plugins/lsp/lspclientservermanager.cpp:449–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449bool LSPClientServerManager::codeAction( std::shared_ptr<TextDocument> doc,
450 const nlohmann::json& diagnostics,
451 const LSPClientServer::CodeActionHandler& h ) {
452 auto* server = getOneLSPClientServer( doc );
453 if ( !server || !server->isRunning() )
454 return false;
455
456 auto range = doc->getSelection();
457 if ( !diagnostics.empty() && diagnostics.contains( "diagnostics" ) &&
458 diagnostics["diagnostics"].is_array() && !diagnostics["diagnostics"].empty() &&
459 diagnostics["diagnostics"][0].contains( "range" ) ) {
460 range = LSPConverter::parseRange( diagnostics["diagnostics"][0]["range"] );
461 } else if ( !doc->hasSelection() ) {
462 range = { doc->startOfLine( range.start() ),
463 doc->positionOffset( doc->endOfLine( range.end() ), 1 ) };
464 }
465
466 server->documentCodeAction( doc->getURI(), range, {}, diagnostics, h );
467 return true;
468}
469
470void LSPClientServerManager::memoryUsage( std::shared_ptr<TextDocument> doc ) {
471 auto* server = getOneLSPClientServer( doc );

Callers

nothing calls this directly

Calls 13

parseRangeFunction · 0.85
startOfLineMethod · 0.80
positionOffsetMethod · 0.80
endOfLineMethod · 0.80
documentCodeActionMethod · 0.80
getURIMethod · 0.80
isRunningMethod · 0.45
getSelectionMethod · 0.45
emptyMethod · 0.45
containsMethod · 0.45
hasSelectionMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected