clang-tools  14.0.0git
Classes | 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:
Collaboration graph
[legend]

Classes

struct  DerivedSignals
 Set of derived signals computed by calculateDerivedSignals(). More...
 

Public Types

enum  AccessibleScope { FunctionScope, ClassScope, FileScope, GlobalScope }
 
enum  QueryType { CodeComplete, Generic }
 

Public Member Functions

DerivedSignals calculateDerivedSignals () const
 
void merge (const CodeCompletionResult &SemaResult)
 
void merge (const Symbol &IndexResult)
 
void computeASTSignals (const CodeCompletionResult &SemaResult)
 
float evaluateHeuristics () 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
 
URIDistanceFileProximityMatch = 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...
 
ScopeDistanceScopeProximityMatch = 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
 
unsigned FilterLength = 0
 Length of the unqualified partial name of Symbol typed in CompletionPrefix. More...
 
const ASTSignalsMainFileSignals = nullptr
 
unsigned MainFileRefs = 0
 Number of references to the candidate in the main file. More...
 
unsigned ScopeRefsInFile = 0
 Number of unique symbols in the main file which belongs to candidate's namespace. More...
 

Detailed Description

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

Definition at line 88 of file Quality.h.

Member Enumeration Documentation

◆ AccessibleScope

Enumerator
FunctionScope 
ClassScope 
FileScope 
GlobalScope 

Definition at line 116 of file Quality.h.

◆ QueryType

Enumerator
CodeComplete 
Generic 

Definition at line 123 of file Quality.h.

Member Function Documentation

◆ calculateDerivedSignals()

SymbolRelevanceSignals::DerivedSignals clang::clangd::SymbolRelevanceSignals::calculateDerivedSignals ( ) const

◆ computeASTSignals()

void clang::clangd::SymbolRelevanceSignals::computeASTSignals ( const CodeCompletionResult &  SemaResult)

◆ evaluateHeuristics()

float clang::clangd::SymbolRelevanceSignals::evaluateHeuristics ( ) const

◆ merge() [1/2]

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

◆ merge() [2/2]

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

Member Data Documentation

◆ Context

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

Definition at line 128 of file Quality.h.

Referenced by clang::clangd::evaluateDecisionForest(), and clang::clangd::operator<<().

◆ ContextWords

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

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

Definition at line 94 of file Quality.h.

Referenced by calculateDerivedSignals(), clang::clangd::evaluateDecisionForest(), and clang::clangd::operator<<().

◆ FileProximityMatch

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

Definition at line 100 of file Quality.h.

Referenced by calculateDerivedSignals(), and clang::clangd::operator<<().

◆ FilterLength

unsigned clang::clangd::SymbolRelevanceSignals::FilterLength = 0

Length of the unqualified partial name of Symbol typed in CompletionPrefix.

Definition at line 142 of file Quality.h.

◆ Forbidden

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

◆ HadContextType

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

Definition at line 134 of file Quality.h.

Referenced by clang::clangd::evaluateDecisionForest(), and clang::clangd::operator<<().

◆ HadSymbolType

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

Definition at line 136 of file Quality.h.

Referenced by clang::clangd::evaluateDecisionForest(), and clang::clangd::operator<<().

◆ InBaseClass

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

◆ IsInstanceMember

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

◆ MainFileRefs

unsigned clang::clangd::SymbolRelevanceSignals::MainFileRefs = 0

Number of references to the candidate in the main file.

Definition at line 146 of file Quality.h.

Referenced by computeASTSignals(), evaluateHeuristics(), and merge().

◆ MainFileSignals

const ASTSignals* clang::clangd::SymbolRelevanceSignals::MainFileSignals = nullptr

Definition at line 144 of file Quality.h.

Referenced by computeASTSignals(), and merge().

◆ Name

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

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

Definition at line 90 of file Quality.h.

Referenced by calculateDerivedSignals(), clang::clangd::evaluateDecisionForest(), and clang::clangd::operator<<().

◆ NameMatch

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

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

Definition at line 92 of file Quality.h.

Referenced by clang::clangd::evaluateDecisionForest(), evaluateHeuristics(), and clang::clangd::operator<<().

◆ NeedsFixIts

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

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

Definition at line 97 of file Quality.h.

Referenced by clang::clangd::evaluateDecisionForest(), evaluateHeuristics(), merge(), and clang::clangd::operator<<().

◆ 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

◆ ScopeRefsInFile

unsigned clang::clangd::SymbolRelevanceSignals::ScopeRefsInFile = 0

Number of unique symbols in the main file which belongs to candidate's namespace.

This indicates how relevant the namespace is in the current file.

Definition at line 150 of file Quality.h.

Referenced by computeASTSignals(), evaluateHeuristics(), and merge().

◆ 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 107 of file Quality.h.

Referenced by clang::clangd::evaluateDecisionForest(), evaluateHeuristics(), merge(), and clang::clangd::operator<<().

◆ SemaSaysInScope

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

◆ SymbolScope

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

Definition at line 111 of file Quality.h.

Referenced by calculateDerivedSignals(), merge(), and clang::clangd::operator<<().

◆ SymbolURI

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

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

Definition at line 103 of file Quality.h.

Referenced by calculateDerivedSignals(), merge(), and clang::clangd::operator<<().

◆ TypeMatchesPreferred

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

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