clang-tools  11.0.0
Classes | Public Member Functions | List of all members
clang::clangd::ClangdLSPServer Class Reference

This class exposes ClangdServer's capabilities via Language Server Protocol. More...

#include <ClangdLSPServer.h>

Inheritance diagram for clang::clangd::ClangdLSPServer:
[legend]
Collaboration diagram for clang::clangd::ClangdLSPServer:
[legend]

Classes

class  MessageHandler
 

Public Member Functions

 ClangdLSPServer (Transport &Transp, const ThreadsafeFS &TFS, const clangd::CodeCompleteOptions &CCOpts, const clangd::RenameOptions &RenameOpts, llvm::Optional< Path > CompileCommandsDir, bool UseDirBasedCDB, llvm::Optional< OffsetEncoding > ForcedOffsetEncoding, const ClangdServer::Options &Opts)
 If CompileCommandsDir has a value, compile_commands.json will be loaded only from CompileCommandsDir. More...
 
 ~ClangdLSPServer ()
 The destructor blocks on any outstanding background tasks. More...
 
bool run ()
 Run LSP server loop, communicating with the Transport provided in the constructor. More...
 

Detailed Description

This class exposes ClangdServer's capabilities via Language Server Protocol.

MessageHandler binds the implemented LSP methods (e.g. onInitialize) to corresponding JSON-RPC methods ("initialize"). The server also supports $/cancelRequest (MessageHandler provides this).

Definition at line 37 of file ClangdLSPServer.h.

Constructor & Destructor Documentation

◆ ClangdLSPServer()

clang::clangd::ClangdLSPServer::ClangdLSPServer ( Transport Transp,
const ThreadsafeFS TFS,
const clangd::CodeCompleteOptions CCOpts,
const clangd::RenameOptions RenameOpts,
llvm::Optional< Path CompileCommandsDir,
bool  UseDirBasedCDB,
llvm::Optional< OffsetEncoding ForcedOffsetEncoding,
const ClangdServer::Options Opts 
)

If CompileCommandsDir has a value, compile_commands.json will be loaded only from CompileCommandsDir.

Otherwise, clangd will look for compile_commands.json in all parent directories of each file. If UseDirBasedCDB is false, compile commands are not read from disk.

Definition at line 1356 of file ClangdLSPServer.cpp.

◆ ~ClangdLSPServer()

clang::clangd::ClangdLSPServer::~ClangdLSPServer ( )

The destructor blocks on any outstanding background tasks.

Definition at line 1410 of file ClangdLSPServer.cpp.

Member Function Documentation

◆ run()

bool clang::clangd::ClangdLSPServer::run ( )

Run LSP server loop, communicating with the Transport provided in the constructor.

This method must not be executed more than once.

Returns
Whether we shut down cleanly with a 'shutdown' -> 'exit' sequence.

Definition at line 1417 of file ClangdLSPServer.cpp.


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