Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Added check for invalid utf8 doc string and cleaning #31

Merged
merged 1 commit into from
Nov 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/index/LSIFSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ void writeHoverResult(LSIFMeta &Meta, const clang::clangd::Symbol &Sym,

JSONOut.attribute("value", OHover.str());
});
if (Sym.Documentation.data() && !Sym.Documentation.empty())
JSONOut.value(Sym.Documentation);
if (Sym.Documentation.data() && !Sym.Documentation.empty()) {
auto docString = Sym.Documentation;
if(!llvm::json::isUTF8(docString)) {
docString = llvm::StringRef(llvm::json::fixUTF8(Sym.Documentation));
}
JSONOut.value(docString);
}
});
});
});
Expand Down