[PATCH] D46943: [clangd] Boost scores for decls from current file in completion

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 22 08:00:28 PDT 2018


ilya-biryukov added a comment.

I've added an initial version of testing for the matching header and wanted to get feedback before proceeding further with tests and other changes.

A few things that bug me so far:

- We need to match headers of items from the index, not only from the Sema results.
- Symbols store their paths as URIs ⇒ we need to parse them in order to apply heuristics. We could avoid that by writing a version of header-matching that also works on URIs, but that would mean more complexity.
- Merging quality signals from headers now requires an extra paramater: name of the source file. I wonder if it's worth extracting builders for symbol qualities into separate classes to keep the current nice signatures, i.e. `merge(Symbol& IndexResult)`.
- How should we match the header with the main file?  Our options are:
  - (proposed by Eric) use main file regex from clang-format for that. I'm not entirely sure it suits us well, since the regex is designed to work on paths inside #include directive, but we're getting ours from the Symbols and Sema AST Decls. Moreover, it means we're gonna read .clang-format files to get that style.
  - Come up with our own heuristics. There is a similar place in ClangdServer that matches a header with source and back. We could extend those heuristics to also allow figuring out whether the paths are matching header/source. I chose this option for initial implementation, since it's less work and it seems easier to switch to clang-format's regex later.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46943





More information about the cfe-commits mailing list