clang-tools  16.0.0git
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
clang::clangd::config::Fragment Struct Reference

A chunk of configuration obtained from a config file, LSP, or elsewhere. More...

#include <ConfigFragment.h>

Collaboration diagram for clang::clangd::config::Fragment:
Collaboration graph


struct  CompileFlagsBlock
 Conditions in the CompileFlags block affect how a file is parsed. More...
struct  CompletionBlock
 Describes code completion preferences. More...
struct  DiagnosticsBlock
 Controls behavior of diagnostics (errors and warnings). More...
struct  HoverBlock
 Describes hover preferences. More...
struct  IfBlock
 Conditions in the If block restrict when a Fragment applies. More...
struct  IndexBlock
 Controls how clangd understands code outside the current file. More...
struct  InlayHintsBlock
 Configures labels shown inline with the code. More...
struct  SourceInfo
 These fields are not part of the user-specified configuration, but instead are populated by the parser to describe the configuration source. More...
struct  StyleBlock

Public Member Functions

CompiledFragment compile (DiagnosticCallback) &&
 Analyzes and consumes this fragment, possibly yielding more diagnostics. More...

Static Public Member Functions

static std::vector< FragmentparseYAML (llvm::StringRef YAML, llvm::StringRef BufferName, DiagnosticCallback)
 Parses fragments from a YAML file (one from each — delimited document). More...

Public Attributes

SourceInfo Source
IfBlock If
CompileFlagsBlock CompileFlags
IndexBlock Index
DiagnosticsBlock Diagnostics
StyleBlock Style
CompletionBlock Completion
HoverBlock Hover
InlayHintsBlock InlayHints

Detailed Description

A chunk of configuration obtained from a config file, LSP, or elsewhere.

Definition at line 62 of file ConfigFragment.h.

Member Function Documentation

◆ compile()

CompiledFragment clang::clangd::config::Fragment::compile ( DiagnosticCallback  D) &&

Analyzes and consumes this fragment, possibly yielding more diagnostics.

This always produces a usable result (errors are recovered).

Typically, providers will compile a Fragment once when it's first loaded, caching the result for reuse. Like a compiled program, this is good for performance and also encourages errors to be reported early and only once.

The returned function is a cheap-copyable wrapper of refcounted internals.

Definition at line 605 of file ConfigCompile.cpp.

References ConfigFile().

◆ parseYAML()

std::vector< Fragment > clang::clangd::config::Fragment::parseYAML ( llvm::StringRef  YAML,
llvm::StringRef  BufferName,
DiagnosticCallback  Diags 

Parses fragments from a YAML file (one from each — delimited document).

Documents that contained fatal errors are omitted from the results. BufferName is used for the SourceMgr and diagnostics.

Definition at line 413 of file ConfigYAML.cpp.

Member Data Documentation

◆ CompileFlags

CompileFlagsBlock clang::clangd::config::Fragment::CompileFlags

Definition at line 173 of file ConfigFragment.h.

◆ Completion

CompletionBlock clang::clangd::config::Fragment::Completion

Definition at line 288 of file ConfigFragment.h.

◆ Diagnostics

DiagnosticsBlock clang::clangd::config::Fragment::Diagnostics

Definition at line 270 of file ConfigFragment.h.

◆ Hover

HoverBlock clang::clangd::config::Fragment::Hover

Definition at line 295 of file ConfigFragment.h.

◆ If

IfBlock clang::clangd::config::Fragment::If

Definition at line 122 of file ConfigFragment.h.

◆ Index

IndexBlock clang::clangd::config::Fragment::Index

Definition at line 206 of file ConfigFragment.h.

◆ InlayHints

InlayHintsBlock clang::clangd::config::Fragment::InlayHints

Definition at line 309 of file ConfigFragment.h.

◆ Source

SourceInfo clang::clangd::config::Fragment::Source

Definition at line 99 of file ConfigFragment.h.

◆ Style

StyleBlock clang::clangd::config::Fragment::Style

Definition at line 280 of file ConfigFragment.h.

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