| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/JsonRpc/RequestInMessage.h" |
| 4 |
#include "LibLsp/JsonRpc/lsResponseMessage.h" |
| 5 |
|
| 6 |
#include "LibLsp/lsp/symbol.h" |
| 7 |
#include "LibLsp/lsp/lsTextDocumentIdentifier.h" |
| 8 |
/** |
| 9 |
* The document symbol request is sent from the client to the server to list all symbols found in a given text document. |
| 10 |
*/ |
| 11 |
struct lsDocumentSymbolParams |
| 12 |
{ |
| 13 |
lsTextDocumentIdentifier textDocument; |
| 14 |
MAKE_SWAP_METHOD(lsDocumentSymbolParams, textDocument) |
| 15 |
}; |
| 16 |
MAKE_REFLECT_STRUCT(lsDocumentSymbolParams, textDocument); |
| 17 |
|
| 18 |
struct TextDocumentDocumentSymbol |
| 19 |
{ |
| 20 |
typedef std::pair<optional<lsSymbolInformation>, optional<lsDocumentSymbol>> Either; |
| 21 |
}; |
| 22 |
void Reflect(Reader& visitor, TextDocumentDocumentSymbol::Either& value); |
| 23 |
|
| 24 |
/** |
| 25 |
* The document symbol request is sent from the client to the server to list all |
| 26 |
* symbols found in a given text document. |
| 27 |
* |
| 28 |
* Registration Options: {@link TextDocumentRegistrationOptions} |
| 29 |
* |
| 30 |
* <p> |
| 31 |
* <b>Caveat</b>: although the return type allows mixing the |
| 32 |
* {@link DocumentSymbol} and {@link SymbolInformation} instances into a list do |
| 33 |
* not do it because the clients cannot accept a heterogeneous list. A list of |
| 34 |
* {@code DocumentSymbol} instances is only a valid return value if the |
| 35 |
* {@link DocumentSymbolCapabilities#getHierarchicalDocumentSymbolSupport() |
| 36 |
* textDocument.documentSymbol.hierarchicalDocumentSymbolSupport} is |
| 37 |
* {@code true}. More details on this difference between the LSP and the LSP4J |
| 38 |
* can be found <a href="https://github.com/eclipse/lsp4j/issues/252">here</a>. |
| 39 |
* </p> |
| 40 |
*/ |
| 41 |
|
| 42 |
//DEFINE_REQUEST_RESPONSE_TYPE(td_symbol, |
| 43 |
// lsDocumentSymbolParams, |
| 44 |
// std::vector<TextDocumentDocumentSymbol::Either> ); |
| 45 |
// |
| 46 |
|
| 47 |
DEFINE_REQUEST_RESPONSE_TYPE( |
| 48 |
td_symbol, lsDocumentSymbolParams, std::vector<lsDocumentSymbol>, "textDocument/documentSymbol" |
| 49 |
); |