forked from qt-creator/qt-creator
LSP: generalize adding message provider
Change-Id: Ie15e835871a416523d58aba5362a34806cc8b70f Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -71,16 +71,19 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void registerMessageProvider()
|
||||
{
|
||||
JsonRpcMessageHandler::registerMessageProvider(T::methodName,
|
||||
[](const QJsonObject &object){
|
||||
return new T(object);
|
||||
});
|
||||
}
|
||||
|
||||
LanguageClientManager::LanguageClientManager()
|
||||
{
|
||||
JsonRpcMessageHandler::registerMessageProvider("textDocument/publishDiagnostics",
|
||||
[](const QJsonObject &object){
|
||||
return new PublishDiagnosticsNotification(object);
|
||||
});
|
||||
JsonRpcMessageHandler::registerMessageProvider(LogMessageNotification::methodName,
|
||||
[](const QJsonObject &object){
|
||||
return new LogMessageNotification(object);
|
||||
});
|
||||
registerMessageProvider<PublishDiagnosticsNotification>();
|
||||
registerMessageProvider<LogMessageNotification>();
|
||||
managerInstance = this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user