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>
|
||||
|
||||
void Reflect(Reader& visitor, std::variant<std::monostate, int>& version) {
|
||||
if (visitor.IsNull())
|
||||
if (visitor.IsNull()) {
|
||||
visitor.GetNull();
|
||||
version = std::monostate();
|
||||
else
|
||||
} else
|
||||
version = visitor.GetInt();
|
||||
}
|
||||
|
||||
void Reflect(Reader& visitor, lsRequestId& id) {
|
||||
if (visitor.IsInt()) {
|
||||
int v;
|
||||
Reflect(visitor, v);
|
||||
id = v;
|
||||
}
|
||||
else if (visitor.IsString()) {
|
||||
if (visitor.IsNull()) {
|
||||
visitor.GetNull();
|
||||
id = std::monostate();
|
||||
} else if (visitor.IsString()) {
|
||||
std::string v;
|
||||
Reflect(visitor, v);
|
||||
id = v;
|
||||
} else
|
||||
LOG_S(WARNING) << "Unable to deserialize id";
|
||||
} else {
|
||||
int64_t v;
|
||||
Reflect(visitor, v);
|
||||
id = v;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user