#include "language_server_api.h" #include "libclangmm/CompletionString.h" #include "libclangmm/Index.h" #include "libclangmm/TranslationUnit.h" #include "project.h" #include "working_files.h" #include struct CompletionSession { CompilationEntry file; // The active translation unit. std::unique_ptr active; std::unique_ptr active_index; // Updated translation unit. If |is_updated_ready| is true, then |updated| // contains more recent state than |active| and the two should be swapped. // TODO: implement this. Needs changes in Refresh and CodeComplete. //bool is_updated_ready = false; //std::unique_ptr updated; //std::unique_ptr updated_index; CompletionSession(const CompilationEntry& file, WorkingFiles* working_files); ~CompletionSession(); // Refresh file index. void Refresh(WorkingFiles* working_files); }; struct CompletionManager { std::vector> sessions; Project* project; WorkingFiles* working_files; CompletionManager(Project* project, WorkingFiles* working_files); // This all should run on complete_responder thread. This will internally run a child thread to // reparse. NonElidedVector CodeComplete(const lsTextDocumentPositionParams& completion_location); private: CompletionSession* GetOrOpenSession(const std::string& filename); };