clang-tools 20.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>

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.
 
float NameMatch = 1
 0-1+ fuzzy-match score for unqualified name. Must be explicitly assigned.
 
llvm::StringSet * ContextWords = nullptr
 Lowercase words relevant to the context (e.g. near the completion point).
 
bool Forbidden = false
 
bool NeedsFixIts = false
 Whether fixits needs to be applied for that completion or not.
 
bool InBaseClass = false
 
URIDistanceFileProximityMatch = nullptr
 
llvm::StringRef SymbolURI
 These are used to calculate proximity between the index symbol and the query.
 
float SemaFileProximityScore = 0
 FIXME: unify with index proximity score - signals should be source-independent.
 
ScopeDistanceScopeProximityMatch = nullptr
 
std::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.
 
const ASTSignalsMainFileSignals = nullptr
 
unsigned MainFileRefs = 0
 Number of references to the candidate in the main file.
 
unsigned ScopeRefsInFile = 0
 Number of unique symbols in the main file which belongs to candidate's namespace.
 

Detailed Description

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

Definition at line 86 of file Quality.h.

Member Enumeration Documentation

◆ AccessibleScope

Enumerator
FunctionScope 
ClassScope 
FileScope 
GlobalScope 

Definition at line 114 of file Quality.h.

◆ QueryType

Enumerator
CodeComplete 
Generic 

Definition at line 121 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 126 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 92 of file Quality.h.

Referenced by calculateDerivedSignals().

◆ FileProximityMatch

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

Definition at line 98 of file Quality.h.

Referenced by calculateDerivedSignals().

◆ FilterLength

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

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

Definition at line 140 of file Quality.h.

◆ Forbidden

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

Definition at line 93 of file Quality.h.

Referenced by evaluateHeuristics(), and merge().

◆ HadContextType

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

Definition at line 132 of file Quality.h.

◆ HadSymbolType

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

Definition at line 134 of file Quality.h.

◆ InBaseClass

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

Definition at line 96 of file Quality.h.

Referenced by evaluateHeuristics(), and merge().

◆ IsInstanceMember

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

Definition at line 129 of file Quality.h.

Referenced by evaluateHeuristics(), and merge().

◆ MainFileRefs

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

Number of references to the candidate in the main file.

Definition at line 144 of file Quality.h.

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

◆ MainFileSignals

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

Definition at line 142 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 88 of file Quality.h.

Referenced by calculateDerivedSignals(), clang::clangd::getWorkspaceSymbols(), and clang::clangd::locateSymbolTextually().

◆ NameMatch

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

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

Definition at line 90 of file Quality.h.

Referenced by evaluateHeuristics().

◆ NeedsFixIts

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

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

Definition at line 95 of file Quality.h.

Referenced by evaluateHeuristics(), and merge().

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

Referenced by calculateDerivedSignals(), and evaluateHeuristics().

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

Referenced by evaluateHeuristics(), and merge().

◆ SemaSaysInScope

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

Definition at line 111 of file Quality.h.

Referenced by evaluateHeuristics(), and merge().

◆ SymbolScope

std::optional<llvm::StringRef> clang::clangd::SymbolRelevanceSignals::SymbolScope

Definition at line 109 of file Quality.h.

Referenced by calculateDerivedSignals(), and merge().

◆ SymbolURI

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

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

Definition at line 101 of file Quality.h.

Referenced by calculateDerivedSignals(), and merge().

◆ TypeMatchesPreferred

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

Definition at line 136 of file Quality.h.

Referenced by evaluateHeuristics().


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