forked from qt-creator/qt-creator
LanguageClient: move capabilities widget to inspector
The capabilities are not changeable for the user, but only there to check whether a server is capable of a specific task. This will also allow us to have more specialized settings widgets for specific servers like for the java language server without the need to add the capabilities to each of those special widgets. Also add the dynamic capabilities to the widget so users have a complete overview of the capabilities. Change-Id: I9f2ed6ed11b458f0d4c67be3df632fd810023286 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -25,10 +25,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "dynamiccapabilities.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QWidget>
|
||||
|
||||
#include <languageserverprotocol/basemessage.h>
|
||||
#include <languageserverprotocol/servercapabilities.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -41,6 +44,12 @@ struct LspLogMessage
|
||||
LanguageServerProtocol::BaseMessage message;
|
||||
};
|
||||
|
||||
struct Capabilities
|
||||
{
|
||||
LanguageServerProtocol::ServerCapabilities capabilities;
|
||||
DynamicCapabilities dynamicCapabilities;
|
||||
};
|
||||
|
||||
class LspInspector : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -53,15 +62,22 @@ public:
|
||||
void log(const LspLogMessage::MessageSender sender,
|
||||
const QString &clientName,
|
||||
const LanguageServerProtocol::BaseMessage &message);
|
||||
void clientInitialized(const QString &clientName,
|
||||
const LanguageServerProtocol::ServerCapabilities &capabilities);
|
||||
void updateCapabilities(const QString &clientName,
|
||||
const DynamicCapabilities &dynamicCapabilities);
|
||||
|
||||
std::list<LspLogMessage> messages(const QString &clientName) const;
|
||||
Capabilities capabilities(const QString &clientName) const;
|
||||
QList<QString> clients() const;
|
||||
|
||||
signals:
|
||||
void newMessage(const QString &clientName, const LspLogMessage &message);
|
||||
void capabilitiesUpdated(const QString &clientName);
|
||||
|
||||
private:
|
||||
QMap<QString, std::list<LspLogMessage>> m_logs;
|
||||
QMap<QString, Capabilities> m_capabilities;
|
||||
int m_logSize = 100; // default log size if no widget is currently visible
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user