MCPcopy Create free account
hub / github.com/MaskRay/ccls / textDocument_hover

Method textDocument_hover

src/messages/textDocument_hover.cc:81–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79} // namespace
80
81void MessageHandler::textDocument_hover(TextDocumentPositionParam &param, ReplyOnce &reply) {
82 auto [file, wf] = findOrFail(param.textDocument.uri.getPath(), reply);
83 if (!wf)
84 return;
85
86 Hover result;
87 for (SymbolRef sym : findSymbolsAtLocation(wf, file, param.position)) {
88 std::optional<lsRange> ls_range = getLsRange(wfiles->getFile(file->def->path), sym.range);
89 if (!ls_range)
90 continue;
91
92 auto [hover, comments] = getHover(db, file->def->language, sym, file->id);
93 if (comments || hover) {
94 result.range = *ls_range;
95 if (comments)
96 result.contents.push_back(*comments);
97 if (hover)
98 result.contents.push_back(*hover);
99 break;
100 }
101 }
102
103 reply(result);
104}
105} // namespace ccls

Callers

nothing calls this directly

Calls 6

findSymbolsAtLocationFunction · 0.85
getLsRangeFunction · 0.85
getHoverFunction · 0.85
replyFunction · 0.85
getFileMethod · 0.80
getPathMethod · 0.45

Tested by

no test coverage detected