Commit fca423c5 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

lspclient: add server support for document/typeDefinition

parent 43d53009
...@@ -78,6 +78,7 @@ struct LSPServerCapabilities { ...@@ -78,6 +78,7 @@ struct LSPServerCapabilities {
bool definitionProvider = false; bool definitionProvider = false;
// official extension as of 3.14.0 // official extension as of 3.14.0
bool declarationProvider = false; bool declarationProvider = false;
bool typeDefinitionProvider = false;
bool referencesProvider = false; bool referencesProvider = false;
bool implementationProvider = false; bool implementationProvider = false;
bool documentSymbolProvider = false; bool documentSymbolProvider = false;
......
...@@ -296,6 +296,7 @@ static void from_json(LSPServerCapabilities &caps, const QJsonObject &json) ...@@ -296,6 +296,7 @@ static void from_json(LSPServerCapabilities &caps, const QJsonObject &json)
from_json(caps.signatureHelpProvider, json.value(QStringLiteral("signatureHelpProvider"))); from_json(caps.signatureHelpProvider, json.value(QStringLiteral("signatureHelpProvider")));
caps.definitionProvider = json.value(QStringLiteral("definitionProvider")).toBool(); caps.definitionProvider = json.value(QStringLiteral("definitionProvider")).toBool();
caps.declarationProvider = json.value(QStringLiteral("declarationProvider")).toBool(); caps.declarationProvider = json.value(QStringLiteral("declarationProvider")).toBool();
caps.typeDefinitionProvider = json.value(QStringLiteral("typeDefinitionProvider")).toBool();
caps.referencesProvider = json.value(QStringLiteral("referencesProvider")).toBool(); caps.referencesProvider = json.value(QStringLiteral("referencesProvider")).toBool();
caps.implementationProvider = json.value(QStringLiteral("implementationProvider")).toBool(); caps.implementationProvider = json.value(QStringLiteral("implementationProvider")).toBool();
caps.documentSymbolProvider = json.value(QStringLiteral("documentSymbolProvider")).toBool(); caps.documentSymbolProvider = json.value(QStringLiteral("documentSymbolProvider")).toBool();
...@@ -1152,6 +1153,12 @@ public: ...@@ -1152,6 +1153,12 @@ public:
return send(init_request(QStringLiteral("textDocument/declaration"), params), h); return send(init_request(QStringLiteral("textDocument/declaration"), params), h);
} }
RequestHandle documentTypeDefinition(const QUrl &document, const LSPPosition &pos, const GenericReplyHandler &h)
{
auto params = textDocumentPositionParams(document, pos);
return send(init_request(QStringLiteral("textDocument/typeDefinition"), params), h);
}
RequestHandle documentImplementation(const QUrl &document, const LSPPosition &pos, const GenericReplyHandler &h) RequestHandle documentImplementation(const QUrl &document, const LSPPosition &pos, const GenericReplyHandler &h)
{ {
auto params = textDocumentPositionParams(document, pos); auto params = textDocumentPositionParams(document, pos);
...@@ -1425,6 +1432,12 @@ LSPClientServer::documentDeclaration(const QUrl &document, const LSPPosition &po ...@@ -1425,6 +1432,12 @@ LSPClientServer::documentDeclaration(const QUrl &document, const LSPPosition &po
return d->documentDeclaration(document, pos, make_handler(h, context, parseDocumentLocation)); return d->documentDeclaration(document, pos, make_handler(h, context, parseDocumentLocation));
} }
LSPClientServer::RequestHandle
LSPClientServer::documentTypeDefinition(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h)
{
return d->documentTypeDefinition(document, pos, make_handler(h, context, parseDocumentLocation));
}
LSPClientServer::RequestHandle LSPClientServer::RequestHandle
LSPClientServer::documentHover(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentHoverReplyHandler &h) LSPClientServer::documentHover(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentHoverReplyHandler &h)
{ {
......
...@@ -115,6 +115,7 @@ public: ...@@ -115,6 +115,7 @@ public:
RequestHandle documentSymbols(const QUrl &document, const QObject *context, const DocumentSymbolsReplyHandler &h, const ErrorReplyHandler &eh = nullptr); RequestHandle documentSymbols(const QUrl &document, const QObject *context, const DocumentSymbolsReplyHandler &h, const ErrorReplyHandler &eh = nullptr);
RequestHandle documentDefinition(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h); RequestHandle documentDefinition(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h);
RequestHandle documentDeclaration(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h); RequestHandle documentDeclaration(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h);
RequestHandle documentTypeDefinition(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h);
RequestHandle documentImplementation(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h); RequestHandle documentImplementation(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentDefinitionReplyHandler &h);
RequestHandle documentHighlight(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentHighlightReplyHandler &h); RequestHandle documentHighlight(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentHighlightReplyHandler &h);
RequestHandle documentHover(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentHoverReplyHandler &h); RequestHandle documentHover(const QUrl &document, const LSPPosition &pos, const QObject *context, const DocumentHoverReplyHandler &h);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment