mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 17:41:58 +00:00
using lsRequestId = std::variant<std::monostate, int64_t, std::string>;
Emacs lsp-mode uses (gethash "id" json-data) to handle asynchronous requests. The JavaScript `Number` type is really a hindrance.
This commit is contained in:
parent
38bfd26750
commit
a8d403426d
@ -8,24 +8,26 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
void Reflect(Reader& visitor, std::variant<std::monostate, int>& version) {
|
void Reflect(Reader& visitor, std::variant<std::monostate, int>& version) {
|
||||||
if (visitor.IsNull())
|
if (visitor.IsNull()) {
|
||||||
|
visitor.GetNull();
|
||||||
version = std::monostate();
|
version = std::monostate();
|
||||||
else
|
} else
|
||||||
version = visitor.GetInt();
|
version = visitor.GetInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Reflect(Reader& visitor, lsRequestId& id) {
|
void Reflect(Reader& visitor, lsRequestId& id) {
|
||||||
if (visitor.IsInt()) {
|
if (visitor.IsNull()) {
|
||||||
int v;
|
visitor.GetNull();
|
||||||
Reflect(visitor, v);
|
id = std::monostate();
|
||||||
id = v;
|
} else if (visitor.IsString()) {
|
||||||
}
|
|
||||||
else if (visitor.IsString()) {
|
|
||||||
std::string v;
|
std::string v;
|
||||||
Reflect(visitor, v);
|
Reflect(visitor, v);
|
||||||
id = v;
|
id = v;
|
||||||
} else
|
} else {
|
||||||
LOG_S(WARNING) << "Unable to deserialize id";
|
int64_t v;
|
||||||
|
Reflect(visitor, v);
|
||||||
|
id = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageRegistry* MessageRegistry::instance_ = nullptr;
|
MessageRegistry* MessageRegistry::instance_ = nullptr;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
using lsRequestId = std::variant<std::monostate, double, std::string>;
|
using lsRequestId = std::variant<std::monostate, int64_t, std::string>;
|
||||||
void Reflect(Reader& visitor, lsRequestId& id);
|
void Reflect(Reader& visitor, lsRequestId& id);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user