| 79 | } // namespace |
| 80 | |
| 81 | void MessageHandler::textDocument_hover(TextDocumentPositionParam ¶m, 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 |
nothing calls this directly
no test coverage detected