mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 08:05:07 +00:00
786ac0bc4f
Also try to more aggressively load FileContents when indexing to increase reliability.
24 lines
541 B
C++
24 lines
541 B
C++
#pragma once
|
|
|
|
#include "position.h"
|
|
|
|
#include "optional.h"
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
struct FileContents {
|
|
FileContents();
|
|
FileContents(const std::string& path, const std::string& content);
|
|
|
|
optional<int> ToOffset(Position p) const;
|
|
optional<std::string> ContentsInRange(Range range) const;
|
|
|
|
std::string path;
|
|
std::string content;
|
|
// {0, 1 + position of first newline, 1 + position of second newline, ...}
|
|
std::vector<int> line_offsets_;
|
|
};
|
|
|
|
using FileContentsMap = std::unordered_map<std::string, FileContents>;
|