// Copyright 2017-2018 ccls Authors // SPDX-License-Identifier: Apache-2.0 #pragma once #include "lsp.h" #include "query.h" #include #include #include #include #include struct CompletionManager; struct GroupMatch; struct VFS; 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); }; namespace ccls { 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(CompletionManager *completion, 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, lsRequestId 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, [&](Writer &w) { Reflect(w, result); }); } void Reply(lsRequestId id, const std::function &fn); template void Reply(lsRequestId id, T &result) { Reply(id, [&](Writer &w) { Reflect(w, result); }); } void ReplyError(lsRequestId id, const std::function &fn); template void ReplyError(lsRequestId id, T &result) { ReplyError(id, [&](Writer &w) { Reflect(w, result); }); } } // namespace pipeline } // namespace ccls