mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-28 02:21:57 +00:00
$ccls/fileInfo: optionally dump dependencies, includes and skipped_ranges
This commit is contained in:
parent
eb752497e8
commit
0e8c9db44d
@ -262,7 +262,7 @@ private:
|
|||||||
void (MessageHandler::*handler)(Param &, ReplyOnce &));
|
void (MessageHandler::*handler)(Param &, ReplyOnce &));
|
||||||
|
|
||||||
void ccls_call(JsonReader &, ReplyOnce &);
|
void ccls_call(JsonReader &, ReplyOnce &);
|
||||||
void ccls_fileInfo(TextDocumentParam &, ReplyOnce &);
|
void ccls_fileInfo(JsonReader &, ReplyOnce &);
|
||||||
void ccls_info(EmptyParam &, ReplyOnce &);
|
void ccls_info(EmptyParam &, ReplyOnce &);
|
||||||
void ccls_inheritance(JsonReader &, ReplyOnce &);
|
void ccls_inheritance(JsonReader &, ReplyOnce &);
|
||||||
void ccls_member(JsonReader &, ReplyOnce &);
|
void ccls_member(JsonReader &, ReplyOnce &);
|
||||||
|
@ -19,8 +19,9 @@ limitations under the License.
|
|||||||
#include "query.hh"
|
#include "query.hh"
|
||||||
|
|
||||||
namespace ccls {
|
namespace ccls {
|
||||||
REFLECT_STRUCT(QueryFile::Def, path, args, language, skipped_ranges,
|
REFLECT_STRUCT(IndexInclude, line, resolved_path);
|
||||||
dependencies);
|
REFLECT_STRUCT(QueryFile::Def, path, args, language, dependencies, includes,
|
||||||
|
skipped_ranges);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
struct Out_cclsInfo {
|
struct Out_cclsInfo {
|
||||||
@ -53,7 +54,16 @@ void MessageHandler::ccls_info(EmptyParam &, ReplyOnce &reply) {
|
|||||||
reply(result);
|
reply(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageHandler::ccls_fileInfo(TextDocumentParam ¶m, ReplyOnce &reply) {
|
struct FileInfoParam : TextDocumentParam {
|
||||||
|
bool dependencies = false;
|
||||||
|
bool includes = false;
|
||||||
|
bool skipped_ranges = false;
|
||||||
|
};
|
||||||
|
REFLECT_STRUCT(FileInfoParam, textDocument, dependencies, includes, skipped_ranges);
|
||||||
|
|
||||||
|
void MessageHandler::ccls_fileInfo(JsonReader &reader, ReplyOnce &reply) {
|
||||||
|
FileInfoParam param;
|
||||||
|
Reflect(reader, param);
|
||||||
QueryFile *file = FindFile(param.textDocument.uri.GetPath());
|
QueryFile *file = FindFile(param.textDocument.uri.GetPath());
|
||||||
if (!file)
|
if (!file)
|
||||||
return;
|
return;
|
||||||
@ -63,7 +73,11 @@ void MessageHandler::ccls_fileInfo(TextDocumentParam ¶m, ReplyOnce &reply) {
|
|||||||
result.path = file->def->path;
|
result.path = file->def->path;
|
||||||
result.args = file->def->args;
|
result.args = file->def->args;
|
||||||
result.language = file->def->language;
|
result.language = file->def->language;
|
||||||
|
if (param.dependencies)
|
||||||
|
result.dependencies = file->def->dependencies;
|
||||||
|
if (param.includes)
|
||||||
result.includes = file->def->includes;
|
result.includes = file->def->includes;
|
||||||
|
if (param.skipped_ranges)
|
||||||
result.skipped_ranges = file->def->skipped_ranges;
|
result.skipped_ranges = file->def->skipped_ranges;
|
||||||
reply(result);
|
reply(result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user