[PATCH] D52076: [CodeComplete] Add completions for filenames in #include directives.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 00:27:01 PDT 2018


sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added a subscriber: cfe-commits.

The dir component ("somedir" in #include <somedir/fo...>) is considered fixed.
We append "foo" to each directory on the include path, and then list its files.

Completions are of the forms:
 <somedir/foo.h>
 ^-text--^^-TT-^  (TypedText)
and
 <somedir/foodir/
 ^-text--^^-TT--^

The filter is set to the filename part ("fo"), so fuzzy matching can be
applied to the filename only.

No fancy scoring/priorities are set, and no information is added to
CodeCompleteResult to make smart scoring possible. Could be in future.

Note directory iteration is currently stat-happy on unix but https://reviews.llvm.org/D51921 will fix.


Repository:
  rC Clang

https://reviews.llvm.org/D52076

Files:
  include/clang-c/Index.h
  include/clang/Lex/CodeCompletionHandler.h
  include/clang/Lex/Preprocessor.h
  include/clang/Parse/Parser.h
  include/clang/Sema/CodeCompleteConsumer.h
  include/clang/Sema/Sema.h
  lib/Frontend/ASTUnit.cpp
  lib/Lex/Lexer.cpp
  lib/Lex/Preprocessor.cpp
  lib/Parse/Parser.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/included-files.cpp
  tools/libclang/CIndexCodeCompletion.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52076.165432.patch
Type: text/x-patch
Size: 17505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180914/eec2de56/attachment-0001.bin>


More information about the cfe-commits mailing list