| 75 | } // namespace |
| 76 | |
| 77 | void MessageHandler::textDocument_documentLink(TextDocumentParam ¶m, ReplyOnce &reply) { |
| 78 | auto [file, wf] = findOrFail(param.textDocument.uri.getPath(), reply); |
| 79 | if (!wf) |
| 80 | return; |
| 81 | |
| 82 | std::vector<DocumentLink> result; |
| 83 | int column; |
| 84 | for (const IndexInclude &include : file->def->includes) |
| 85 | if (std::optional<int> bline = wf->getBufferPosFromIndexPos(include.line, &column, false)) { |
| 86 | const std::string &line = wf->buffer_lines[*bline]; |
| 87 | auto start = line.find_first_of("\"<"), end = line.find_last_of("\">"); |
| 88 | if (start < end) |
| 89 | result.push_back( |
| 90 | {lsRange{{*bline, (int)start + 1}, {*bline, (int)end}}, DocumentUri::fromPath(include.resolved_path)}); |
| 91 | } |
| 92 | reply(result); |
| 93 | } // namespace ccls |
| 94 | |
| 95 | namespace { |
| 96 | struct DocumentSymbolParam : TextDocumentParam { |
nothing calls this directly
no test coverage detected