diff options
| author | Eric Liu <ioeric@google.com> | 2018-10-17 11:19:02 +0000 |
|---|---|---|
| committer | Eric Liu <ioeric@google.com> | 2018-10-17 11:19:02 +0000 |
| commit | 3fac4ef1fdb4e6b2b4743f33498612c233da325d (patch) | |
| tree | f3dbf1cda024228cff98f9e00d8dbd50188144e6 /clang-tools-extra/clangd/Quality.h | |
| parent | e2566b5d877c415f128a9f3d75ef2173bf32c347 (diff) | |
| download | bcm5719-llvm-3fac4ef1fdb4e6b2b4743f33498612c233da325d.tar.gz bcm5719-llvm-3fac4ef1fdb4e6b2b4743f33498612c233da325d.zip | |
[clangd] Support scope proximity in code completion.
Summary:
This should make all-scope completion more usable. Scope proximity for
indexes will be added in followup patch.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53131
llvm-svn: 344688
Diffstat (limited to 'clang-tools-extra/clangd/Quality.h')
| -rw-r--r-- | clang-tools-extra/clangd/Quality.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/Quality.h b/clang-tools-extra/clangd/Quality.h index fda90560c43..a692917d482 100644 --- a/clang-tools-extra/clangd/Quality.h +++ b/clang-tools-extra/clangd/Quality.h @@ -28,6 +28,7 @@ #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_QUALITY_H #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_QUALITY_H +#include "FileDistance.h" #include "clang/Sema/CodeCompleteConsumer.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" @@ -87,13 +88,19 @@ struct SymbolRelevanceSignals { bool NeedsFixIts = false; URIDistance *FileProximityMatch = nullptr; - /// This is used to calculate proximity between the index symbol and the + /// These are used to calculate proximity between the index symbol and the /// query. llvm::StringRef SymbolURI; - /// Proximity between best declaration and the query. [0-1], 1 is closest. /// FIXME: unify with index proximity score - signals should be /// source-independent. - float SemaProximityScore = 0; + /// Proximity between best declaration and the query. [0-1], 1 is closest. + float SemaFileProximityScore = 0; + + // Scope proximity is only considered (both index and sema) when this is set. + ScopeDistance *ScopeProximityMatch = nullptr; + llvm::Optional<llvm::StringRef> SymbolScope; + // A symbol from sema should be accessible from the current scope. + bool SemaSaysInScope = false; // An approximate measure of where we expect the symbol to be used. enum AccessibleScope { |

