clang-tools 10.0.0

Public Types | Public Member Functions | Public Attributes | List of all members
clang::clangd::SymbolRelevanceSignals Struct Reference

Attributes of a symbol-query pair that affect how much we like it. More...

`#include <Quality.h>`

Collaboration diagram for clang::clangd::SymbolRelevanceSignals:
[legend]

## Public Types
enum | AccessibleScope { FunctionScope, ClassScope, FileScope, GlobalScope }
enum | QueryType { CodeComplete, Generic }

## Public Member Functions
void | merge (const CodeCompletionResult &SemaResult)
void | merge (const Symbol &IndexResult)
float | evaluate () const

## Public Attributes
llvm::StringRef | Name
| The name of the symbol (for ContextWords). Must be explicitly assigned. More...
float | NameMatch = 1
| 0-1+ fuzzy-match score for unqualified name. Must be explicitly assigned. More...
llvm::StringSet * | ContextWords = nullptr
| Lowercase words relevant to the context (e.g. near the completion point). More...
bool | Forbidden = false
bool | NeedsFixIts = false
| Whether fixits needs to be applied for that completion or not. More...
bool | InBaseClass = false
URIDistance * | FileProximityMatch = nullptr
llvm::StringRef | SymbolURI
| These are used to calculate proximity between the index symbol and the query. More...
float | SemaFileProximityScore = 0
| FIXME: unify with index proximity score - signals should be source-independent. More...
ScopeDistance * | ScopeProximityMatch = nullptr
llvm::Optional< llvm::StringRef > | SymbolScope
bool | SemaSaysInScope = false
enum clang::clangd::SymbolRelevanceSignals::AccessibleScope | Scope = GlobalScope
enum clang::clangd::SymbolRelevanceSignals::QueryType | Query = Generic
CodeCompletionContext::Kind | Context = CodeCompletionContext::CCC_Other
bool | IsInstanceMember = false
bool | HadContextType = false
bool | HadSymbolType = false
bool | TypeMatchesPreferred = false

## Detailed Description

Attributes of a symbol-query pair that affect how much we like it.

Definition at line 87 of file Quality.h.

## Member Enumeration Documentation

## ◆ AccessibleScope

enum clang::clangd::SymbolRelevanceSignals::AccessibleScope

Enumerator
FunctionScope |
ClassScope |
FileScope |
GlobalScope |

Definition at line 115 of file Quality.h.

## ◆ QueryType

enum clang::clangd::SymbolRelevanceSignals::QueryType

Enumerator
CodeComplete |
Generic |

Definition at line 122 of file Quality.h.

## Member Function Documentation

## ◆ evaluate()

float clang::clangd::SymbolRelevanceSignals::evaluate | ( |  | ) | const

Definition at line 347 of file Quality.cpp.

References Name, clang::clangd::scopeBoost(), Score, clang::clangd::uriProximity(), and clang::clangd::wordMatching().

## ◆ merge() [1/2]

void clang::clangd::SymbolRelevanceSignals::merge | ( | const CodeCompletionResult & | SemaResult | ) |

Definition at line 293 of file Quality.cpp.

References clang::clangd::computeScope(), clang::clangd::hasDeclInMainFile(), clang::clangd::hasUsingDeclInMainFile(), and clang::clangd::isInstanceMember().

## ◆ merge() [2/2]

void clang::clangd::SymbolRelevanceSignals::merge | ( | const Symbol & | IndexResult | ) |

Definition at line 284 of file Quality.cpp.

References clang::clangd::Symbol::CanonicalDeclaration, clang::clangd::SymbolLocation::FileURI, clang::clangd::Symbol::Flags, clang::clangd::isInstanceMember(), clang::clangd::Symbol::Scope, clang::clangd::Symbol::SymInfo, and clang::clangd::Symbol::VisibleOutsideFile.

## Member Data Documentation

## ◆ Context

CodeCompletionContext::Kind clang::clangd::SymbolRelevanceSignals::Context = CodeCompletionContext::CCC_Other

Definition at line 127 of file Quality.h.

## ◆ ContextWords

llvm::StringSet* clang::clangd::SymbolRelevanceSignals::ContextWords = nullptr

Lowercase words relevant to the context (e.g. near the completion point).

Definition at line 93 of file Quality.h.

## ◆ FileProximityMatch

URIDistance* clang::clangd::SymbolRelevanceSignals::FileProximityMatch = nullptr

Definition at line 99 of file Quality.h.

## ◆ Forbidden

bool clang::clangd::SymbolRelevanceSignals::Forbidden = false

Definition at line 94 of file Quality.h.

## ◆ HadContextType

bool clang::clangd::SymbolRelevanceSignals::HadContextType = false

Definition at line 133 of file Quality.h.

## ◆ HadSymbolType

bool clang::clangd::SymbolRelevanceSignals::HadSymbolType = false

Definition at line 135 of file Quality.h.

## ◆ InBaseClass

bool clang::clangd::SymbolRelevanceSignals::InBaseClass = false

Definition at line 97 of file Quality.h.

## ◆ IsInstanceMember

bool clang::clangd::SymbolRelevanceSignals::IsInstanceMember = false

Definition at line 130 of file Quality.h.

## ◆ Name

llvm::StringRef clang::clangd::SymbolRelevanceSignals::Name

The name of the symbol (for ContextWords). Must be explicitly assigned.

Definition at line 89 of file Quality.h.

## ◆ NameMatch

float clang::clangd::SymbolRelevanceSignals::NameMatch = 1

0-1+ fuzzy-match score for unqualified name. Must be explicitly assigned.

Definition at line 91 of file Quality.h.

## ◆ NeedsFixIts

bool clang::clangd::SymbolRelevanceSignals::NeedsFixIts = false

Whether fixits needs to be applied for that completion or not.

Definition at line 96 of file Quality.h.

## ◆ Query

enum clang::clangd::SymbolRelevanceSignals::QueryType clang::clangd::SymbolRelevanceSignals::Query = Generic

## ◆ Scope

enum clang::clangd::SymbolRelevanceSignals::AccessibleScope clang::clangd::SymbolRelevanceSignals::Scope = GlobalScope

## ◆ ScopeProximityMatch

ScopeDistance* clang::clangd::SymbolRelevanceSignals::ScopeProximityMatch = nullptr

Definition at line 109 of file Quality.h.

## ◆ SemaFileProximityScore

float clang::clangd::SymbolRelevanceSignals::SemaFileProximityScore = 0

FIXME: unify with index proximity score - signals should be source-independent.

Proximity between best declaration and the query. [0-1], 1 is closest.

Definition at line 106 of file Quality.h.

## ◆ SemaSaysInScope

bool clang::clangd::SymbolRelevanceSignals::SemaSaysInScope = false

Definition at line 112 of file Quality.h.

## ◆ SymbolScope

llvm::Optional<llvm::StringRef> clang::clangd::SymbolRelevanceSignals::SymbolScope

Definition at line 110 of file Quality.h.

## ◆ SymbolURI

llvm::StringRef clang::clangd::SymbolRelevanceSignals::SymbolURI

These are used to calculate proximity between the index symbol and the query.

Definition at line 102 of file Quality.h.

## ◆ TypeMatchesPreferred

bool clang::clangd::SymbolRelevanceSignals::TypeMatchesPreferred = false

Definition at line 137 of file Quality.h.

The documentation for this struct was generated from the following files:

- Quality.h
- Quality.cpp