mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-07-14 15:02:50 +03:00
Started implementing LSP workspace diagnostic to find that not a single LSP implements it, so I just wasted 2 hours of my life. I'll keep the base structure for the future.
This commit is contained in:
@@ -434,6 +434,31 @@ PluginRequestHandle LSPClientPlugin::processWorkspaceSymbol( const PluginMessage
|
||||
return hdl;
|
||||
}
|
||||
|
||||
PluginRequestHandle LSPClientPlugin::processWorkspaceDiagnostic( const PluginMessage& msg ) {
|
||||
if ( !( ( msg.isBroadcast() && msg.type == PluginMessageType::LanguageServerReady && msg.data &&
|
||||
msg.format == PluginMessageFormat::LSPClientServer ) ||
|
||||
( msg.isRequest() && msg.type == PluginMessageType::WorkspaceDiagnostic &&
|
||||
msg.format == PluginMessageFormat::LSPClientServer ) ) )
|
||||
return {};
|
||||
/* NOTE: I couldn't find a single LSP server supporting this feature so I cannot test it.
|
||||
* I'll leave the current implementation here to continue with it later in the future.
|
||||
* Since I started implementing it assuming it was commonly supported...
|
||||
|
||||
LSPClientServer* server =
|
||||
const_cast<LSPClientServer*>( reinterpret_cast<const LSPClientServer*>( msg.data ) );
|
||||
|
||||
if ( !server->getCapabilities().diagnosticProvider.workspaceDiagnostics )
|
||||
return {};
|
||||
|
||||
server->workspaceDiagnosticAsync(
|
||||
[this]( const PluginIDType&, LSPWorkspaceDiagnosticReport&& report ) {
|
||||
mManager->sendBroadcast( this, PluginMessageType::WorkspaceDiagnostic,
|
||||
PluginMessageFormat::WorkspaceDiagnosticReport, &report );
|
||||
} );
|
||||
*/
|
||||
return PluginRequestHandle::broadcast();
|
||||
}
|
||||
|
||||
PluginRequestHandle LSPClientPlugin::processTextDocumentSymbol( const PluginMessage& msg ) {
|
||||
if ( !msg.isRequest() ||
|
||||
( msg.type != PluginMessageType::TextDocumentSymbol &&
|
||||
@@ -938,6 +963,11 @@ PluginRequestHandle LSPClientPlugin::processMessage( const PluginMessage& msg )
|
||||
processFoldingRanges( msg );
|
||||
break;
|
||||
}
|
||||
case PluginMessageType::WorkspaceDiagnostic:
|
||||
case PluginMessageType::LanguageServerReady: {
|
||||
processWorkspaceDiagnostic( msg );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user