clang-tools 24.0.0git
clang::clangd::Config Struct Reference

Settings that express user/project preferences and control clangd behavior. More...

#include <Config.h>

Classes

struct  CDBSearchSpec
struct  ExternalIndexSpec
 Describes an external index configuration. More...

Public Types

enum class  BuiltinHeaderPolicy { Clangd , QueryDriver }
enum class  BackgroundPolicy { Build , Skip }
enum class  IncludesPolicy { Strict , None }
enum class  FastCheckPolicy { Strict , Loose , None }
enum class  ArgumentListsPolicy { None , OpenDelimiter , Delimiters , FullPlaceholders }
 controls the completion options for argument lists. More...
enum class  HeaderInsertionPolicy { IWYU , NeverInsert }
enum class  CodePatternsPolicy { All , None }
enum class  MacroFilterPolicy { ExactPrefix , FuzzyMatch }
enum class  CommentFormatPolicy { PlainText , Markdown , Doxygen }

Public Member Functions

 Config ()=default
 Config (const Config &)=delete
Config & operator= (const Config &)=delete
 Config (Config &&)=default
Config & operator= (Config &&)=default

Static Public Member Functions

static const Config & current ()
 Returns the Config of the current Context, or an empty configuration.

Public Attributes

struct { 
   std::vector< llvm::unique_function< void(std::vector< std::string > &) const > >   Edits 
 Edits to apply to the compile command, in sequence. More...
   CDBSearchSpec   CDBSearch = {CDBSearchSpec::Ancestors, std::nullopt} 
 Where to search for compilation databases for this file's flags. More...
   BuiltinHeaderPolicy   BuiltinHeaders = BuiltinHeaderPolicy::Clangd 
 Whether to use clangd's own builtin headers, or ones from the system include extractor, if available. More...
} CompileFlags
 Controls how the compile command for the current file is determined.
struct { 
   BackgroundPolicy   Background = BackgroundPolicy::Build 
 Whether this TU should be background-indexed. More...
   ExternalIndexSpec   External 
   bool   StandardLibrary = true 
} Index
 Controls index behavior.
struct { 
   bool   SuppressAll = false 
   llvm::StringSet   Suppress 
   struct { 
      std::string   Checks 
      llvm::StringMap< std::string >   CheckOptions 
      FastCheckPolicy   FastCheckFilter = FastCheckPolicy::Strict 
      bool   ExperimentalCustomChecks = false 
   }   ClangTidy
 Configures what clang-tidy checks to run and options to use with them. More...
   IncludesPolicy   UnusedIncludes = IncludesPolicy::Strict 
   IncludesPolicy   MissingIncludes = IncludesPolicy::None 
   struct { 
      std::vector< std::function< bool(llvm::StringRef)> >   IgnoreHeader 
 IncludeCleaner will not diagnose usages of these headers matched by these regexes. More...
      bool   AnalyzeAngledIncludes = false 
   }   Includes
} Diagnostics
 Controls warnings and errors when parsing code.
struct { 
   std::vector< std::string >   FullyQualifiedNamespaces 
   std::vector< std::function< bool(llvm::StringRef)> >   QuotedHeaders 
   std::vector< std::function< bool(llvm::StringRef)> >   AngledHeaders 
} Style
 Style of the codebase.
struct { 
   bool   AllScopes = true 
 Whether code completion includes results that are not visible in current scopes. More...
   ArgumentListsPolicy   ArgumentLists = ArgumentListsPolicy::FullPlaceholders 
 controls the completion options for argument lists. More...
   HeaderInsertionPolicy   HeaderInsertion = HeaderInsertionPolicy::IWYU 
 Controls if headers should be inserted when completions are accepted. More...
   CodePatternsPolicy   CodePatterns = CodePatternsPolicy::All 
 Enables code patterns & snippets suggestions. More...
   MacroFilterPolicy   MacroFilter = MacroFilterPolicy::ExactPrefix 
 Controls how macros are filtered. More...
} Completion
 Configures code completion feature.
struct { 
   bool   ShowAKA = true 
 Whether hover show a.k.a type. More...
   uint32_t   MacroContentsLimit = 2048 
 Limit the number of characters returned when hovering a macro; 0 is no limit. More...
} Hover
 Configures hover feature.
struct { 
   bool   Enabled = true 
 If false, inlay hints are completely disabled. More...
   bool   Parameters = true 
   bool   DeducedTypes = true 
   bool   Designators = true 
   bool   BlockEnd = false 
   bool   DefaultArguments = false 
   uint32_t   TypeNameLimit = 32 
} InlayHints
struct { 
   std::vector< std::string >   DisabledKinds 
 Controls highlighting kinds that are disabled. More...
   std::vector< std::string >   DisabledModifiers 
 Controls highlighting modifiers that are disabled. More...
} SemanticTokens
struct { 
   CommentFormatPolicy   CommentFormat = CommentFormatPolicy::PlainText 
} Documentation

Static Public Attributes

static clangd::Key< Config > Key
 Context key which can be used to set the current Config.

Detailed Description

Settings that express user/project preferences and control clangd behavior.

Generally, features should consume Config::current() and the caller is responsible for setting it appropriately. In practice these callers are ClangdServer, TUScheduler, and BackgroundQueue.

Definition at line 45 of file Config.h.

Member Enumeration Documentation

◆ ArgumentListsPolicy

controls the completion options for argument lists.

Enumerator
None 

nothing, no argument list and also NO Delimiters "()" or "<>".

OpenDelimiter 

open, only opening delimiter "(" or "<".

Delimiters 

empty pair of delimiters "()" or "<>".

FullPlaceholders 

full name of both type and variable.

Definition at line 141 of file Config.h.

◆ BackgroundPolicy

Enumerator
Build 
Skip 

Definition at line 77 of file Config.h.

◆ BuiltinHeaderPolicy

Enumerator
Clangd 
QueryDriver 

Definition at line 63 of file Config.h.

◆ CodePatternsPolicy

Enumerator
All 
None 

Definition at line 157 of file Config.h.

◆ CommentFormatPolicy

Enumerator
PlainText 

Treat comments as plain text.

Markdown 

Treat comments as Markdown.

Doxygen 

Treat comments as doxygen.

Definition at line 213 of file Config.h.

◆ FastCheckPolicy

Enumerator
Strict 
Loose 
None 

Definition at line 102 of file Config.h.

◆ HeaderInsertionPolicy

Enumerator
IWYU 
NeverInsert 

Definition at line 152 of file Config.h.

◆ IncludesPolicy

Enumerator
Strict 

Diagnose missing and unused includes.

None 

Definition at line 97 of file Config.h.

◆ MacroFilterPolicy

Enumerator
ExactPrefix 
FuzzyMatch 

Definition at line 162 of file Config.h.

Constructor & Destructor Documentation

◆ Config() [1/3]

clang::clangd::Config::Config ( )
default

◆ Config() [2/3]

clang::clangd::Config::Config ( const Config & )
delete

References Config().

◆ Config() [3/3]

clang::clangd::Config::Config ( Config && )
default

References Config().

Member Function Documentation

◆ current()

◆ operator=() [1/2]

Config & clang::clangd::Config::operator= ( Config && )
default

References Config().

◆ operator=() [2/2]

Config & clang::clangd::Config::operator= ( const Config & )
delete

References Config().

Member Data Documentation

◆ AllScopes

bool clang::clangd::Config::AllScopes = true

Whether code completion includes results that are not visible in current scopes.

Definition at line 172 of file Config.h.

◆ AnalyzeAngledIncludes

bool clang::clangd::Config::AnalyzeAngledIncludes = false

Definition at line 124 of file Config.h.

◆ AngledHeaders

std::vector<std::function<bool(llvm::StringRef)> > clang::clangd::Config::AngledHeaders

Definition at line 137 of file Config.h.

Referenced by clang::clangd::ParsedAST::build().

◆ ArgumentLists

ArgumentListsPolicy clang::clangd::Config::ArgumentLists = ArgumentListsPolicy::FullPlaceholders

controls the completion options for argument lists.

Definition at line 174 of file Config.h.

◆ Background

BackgroundPolicy clang::clangd::Config::Background = BackgroundPolicy::Build

Whether this TU should be background-indexed.

Definition at line 92 of file Config.h.

◆ BlockEnd

bool clang::clangd::Config::BlockEnd = false

Definition at line 200 of file Config.h.

◆ BuiltinHeaders

BuiltinHeaderPolicy clang::clangd::Config::BuiltinHeaders = BuiltinHeaderPolicy::Clangd

Whether to use clangd's own builtin headers, or ones from the system include extractor, if available.

Definition at line 74 of file Config.h.

◆ CDBSearch

CDBSearchSpec clang::clangd::Config::CDBSearch = {CDBSearchSpec::Ancestors, std::nullopt}

Where to search for compilation databases for this file's flags.

Definition at line 70 of file Config.h.

◆ CheckOptions

llvm::StringMap<std::string> clang::clangd::Config::CheckOptions

Definition at line 112 of file Config.h.

◆ Checks

std::string clang::clangd::Config::Checks

Definition at line 111 of file Config.h.

◆ [struct]

struct { ... } clang::clangd::Config::ClangTidy

Configures what clang-tidy checks to run and options to use with them.

Referenced by clang::clangd::ParsedAST::build(), and clang::clangd::provideClangdConfig().

◆ CodePatterns

CodePatternsPolicy clang::clangd::Config::CodePatterns = CodePatternsPolicy::All

Enables code patterns & snippets suggestions.

Definition at line 178 of file Config.h.

◆ CommentFormat

CommentFormatPolicy clang::clangd::Config::CommentFormat = CommentFormatPolicy::PlainText

Definition at line 223 of file Config.h.

Referenced by clang::clangd::getDeclComment(), and clang::clangd::HoverInfo::present().

◆ [struct]

struct { ... } clang::clangd::Config::CompileFlags

Controls how the compile command for the current file is determined.

◆ [struct]

struct { ... } clang::clangd::Config::Completion

Configures code completion feature.

◆ DeducedTypes

bool clang::clangd::Config::DeducedTypes = true

Definition at line 198 of file Config.h.

◆ DefaultArguments

bool clang::clangd::Config::DefaultArguments = false

Definition at line 201 of file Config.h.

◆ Designators

bool clang::clangd::Config::Designators = true

Definition at line 199 of file Config.h.

◆ [struct]

struct { ... } clang::clangd::Config::Diagnostics

◆ DisabledKinds

std::vector<std::string> clang::clangd::Config::DisabledKinds

Controls highlighting kinds that are disabled.

Definition at line 208 of file Config.h.

◆ DisabledModifiers

std::vector<std::string> clang::clangd::Config::DisabledModifiers

Controls highlighting modifiers that are disabled.

Definition at line 210 of file Config.h.

◆ [struct]

struct { ... } clang::clangd::Config::Documentation

◆ Edits

std::vector<llvm::unique_function<void(std::vector<std::string> &) const> > clang::clangd::Config::Edits

Edits to apply to the compile command, in sequence.

Definition at line 68 of file Config.h.

◆ Enabled

bool clang::clangd::Config::Enabled = true

If false, inlay hints are completely disabled.

Definition at line 194 of file Config.h.

◆ ExperimentalCustomChecks

bool clang::clangd::Config::ExperimentalCustomChecks = false

Definition at line 114 of file Config.h.

Referenced by clang::clangd::ParsedAST::build().

◆ External

ExternalIndexSpec clang::clangd::Config::External

Definition at line 93 of file Config.h.

◆ FastCheckFilter

FastCheckPolicy clang::clangd::Config::FastCheckFilter = FastCheckPolicy::Strict

Definition at line 113 of file Config.h.

Referenced by clang::clangd::ParsedAST::build().

◆ FullyQualifiedNamespaces

std::vector<std::string> clang::clangd::Config::FullyQualifiedNamespaces

Definition at line 133 of file Config.h.

◆ HeaderInsertion

HeaderInsertionPolicy clang::clangd::Config::HeaderInsertion = HeaderInsertionPolicy::IWYU

Controls if headers should be inserted when completions are accepted.

Definition at line 176 of file Config.h.

◆ [struct]

struct { ... } clang::clangd::Config::Hover

Configures hover feature.

◆ IgnoreHeader

std::vector<std::function<bool(llvm::StringRef)> > clang::clangd::Config::IgnoreHeader

IncludeCleaner will not diagnose usages of these headers matched by these regexes.

Definition at line 123 of file Config.h.

◆ [struct]

struct { ... } clang::clangd::Config::Includes

◆ [struct]

struct { ... } clang::clangd::Config::Index

Controls index behavior.

◆ [struct]

struct { ... } clang::clangd::Config::InlayHints

◆ Key

Key< Config > clang::clangd::Config::Key
static

◆ MacroContentsLimit

uint32_t clang::clangd::Config::MacroContentsLimit = 2048

Limit the number of characters returned when hovering a macro; 0 is no limit.

Definition at line 189 of file Config.h.

◆ MacroFilter

MacroFilterPolicy clang::clangd::Config::MacroFilter = MacroFilterPolicy::ExactPrefix

Controls how macros are filtered.

Definition at line 180 of file Config.h.

◆ MissingIncludes

IncludesPolicy clang::clangd::Config::MissingIncludes = IncludesPolicy::None

Definition at line 118 of file Config.h.

◆ Parameters

bool clang::clangd::Config::Parameters = true

Definition at line 197 of file Config.h.

◆ QuotedHeaders

std::vector<std::function<bool(llvm::StringRef)> > clang::clangd::Config::QuotedHeaders

Definition at line 136 of file Config.h.

Referenced by clang::clangd::ParsedAST::build().

◆ [struct]

struct { ... } clang::clangd::Config::SemanticTokens

◆ ShowAKA

bool clang::clangd::Config::ShowAKA = true

Whether hover show a.k.a type.

Definition at line 186 of file Config.h.

◆ StandardLibrary

bool clang::clangd::Config::StandardLibrary = true

Definition at line 94 of file Config.h.

◆ [struct]

struct { ... } clang::clangd::Config::Style

Style of the codebase.

Referenced by clang::clangd::ParsedAST::build().

◆ Suppress

llvm::StringSet clang::clangd::Config::Suppress

◆ SuppressAll

bool clang::clangd::Config::SuppressAll = false

Definition at line 105 of file Config.h.

Referenced by clang::clangd::StoreDiags::HandleDiagnostic().

◆ TypeNameLimit

uint32_t clang::clangd::Config::TypeNameLimit = 32

Definition at line 203 of file Config.h.

◆ UnusedIncludes

IncludesPolicy clang::clangd::Config::UnusedIncludes = IncludesPolicy::Strict

Definition at line 117 of file Config.h.


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