mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Send null hover response if there is no hover.
This commit is contained in:
parent
18f602c6e8
commit
7e9db4a2da
@ -48,7 +48,7 @@ struct Out_TextDocumentHover : public lsOutMessage<Out_TextDocumentHover> {
|
||||
};
|
||||
|
||||
lsRequestId id;
|
||||
Result result;
|
||||
optional<Result> result;
|
||||
};
|
||||
MAKE_REFLECT_STRUCT(Out_TextDocumentHover::Result, contents, range);
|
||||
MAKE_REFLECT_STRUCT(Out_TextDocumentHover, jsonrpc, id, result);
|
||||
@ -75,11 +75,14 @@ struct TextDocumentHoverHandler : BaseMessageHandler<Ipc_TextDocumentHover> {
|
||||
if (!ls_range)
|
||||
continue;
|
||||
|
||||
out.result.contents.value = GetHoverForSymbol(db, ref.idx);
|
||||
out.result.contents.language = file->def->language;
|
||||
|
||||
out.result.range = *ls_range;
|
||||
break;
|
||||
std::string hover = GetHoverForSymbol(db, ref.idx);
|
||||
if (!hover.empty()) {
|
||||
out.result = Out_TextDocumentHover::Result();
|
||||
out.result->contents.value = hover;
|
||||
out.result->contents.language = file->def->language;
|
||||
out.result->range = *ls_range;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
IpcManager::WriteStdout(IpcId::TextDocumentHover, out);
|
||||
|
Loading…
Reference in New Issue
Block a user