This commit is contained in:
Jacob Dufault 2017-03-25 13:40:04 -07:00
parent 38acb8c1a1
commit c4a9590398
3 changed files with 26 additions and 62 deletions

View File

@ -165,7 +165,7 @@ struct IpcMessage_Cout : public BaseIpcMessage<IpcMessage_Cout> {
std::string content;
IpcMessage_Cout() {}
IpcMessage_Cout(OutMessage& message) {
IpcMessage_Cout(lsOutMessage& message) {
std::ostringstream out;
message.Send(out);
content = out.str();
@ -176,7 +176,7 @@ void Reflect(TVisitor& visitor, IpcMessage_Cout& value) {
Reflect(visitor, value.content);
}
void SendOutMessageToClient(IpcMessageQueue* queue, OutMessage& response) {
void SendOutMessageToClient(IpcMessageQueue* queue, lsOutMessage& response) {
IpcMessage_Cout out(response);
queue->SendMessage(&queue->for_client, IpcMessage_Cout::kMethod, out);
}
@ -186,7 +186,7 @@ void SendOutMessageToClient(IpcMessageQueue* queue, OutMessage& response) {
template<typename T>
void RegisterId(IpcMessageQueue* t) {
t->RegisterId(T::kMethod,
[](Writer& visitor, lsBaseMessage& message) {
[](Writer& visitor, InMessage& message) {
T& m = static_cast<T&>(message);
Reflect(visitor, m);
}, [](Reader& visitor) {

View File

@ -338,14 +338,7 @@ struct IndexedTypeDef {
}
};
namespace std {
template <>
struct hash<IndexedTypeDef> {
size_t operator()(const IndexedTypeDef& k) const {
return hash<string>()(k.def.usr);
}
};
}
MAKE_HASHABLE(IndexedTypeDef, t.def.usr);
template <typename TypeId = TypeId,
typename FuncId = FuncId,
@ -446,15 +439,7 @@ struct IndexedFuncDef {
return def.usr < other.def.usr;
}
};
namespace std {
template <>
struct hash<IndexedFuncDef> {
size_t operator()(const IndexedFuncDef& k) const {
return hash<string>()(k.def.usr);
}
};
}
MAKE_HASHABLE(IndexedFuncDef, t.def.usr);
template <typename TypeId = TypeId,
typename FuncId = FuncId,
@ -530,15 +515,7 @@ struct IndexedVarDef {
return def.usr < other.def.usr;
}
};
namespace std {
template <>
struct hash<IndexedVarDef> {
size_t operator()(const IndexedVarDef& k) const {
return hash<string>()(k.def.usr);
}
};
}
MAKE_HASHABLE(IndexedVarDef, t.def.usr);
struct IdCache {
std::unordered_map<std::string, FileId> file_path_to_file_id;

View File

@ -187,9 +187,7 @@ MessageRegistry* MessageRegistry::instance() {
return instance_;
}
struct lsBaseMessage {};
struct InMessage : public lsBaseMessage {
struct InMessage {
const lsMethodId method_id;
InMessage(lsMethodId method_id) : method_id(method_id) {}
};
@ -202,7 +200,7 @@ struct InNotificationMessage : public InMessage {
InNotificationMessage(lsMethodId method) : InMessage(method) {}
};
struct OutMessage : public lsBaseMessage {
struct lsOutMessage {
// Write out the body of the message. The writer expects object key/value
// pairs.
virtual void WriteMessageBody(Writer& writer) = 0;
@ -224,7 +222,7 @@ struct OutMessage : public lsBaseMessage {
}
};
struct OutRequestMessage : public OutMessage {
struct OutRequestMessage : public lsOutMessage {
RequestId id;
virtual std::string Method() = 0;
@ -281,7 +279,7 @@ struct lsResponseError {
}
};
struct OutResponseMessage : public OutMessage {
struct OutResponseMessage : public lsOutMessage {
RequestId id;
virtual optional<lsResponseError> Error() {
@ -307,7 +305,7 @@ struct OutResponseMessage : public OutMessage {
}
};
struct OutNotificationMessage : public OutMessage {
struct OutNotificationMessage : public lsOutMessage {
virtual std::string Method() = 0;
virtual void SerializeParams(Writer& writer) = 0;
@ -1028,20 +1026,6 @@ void Reflect(TVisitor& visitor, lsInitializeParams& value) {
}
#if false
/**
* Known error codes for an `InitializeError`;
*/
export namespace lsInitializeError {
/**
* If the protocol version provided by the client can't be handled by the server.
* @deprecated This initialize error got replaced by client capabilities. There is
* no version handshake in version 3.0x
*/
export const unknownProtocolVersion : number = 1;
}
#endif
struct lsInitializeError {
// Indicates whether the client should retry to send the
// initilize request after showing the message provided
@ -1071,8 +1055,11 @@ enum class lsTextDocumentSyncKind {
Incremental = 2
};
void Reflect(Writer& writer, lsTextDocumentSyncKind& value) {
writer.Int(static_cast<int>(value));
template<typename TVisitor>
void Reflect(TVisitor& visitor, lsTextDocumentSyncKind& value) {
int value0 = static_cast<int>(value);
Reflect(visitor, value0);
value = static_cast<lsTextDocumentSyncKind>(value0);
}
// Completion options.