mirror of
https://github.com/MaskRay/ccls.git
synced 2025-04-06 00:42:09 +00:00
Delete virtual bases Reader & Writer Delete unused MAKE_REFLECT_STRUCT_WRITER_AS_ARRAY Merge serializers/{json,binary}.hh into serializer.{hh,cc} MAKE_REFLECT_STRUCT => REFLECT_STRUCT MAKE_REFLECT_TYPE_PROXY => REFLECT_UNDERLYING
59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
// Copyright 2017-2018 ccls Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#include "message_handler.hh"
|
|
#include "pipeline.hh"
|
|
#include "project.hh"
|
|
#include "query.hh"
|
|
|
|
namespace ccls {
|
|
REFLECT_STRUCT(QueryFile::Def, path, args, language, skipped_ranges,
|
|
dependencies);
|
|
|
|
namespace {
|
|
struct Out_cclsInfo {
|
|
struct DB {
|
|
int files, funcs, types, vars;
|
|
} db;
|
|
struct Pipeline {
|
|
int pendingIndexRequests;
|
|
} pipeline;
|
|
struct Project {
|
|
int entries;
|
|
} project;
|
|
};
|
|
REFLECT_STRUCT(Out_cclsInfo::DB, files, funcs, types, vars);
|
|
REFLECT_STRUCT(Out_cclsInfo::Pipeline, pendingIndexRequests);
|
|
REFLECT_STRUCT(Out_cclsInfo::Project, entries);
|
|
REFLECT_STRUCT(Out_cclsInfo, db, pipeline, project);
|
|
} // namespace
|
|
|
|
void MessageHandler::ccls_info(EmptyParam &, ReplyOnce &reply) {
|
|
Out_cclsInfo result;
|
|
result.db.files = db->files.size();
|
|
result.db.funcs = db->funcs.size();
|
|
result.db.types = db->types.size();
|
|
result.db.vars = db->vars.size();
|
|
result.pipeline.pendingIndexRequests = pipeline::pending_index_requests;
|
|
result.project.entries = 0;
|
|
for (auto &[_, folder] : project->root2folder)
|
|
result.project.entries += folder.entries.size();
|
|
reply(result);
|
|
}
|
|
|
|
void MessageHandler::ccls_fileInfo(TextDocumentParam ¶m, ReplyOnce &reply) {
|
|
QueryFile *file = FindFile(param.textDocument.uri.GetPath());
|
|
if (!file)
|
|
return;
|
|
|
|
QueryFile::Def result;
|
|
// Expose some fields of |QueryFile::Def|.
|
|
result.path = file->def->path;
|
|
result.args = file->def->args;
|
|
result.language = file->def->language;
|
|
result.includes = file->def->includes;
|
|
result.skipped_ranges = file->def->skipped_ranges;
|
|
reply(result);
|
|
}
|
|
} // namespace ccls
|