MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / GetLineIndex

Method GetLineIndex

CodeFormatServer/src/VFS/VirtualFile.cpp:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31std::shared_ptr<LineIndex> VirtualFile::GetLineIndex(VirtualFileSystem &vfs) const {
32 auto &lineIndexDB = vfs.GetLineIndexDB();
33 auto &fileDB = vfs.GetFileDB();
34 auto opLineIndex = lineIndexDB.Query(_fileId);
35 if (opLineIndex.has_value()) {
36 return opLineIndex.value();
37 } else {
38 auto opText = fileDB.Query(_fileId);
39 if (opText.has_value()) {
40 auto lineIndex = std::make_shared<LineIndex>();
41 auto &text = *opText.value();
42 lineIndex->Parse(text);
43 lineIndexDB.Input(_fileId, lineIndex);
44 return lineIndex;
45 }
46 }
47 return nullptr;
48}
49
50bool VirtualFile::IsNull() const {
51 return _fileId == 0;

Callers 3

UpdateFileMethod · 0.80
OnFormattingMethod · 0.80
DiagnosticMethod · 0.80

Calls 4

QueryMethod · 0.45
valueMethod · 0.45
ParseMethod · 0.45
InputMethod · 0.45

Tested by

no test coverage detected