2017-03-26 06:47:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "language_server_api.h"
|
|
|
|
|
2017-03-26 21:40:34 +00:00
|
|
|
#include <clang-c/Index.h>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
struct WorkingFile {
|
|
|
|
std::string filename;
|
|
|
|
std::string content;
|
|
|
|
|
|
|
|
WorkingFile(const std::string& filename, const std::string& content);
|
|
|
|
|
|
|
|
CXUnsavedFile AsUnsavedFile() const;
|
|
|
|
};
|
|
|
|
|
2017-03-26 06:47:59 +00:00
|
|
|
struct WorkingFiles {
|
2017-03-26 21:40:34 +00:00
|
|
|
// Find the file with the given filename.
|
|
|
|
WorkingFile* GetFileByFilename(const std::string& filename);
|
|
|
|
void OnOpen(const Ipc_TextDocumentDidOpen::Params& open);
|
|
|
|
void OnChange(const Ipc_TextDocumentDidChange::Params& change);
|
|
|
|
void OnClose(const Ipc_TextDocumentDidClose::Params& close);
|
|
|
|
|
|
|
|
std::vector<CXUnsavedFile> AsUnsavedFiles() const;
|
2017-03-26 06:47:59 +00:00
|
|
|
|
2017-03-26 21:40:34 +00:00
|
|
|
// Use unique_ptrs so we can handout WorkingFile ptrs and not have them
|
|
|
|
// invalidated if we resize files.
|
|
|
|
std::vector<std::unique_ptr<WorkingFile>> files;
|
2017-03-26 06:47:59 +00:00
|
|
|
};
|