2018-08-21 05:27:52 +00:00
|
|
|
// Copyright 2017-2018 ccls Authors
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2017-12-24 01:30:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-06-08 04:53:41 +00:00
|
|
|
#include "lsp_diagnostic.h"
|
2018-05-28 00:50:02 +00:00
|
|
|
#include "method.h"
|
|
|
|
#include "query.h"
|
2018-05-13 16:52:19 +00:00
|
|
|
|
2018-05-28 00:50:02 +00:00
|
|
|
#include <string>
|
2018-05-13 16:52:19 +00:00
|
|
|
#include <unordered_map>
|
2018-05-28 00:50:02 +00:00
|
|
|
#include <vector>
|
2017-12-24 01:30:52 +00:00
|
|
|
|
2018-09-08 19:07:43 +00:00
|
|
|
struct CompletionManager;
|
2018-06-08 04:53:41 +00:00
|
|
|
struct GroupMatch;
|
2018-05-05 22:29:17 +00:00
|
|
|
struct VFS;
|
2017-12-29 15:52:43 +00:00
|
|
|
struct Project;
|
2017-12-24 01:30:52 +00:00
|
|
|
struct WorkingFiles;
|
2018-05-28 00:50:02 +00:00
|
|
|
struct lsBaseOutMessage;
|
2017-12-24 01:30:52 +00:00
|
|
|
|
2018-06-08 04:53:41 +00:00
|
|
|
class DiagnosticsPublisher {
|
|
|
|
std::unique_ptr<GroupMatch> match_;
|
|
|
|
int64_t nextPublish_ = 0;
|
|
|
|
int frequencyMs_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void Init();
|
|
|
|
void Publish(WorkingFiles* working_files,
|
|
|
|
std::string path,
|
|
|
|
std::vector<lsDiagnostic> diagnostics);
|
|
|
|
};
|
|
|
|
|
2018-09-08 06:40:22 +00:00
|
|
|
namespace ccls {
|
|
|
|
enum class IndexMode {
|
|
|
|
NonInteractive,
|
|
|
|
OnChange,
|
|
|
|
Normal,
|
|
|
|
};
|
2018-05-28 00:50:02 +00:00
|
|
|
|
2018-09-08 06:40:22 +00:00
|
|
|
namespace pipeline {
|
2018-09-18 01:03:59 +00:00
|
|
|
extern int64_t loaded_ts, tick;
|
2018-05-28 00:50:02 +00:00
|
|
|
void Init();
|
2018-06-01 03:06:09 +00:00
|
|
|
void LaunchStdin();
|
|
|
|
void LaunchStdout();
|
2018-09-08 23:00:14 +00:00
|
|
|
void Indexer_Main(CompletionManager *completion, VFS *vfs, Project *project,
|
|
|
|
WorkingFiles *wfiles);
|
2018-05-28 00:50:02 +00:00
|
|
|
void MainLoop();
|
|
|
|
|
2018-09-08 06:40:22 +00:00
|
|
|
void Index(const std::string &path, const std::vector<std::string> &args,
|
|
|
|
IndexMode mode, lsRequestId id = {});
|
2017-12-29 15:52:43 +00:00
|
|
|
|
2018-09-08 17:37:48 +00:00
|
|
|
std::optional<int64_t> LastWriteTime(const std::string &path);
|
|
|
|
std::optional<std::string> LoadIndexedContent(const std::string& path);
|
|
|
|
void WriteStdout(MethodType method, lsBaseOutMessage &response);
|
|
|
|
} // namespace pipeline
|
|
|
|
} // namespace ccls
|