summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Quality.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/Quality.h')
-rw-r--r--clang-tools-extra/clangd/Quality.h24
1 files changed, 2 insertions, 22 deletions
diff --git a/clang-tools-extra/clangd/Quality.h b/clang-tools-extra/clangd/Quality.h
index fef039a3a2f..a18ede3c039 100644
--- a/clang-tools-extra/clangd/Quality.h
+++ b/clang-tools-extra/clangd/Quality.h
@@ -38,6 +38,7 @@ namespace clang {
class CodeCompletionResult;
namespace clangd {
struct Symbol;
+class URIDistance;
// Signals structs are designed to be aggregated from 0 or more sources.
// A default instance has neutral signals, and sources are merged into it.
@@ -69,15 +70,13 @@ struct SymbolQualitySignals {
llvm::raw_ostream &operator<<(llvm::raw_ostream &,
const SymbolQualitySignals &);
-class FileProximityMatcher;
-
/// Attributes of a symbol-query pair that affect how much we like it.
struct SymbolRelevanceSignals {
/// 0-1+ fuzzy-match score for unqualified name. Must be explicitly assigned.
float NameMatch = 1;
bool Forbidden = false; // Unavailable (e.g const) or inaccessible (private).
- const FileProximityMatcher *FileProximityMatch = nullptr;
+ URIDistance *FileProximityMatch = nullptr;
/// This is used to calculate proximity between the index symbol and the
/// query.
llvm::StringRef SymbolURI;
@@ -111,25 +110,6 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &,
/// Combine symbol quality and relevance into a single score.
float evaluateSymbolAndRelevance(float SymbolQuality, float SymbolRelevance);
-class FileProximityMatcher {
- public:
- /// \p ProximityPaths are used to compute proximity scores from symbol's
- /// declaring file. The best score will be used.
- explicit FileProximityMatcher(
- llvm::ArrayRef<llvm::StringRef> ProximityPaths);
-
- /// Calculates the best proximity score from proximity paths to the symbol's
- /// URI. Score is [0-1], 1 means \p SymbolURI exactly matches a proximity
- /// path. When a path cannot be encoded into the same scheme as \p
- /// SymbolURI, the proximity will be 0.
- float uriProximity(llvm::StringRef SymbolURI) const;
-
- private:
- llvm::SmallVector<std::string, 2> ProximityPaths;
- friend llvm::raw_ostream &operator<<(llvm::raw_ostream &,
- const FileProximityMatcher &);
-};
-
/// TopN<T> is a lossy container that preserves only the "best" N elements.
template <typename T, typename Compare = std::greater<T>> class TopN {
public:
OpenPOWER on IntegriCloud