// Copyright 2017-2018 ccls Authors // SPDX-License-Identifier: Apache-2.0 #pragma once #include "lsp.hh" #include "query.hh" #include #include #include #include #include namespace ccls { struct SemaManager; struct GroupMatch; struct Project; struct WorkingFiles; struct VFS { struct State { int64_t timestamp; int step; bool loaded; }; std::unordered_map state; std::mutex mutex; void Clear(); bool Loaded(const std::string &path); bool Stamp(const std::string &path, int64_t ts, int step); }; enum class IndexMode { NonInteractive, OnChange, Normal, }; namespace pipeline { extern std::atomic loaded_ts, pending_index_requests; extern int64_t tick; void Init(); void LaunchStdin(); void LaunchStdout(); void Indexer_Main(SemaManager *manager, VFS *vfs, Project *project, WorkingFiles *wfiles); void MainLoop(); void Standalone(const std::string &root); void Index(const std::string &path, const std::vector &args, IndexMode mode, RequestId id = {}); std::optional LoadIndexedContent(const std::string& path); void Notify(const char *method, const std::function &fn); template void Notify(const char *method, T &result) { Notify(method, [&](JsonWriter &w) { Reflect(w, result); }); } void Reply(RequestId id, const std::function &fn); void ReplyError(RequestId id, const std::function &fn); template void ReplyError(RequestId id, T &result) { ReplyError(id, [&](JsonWriter &w) { Reflect(w, result); }); } } // namespace pipeline } // namespace ccls