| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "LibLsp/lsp/lsDocumentUri.h" |
| 4 |
#include "LibLsp/lsp/lsAny.h" |
| 5 |
#include "lsClientCapabilities.h" |
| 6 |
#include "LibLsp/lsp/workspace/workspaceFolders.h" |
| 7 |
|
| 8 |
struct ClientInfo |
| 9 |
{ |
| 10 |
std::string name; |
| 11 |
optional<std::string> version; |
| 12 |
|
| 13 |
MAKE_SWAP_METHOD(ClientInfo, name, version); |
| 14 |
}; |
| 15 |
MAKE_REFLECT_STRUCT(ClientInfo, name, version); |
| 16 |
|
| 17 |
struct lsInitializeParams |
| 18 |
{ |
| 19 |
// The process Id of the parent process that started |
| 20 |
// the server. Is null if the process has not been started by another process. |
| 21 |
// If the parent process is not alive then the server should exit (see exit |
| 22 |
// notification) its process. |
| 23 |
optional<int> processId; |
| 24 |
|
| 25 |
/** |
| 26 |
* Information about the client |
| 27 |
* |
| 28 |
* @since 3.15.0 |
| 29 |
*/ |
| 30 |
optional<ClientInfo> clientInfo; |
| 31 |
/** |
| 32 |
* The locale the client is currently showing the user interface |
| 33 |
* in. This must not necessarily be the locale of the operating |
| 34 |
* system. |
| 35 |
* |
| 36 |
* Uses IETF language tags as the value's syntax |
| 37 |
* (See https://en.wikipedia.org/wiki/IETF_language_tag) |
| 38 |
* |
| 39 |
* @since 3.16.0 |
| 40 |
*/ |
| 41 |
optional<std::string> locale; |
| 42 |
|
| 43 |
// The rootPath of the workspace. Is null |
| 44 |
// if no folder is open. |
| 45 |
// |
| 46 |
// @deprecated in favour of rootUri. |
| 47 |
optional<std::string> rootPath; |
| 48 |
|
| 49 |
// The rootUri of the workspace. Is null if no |
| 50 |
// folder is open. If both `rootPath` and `rootUri` are set |
| 51 |
// `rootUri` wins. |
| 52 |
optional<lsDocumentUri> rootUri; |
| 53 |
|
| 54 |
// User provided initialization options. |
| 55 |
optional<lsp::Any> initializationOptions; |
| 56 |
|
| 57 |
// The capabilities provided by the client (editor or tool) |
| 58 |
lsClientCapabilities capabilities; |
| 59 |
|
| 60 |
/** |
| 61 |
* An optional extension to the protocol. |
| 62 |
* To tell the server what client (editor) is talking to it. |
| 63 |
*/ |
| 64 |
// @Deprecated |
| 65 |
optional<std::string> clientName; |
| 66 |
|
| 67 |
enum class lsTrace |
| 68 |
{ |
| 69 |
// NOTE: serialized as a string, one of 'off' | 'messages' | 'verbose'; |
| 70 |
Off, // off |
| 71 |
Messages, // messages |
| 72 |
Verbose // verbose |
| 73 |
}; |
| 74 |
|
| 75 |
// The initial trace setting. If omitted trace is disabled ('off'). |
| 76 |
lsTrace trace = lsTrace::Off; |
| 77 |
|
| 78 |
/** |
| 79 |
* The workspace folders configured in the client when the server starts. |
| 80 |
* This property is only available if the client supports workspace folders. |
| 81 |
* It can be `null` if the client supports workspace folders but none are |
| 82 |
* configured. |
| 83 |
* |
| 84 |
* Since 3.6.0 |
| 85 |
*/ |
| 86 |
optional<std::vector<WorkspaceFolder>> workspaceFolders; |
| 87 |
|
| 88 |
MAKE_SWAP_METHOD( |
| 89 |
lsInitializeParams, processId, rootPath, rootUri, initializationOptions, capabilities, clientName, clientInfo, |
| 90 |
trace, workspaceFolders, locale |
| 91 |
) |
| 92 |
}; |
| 93 |
|
| 94 |
void Reflect(Reader& reader, lsInitializeParams::lsTrace& value); |
| 95 |
|
| 96 |
void Reflect(Writer& writer, lsInitializeParams::lsTrace& value); |
| 97 |
|
| 98 |
MAKE_REFLECT_STRUCT( |
| 99 |
lsInitializeParams, processId, rootPath, rootUri, initializationOptions, capabilities, clientName, clientInfo, |
| 100 |
trace, workspaceFolders, locale |
| 101 |
) |
| 102 |
|
| 103 |
struct lsInitializeError |
| 104 |
{ |
| 105 |
// Indicates whether the client should retry to send the |
| 106 |
// initilize request after showing the message provided |
| 107 |
// in the ResponseError. |
| 108 |
bool retry; |
| 109 |
void swap(lsInitializeError& arg) noexcept |
| 110 |
{ |
| 111 |
auto tem = retry; |
| 112 |
retry = arg.retry; |
| 113 |
arg.retry = tem; |
| 114 |
} |
| 115 |
}; |
| 116 |
MAKE_REFLECT_STRUCT(lsInitializeError, retry); |