This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add Documentations for member completions.
Needs ReviewPublic

Authored by hokein on Jan 9 2019, 7:30 AM.

Details

Summary

We are missing docs for class member completion -- we don't store
comments in the preamble, so Sema doesn't return any docs. To get docs
for class members, we rely on the index (mostly dynamic index).

Tried it on llvm, didn't get noticeble delay for the completion.

Event Timeline

hokein created this revision.Jan 9 2019, 7:30 AM
hokein updated this revision to Diff 180843.Jan 9 2019, 7:32 AM

Add a comment.

ilya-biryukov added inline comments.Jan 9 2019, 7:53 AM
clangd/CodeComplete.cpp
1373–1377

naming NIT: the loop var should be I

1375

Since we already have two variables, maybe deconstruct the pair into one of them instead of keeping a variable for a pair too? I.e.

auto &Bundle = Top[I].first;
auto &Score = Top[I].second;

should make the code a little simpler

1382

NIT: use early exits (see the LLVM Style guide) to reduce nesting here.

if (size() != 1)
  continue;
auto *SemaR = ;
if (!SemaR)
  continue;
// ...
hokein updated this revision to Diff 181009.Jan 10 2019, 1:44 AM
hokein marked 3 inline comments as done.

Address comments.

I think the design should be more thoroughly considered here.

  • what are the latency consequences of the extra index lookup in different scenarios?
  • how does this compare to doing it at LSP resolve time instead?
  • if we're going to do the extra lookup, can we make use of ranking signals from the index too?
clangd/CodeComplete.cpp
1369

I don't think we can inline this much logic into runWithSema() for each feature we add - need to find a clearer way to structure the code.

1398

If we're going to query the index again here, it seems we should do it earlier so we can use the results for ranking.

nridge added a subscriber: nridge.Nov 19 2019, 10:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2019, 10:07 PM
Herald added a subscriber: usaxena95. · View Herald Transcript