This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix filename completion at the end of file
ClosedPublic

Authored by kadircet on Jan 25 2021, 10:10 PM.

Diff Detail

Event Timeline

kadircet created this revision.Jan 25 2021, 10:10 PM
kadircet requested review of this revision.Jan 25 2021, 10:10 PM
sammccall accepted this revision.Jan 26 2021, 12:22 AM
sammccall added a subscriber: sammccall.

Thanks for puzzling this one out, i thought it would be in lexer...

clang-tools-extra/clangd/CodeComplete.cpp
1127

"include the following byte" doesn't match my mental model, which is that we're on the boundary, and are choosing whether to resolve left out right, i.e *guessing* whether inserted text will become part of the preamble or the main file.

(Of course everyone has their own mental model - but if that seems clearer to you too, maybe reword)

clearer might be:

if (Offset < Size || (!EndsInNewline && Offset == Size))

May not even need the comment in this case, up to you

This revision is now accepted and ready to land.Jan 26 2021, 12:22 AM
kadircet updated this revision to Diff 319229.Jan 26 2021, 12:45 AM
kadircet marked an inline comment as done.
  • Rewrite the condition as suggested
This revision was landed with ongoing or failed builds.Jan 26 2021, 12:46 AM
This revision was automatically updated to reflect the committed changes.