clang-tools  10.0.0svn
Public Member Functions | Public Attributes | List of all members
clang::clangd::Edit Struct Reference

A set of edits generated for a single file. More...

#include <SourceCode.h>

Collaboration diagram for clang::clangd::Edit:
Collaboration graph
[legend]

Public Member Functions

 Edit (llvm::StringRef Code, tooling::Replacements Reps)
 
llvm::Expected< std::string > apply () const
 Returns the file contents after changes are applied. More...
 
std::vector< TextEditasTextEdits () const
 Represents Replacements as TextEdits that are available for use in LSP. More...
 
bool canApplyTo (llvm::StringRef Code) const
 Checks whether the Replacements are applicable to given Code. More...
 

Public Attributes

tooling::Replacements Replacements
 
std::string InitialCode
 

Detailed Description

A set of edits generated for a single file.

Can verify whether it is safe to apply these edits to a code block.

Definition at line 210 of file SourceCode.h.

Constructor & Destructor Documentation

◆ Edit()

clang::clangd::Edit::Edit ( llvm::StringRef  Code,
tooling::Replacements  Reps 
)
inline

Definition at line 214 of file SourceCode.h.

Member Function Documentation

◆ apply()

llvm::Expected< std::string > clang::clangd::Edit::apply ( ) const

Returns the file contents after changes are applied.

Definition at line 991 of file SourceCode.cpp.

References InitialCode, and Replacements.

◆ asTextEdits()

std::vector< TextEdit > clang::clangd::Edit::asTextEdits ( ) const

Represents Replacements as TextEdits that are available for use in LSP.

Definition at line 995 of file SourceCode.cpp.

References InitialCode, Replacements, and clang::clangd::replacementsToEdits().

◆ canApplyTo()

bool clang::clangd::Edit::canApplyTo ( llvm::StringRef  Code) const

Checks whether the Replacements are applicable to given Code.

Definition at line 999 of file SourceCode.cpp.

References InitialCode.

Member Data Documentation

◆ InitialCode

std::string clang::clangd::Edit::InitialCode

Definition at line 212 of file SourceCode.h.

Referenced by apply(), asTextEdits(), and canApplyTo().

◆ Replacements

tooling::Replacements clang::clangd::Edit::Replacements

Definition at line 211 of file SourceCode.h.

Referenced by apply(), and asTextEdits().


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