forked from qt-creator/qt-creator
LanguageClient: clean up client interface declaration
Change-Id: I18b5b8a5b39a6be7c538054385c7dca188676eef Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -904,7 +904,7 @@ void Client::handleMessage(const BaseMessage &message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::log(const QString &message)
|
void Client::log(const QString &message) const
|
||||||
{
|
{
|
||||||
Core::MessageManager::writeFlashing(QString("LanguageClient %1: %2").arg(name(), message));
|
Core::MessageManager::writeFlashing(QString("LanguageClient %1: %2").arg(name(), message));
|
||||||
}
|
}
|
||||||
@@ -919,11 +919,6 @@ const DynamicCapabilities &Client::dynamicCapabilities() const
|
|||||||
return m_dynamicCapabilities;
|
return m_dynamicCapabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BaseClientInterface *Client::clientInterface() const
|
|
||||||
{
|
|
||||||
return m_clientInterface.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
DocumentSymbolCache *Client::documentSymbolCache()
|
DocumentSymbolCache *Client::documentSymbolCache()
|
||||||
{
|
{
|
||||||
return &m_documentSymbolCache;
|
return &m_documentSymbolCache;
|
||||||
|
@@ -84,6 +84,19 @@ public:
|
|||||||
Client &operator=(const Client &) = delete;
|
Client &operator=(const Client &) = delete;
|
||||||
Client &operator=(Client &&) = delete;
|
Client &operator=(Client &&) = delete;
|
||||||
|
|
||||||
|
// basic properties
|
||||||
|
Utils::Id id() const { return m_id; }
|
||||||
|
void setName(const QString &name) { m_displayName = name; }
|
||||||
|
QString name() const { return m_displayName; }
|
||||||
|
void sendContent(const LanguageServerProtocol::IContent &content);
|
||||||
|
void cancelRequest(const LanguageServerProtocol::MessageId &id);
|
||||||
|
|
||||||
|
// server state handling
|
||||||
|
void start();
|
||||||
|
void setInitializationOptions(const QJsonObject& initializationOptions);
|
||||||
|
void initialize();
|
||||||
|
bool reset();
|
||||||
|
void shutdown();
|
||||||
enum State {
|
enum State {
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
InitializeRequested,
|
InitializeRequested,
|
||||||
@@ -92,13 +105,20 @@ public:
|
|||||||
Shutdown,
|
Shutdown,
|
||||||
Error
|
Error
|
||||||
};
|
};
|
||||||
|
|
||||||
void initialize();
|
|
||||||
void shutdown();
|
|
||||||
State state() const;
|
State state() const;
|
||||||
bool reachable() const { return m_state == Initialized; }
|
bool reachable() const { return m_state == Initialized; }
|
||||||
|
|
||||||
|
// capabilities
|
||||||
|
const LanguageServerProtocol::ServerCapabilities &capabilities() const;
|
||||||
|
const DynamicCapabilities &dynamicCapabilities() const;
|
||||||
|
void registerCapabilities(const QList<LanguageServerProtocol::Registration> ®istrations);
|
||||||
|
void unregisterCapabilities(const QList<LanguageServerProtocol::Unregistration> &unregistrations);
|
||||||
|
|
||||||
// document synchronization
|
// document synchronization
|
||||||
|
void setSupportedLanguage(const LanguageFilter &filter);
|
||||||
|
bool isSupportedDocument(const TextEditor::TextDocument *document) const;
|
||||||
|
bool isSupportedFile(const Utils::FilePath &filePath, const QString &mimeType) const;
|
||||||
|
bool isSupportedUri(const LanguageServerProtocol::DocumentUri &uri) const;
|
||||||
void openDocument(TextEditor::TextDocument *document);
|
void openDocument(TextEditor::TextDocument *document);
|
||||||
void closeDocument(TextEditor::TextDocument *document);
|
void closeDocument(TextEditor::TextDocument *document);
|
||||||
void activateDocument(TextEditor::TextDocument *document);
|
void activateDocument(TextEditor::TextDocument *document);
|
||||||
@@ -110,18 +130,8 @@ public:
|
|||||||
int position,
|
int position,
|
||||||
int charsRemoved,
|
int charsRemoved,
|
||||||
int charsAdded);
|
int charsAdded);
|
||||||
void registerCapabilities(const QList<LanguageServerProtocol::Registration> ®istrations);
|
|
||||||
void unregisterCapabilities(const QList<LanguageServerProtocol::Unregistration> &unregistrations);
|
|
||||||
void cursorPositionChanged(TextEditor::TextEditorWidget *widget);
|
void cursorPositionChanged(TextEditor::TextEditorWidget *widget);
|
||||||
|
bool documentUpdatePostponed(const Utils::FilePath &fileName) const;
|
||||||
SymbolSupport &symbolSupport();
|
|
||||||
|
|
||||||
void requestCodeActions(const LanguageServerProtocol::DocumentUri &uri,
|
|
||||||
const QList<LanguageServerProtocol::Diagnostic> &diagnostics);
|
|
||||||
void requestCodeActions(const LanguageServerProtocol::CodeActionRequest &request);
|
|
||||||
void handleCodeActionResponse(const LanguageServerProtocol::CodeActionRequest::Response &response,
|
|
||||||
const LanguageServerProtocol::DocumentUri &uri);
|
|
||||||
void executeCommand(const LanguageServerProtocol::Command &command);
|
|
||||||
|
|
||||||
// workspace control
|
// workspace control
|
||||||
void setCurrentProject(ProjectExplorer::Project *project);
|
void setCurrentProject(ProjectExplorer::Project *project);
|
||||||
@@ -129,45 +139,34 @@ public:
|
|||||||
void projectOpened(ProjectExplorer::Project *project);
|
void projectOpened(ProjectExplorer::Project *project);
|
||||||
void projectClosed(ProjectExplorer::Project *project);
|
void projectClosed(ProjectExplorer::Project *project);
|
||||||
|
|
||||||
void sendContent(const LanguageServerProtocol::IContent &content);
|
// commands
|
||||||
void cancelRequest(const LanguageServerProtocol::MessageId &id);
|
void requestCodeActions(const LanguageServerProtocol::DocumentUri &uri,
|
||||||
|
const QList<LanguageServerProtocol::Diagnostic> &diagnostics);
|
||||||
void setSupportedLanguage(const LanguageFilter &filter);
|
void requestCodeActions(const LanguageServerProtocol::CodeActionRequest &request);
|
||||||
void setInitializationOptions(const QJsonObject& initializationOptions);
|
void handleCodeActionResponse(const LanguageServerProtocol::CodeActionRequest::Response &response,
|
||||||
bool isSupportedDocument(const TextEditor::TextDocument *document) const;
|
const LanguageServerProtocol::DocumentUri &uri);
|
||||||
bool isSupportedFile(const Utils::FilePath &filePath, const QString &mimeType) const;
|
void executeCommand(const LanguageServerProtocol::Command &command);
|
||||||
bool isSupportedUri(const LanguageServerProtocol::DocumentUri &uri) const;
|
|
||||||
|
|
||||||
|
// language support
|
||||||
void addAssistProcessor(TextEditor::IAssistProcessor *processor);
|
void addAssistProcessor(TextEditor::IAssistProcessor *processor);
|
||||||
void removeAssistProcessor(TextEditor::IAssistProcessor *processor);
|
void removeAssistProcessor(TextEditor::IAssistProcessor *processor);
|
||||||
|
SymbolSupport &symbolSupport();
|
||||||
void setName(const QString &name) { m_displayName = name; }
|
DocumentSymbolCache *documentSymbolCache();
|
||||||
QString name() const { return m_displayName; }
|
HoverHandler *hoverHandler();
|
||||||
|
|
||||||
Utils::Id id() const { return m_id; }
|
|
||||||
|
|
||||||
QList<LanguageServerProtocol::Diagnostic> diagnosticsAt(
|
QList<LanguageServerProtocol::Diagnostic> diagnosticsAt(
|
||||||
const LanguageServerProtocol::DocumentUri &uri,
|
const LanguageServerProtocol::DocumentUri &uri,
|
||||||
const QTextCursor &cursor) const;
|
const QTextCursor &cursor) const;
|
||||||
|
|
||||||
void start();
|
// formatting
|
||||||
bool reset();
|
void formatFile(const TextEditor::TextDocument *document);
|
||||||
|
void formatRange(const TextEditor::TextDocument *document, const QTextCursor &cursor);
|
||||||
|
|
||||||
void log(const QString &message);
|
|
||||||
|
// logging
|
||||||
|
void log(const QString &message) const;
|
||||||
template<typename Error>
|
template<typename Error>
|
||||||
void log(const LanguageServerProtocol::ResponseError<Error> &responseError)
|
void log(const LanguageServerProtocol::ResponseError<Error> &responseError) const
|
||||||
{
|
{ log(responseError.toString()); }
|
||||||
log(responseError.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
const LanguageServerProtocol::ServerCapabilities &capabilities() const;
|
|
||||||
const DynamicCapabilities &dynamicCapabilities() const;
|
|
||||||
const BaseClientInterface *clientInterface() const;
|
|
||||||
DocumentSymbolCache *documentSymbolCache();
|
|
||||||
HoverHandler *hoverHandler();
|
|
||||||
void rehighlight();
|
|
||||||
|
|
||||||
bool documentUpdatePostponed(const Utils::FilePath &fileName) const;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void initialized(const LanguageServerProtocol::ServerCapabilities &capabilities);
|
void initialized(const LanguageServerProtocol::ServerCapabilities &capabilities);
|
||||||
@@ -203,6 +202,8 @@ private:
|
|||||||
void updateCompletionProvider(TextEditor::TextDocument *document);
|
void updateCompletionProvider(TextEditor::TextDocument *document);
|
||||||
void updateFunctionHintProvider(TextEditor::TextDocument *document);
|
void updateFunctionHintProvider(TextEditor::TextDocument *document);
|
||||||
|
|
||||||
|
void rehighlight();
|
||||||
|
|
||||||
using ContentHandler = std::function<void(const QByteArray &, QTextCodec *, QString &,
|
using ContentHandler = std::function<void(const QByteArray &, QTextCodec *, QString &,
|
||||||
LanguageServerProtocol::ResponseHandlers,
|
LanguageServerProtocol::ResponseHandlers,
|
||||||
LanguageServerProtocol::MethodHandler)>;
|
LanguageServerProtocol::MethodHandler)>;
|
||||||
|
Reference in New Issue
Block a user