mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-24 00:25:07 +00:00
Set RetainCommentsFromSystemHeaders to true
Note with -fretain-comments-from-system-headers, the .gch of bits/stdc++.h becomes larger by 1%, but that is fine. And improve comment handling in textDocument/hover Fix #373
This commit is contained in:
parent
b69f62c2bc
commit
99930623ef
@ -1238,8 +1238,8 @@ Index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
|
||||
ok = false;
|
||||
// -fparse-all-comments enables documentation in the indexer and in
|
||||
// code completion.
|
||||
if (g_config->index.comments > 1)
|
||||
CI->getLangOpts()->CommentOpts.ParseAllComments = true;
|
||||
CI->getLangOpts()->CommentOpts.ParseAllComments = g_config->index.comments > 1;
|
||||
CI->getLangOpts()->RetainCommentsFromSystemHeaders = true;
|
||||
std::string buf = wfiles->GetContent(main);
|
||||
std::vector<std::unique_ptr<llvm::MemoryBuffer>> Bufs;
|
||||
if (buf.size())
|
||||
|
@ -60,8 +60,11 @@ GetHover(DB *db, LanguageId lang, SymbolRef sym, int file_id) {
|
||||
std::optional<MarkedString> ls_comments, hover;
|
||||
WithEntity(db, sym, [&](const auto &entity) {
|
||||
for (auto &d : entity.def) {
|
||||
if (!comments && d.comments[0])
|
||||
comments = d.comments;
|
||||
if (d.spell) {
|
||||
comments = d.comments[0] ? d.comments : nullptr;
|
||||
if (d.comments[0])
|
||||
comments = d.comments;
|
||||
if (const char *s =
|
||||
d.hover[0] ? d.hover
|
||||
: d.detailed_name[0] ? d.detailed_name : nullptr) {
|
||||
@ -76,8 +79,6 @@ GetHover(DB *db, LanguageId lang, SymbolRef sym, int file_id) {
|
||||
}
|
||||
if (!hover && entity.def.size()) {
|
||||
auto &d = entity.def[0];
|
||||
if (d.comments[0])
|
||||
comments = d.comments;
|
||||
hover = {LanguageIdentifier(lang)};
|
||||
if (d.hover[0])
|
||||
hover->value = d.hover;
|
||||
|
@ -363,6 +363,7 @@ void BuildPreamble(Session &session, CompilerInvocation &CI,
|
||||
CI.getDiagnosticOpts().IgnoreWarnings = false;
|
||||
CI.getFrontendOpts().SkipFunctionBodies = true;
|
||||
CI.getLangOpts()->CommentOpts.ParseAllComments = g_config->index.comments > 1;
|
||||
CI.getLangOpts()->RetainCommentsFromSystemHeaders = true;
|
||||
|
||||
StoreDiags DC(task.path);
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> DE =
|
||||
|
Loading…
Reference in New Issue
Block a user