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

This class provides implementation of an LSP server, glueing the JSON dispatch and ClangdServer together. More...

#include <ClangdLSPServer.h>

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

Public Member Functions

 ClangdLSPServer (JSONOutput &Out, const clangd::CodeCompleteOptions &CCOpts, llvm::Optional< Path > CompileCommandsDir, const ClangdServer::Options &Opts)
 If CompileCommandsDir has a value, compile_commands.json will be loaded only from CompileCommandsDir. More...
 
bool run (std::FILE *In, JSONStreamStyle InputStyle=JSONStreamStyle::Standard)
 Run LSP server loop, receiving input for it from In. More...
 

Detailed Description

This class provides implementation of an LSP server, glueing the JSON dispatch and ClangdServer together.

Definition at line 31 of file ClangdLSPServer.h.

Constructor & Destructor Documentation

◆ ClangdLSPServer()

ClangdLSPServer::ClangdLSPServer ( JSONOutput Out,
const clangd::CodeCompleteOptions CCOpts,
llvm::Optional< Path CompileCommandsDir,
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.

Definition at line 422 of file ClangdLSPServer.cpp.

Member Function Documentation

◆ run()

bool ClangdLSPServer::run ( std::FILE *  In,
JSONStreamStyle  InputStyle = JSONStreamStyle::Standard 
)

Run LSP server loop, receiving input for it from In.

In must be opened in binary mode. Output will be written using Out variable passed to class constructor. This method must not be executed more than once for each instance of ClangdLSPServer.

Returns
Whether we received a 'shutdown' request before an 'exit' request.

Definition at line 430 of file ClangdLSPServer.cpp.

References clang::clangd::ClangdServer::addDocument(), clang::clangd::Array, clang::clangd::Auto, clang::clangd::File, clang::clangd::DraftStore::getActiveFiles(), clang::clangd::DraftStore::getDraft(), clang::clangd::Diagnostic::message, clang::clangd::MethodNotFound, clang::clangd::Object, clang::clangd::Diagnostic::range, clang::clangd::registerCallbackHandlers(), clang::clangd::replyError(), clang::clangd::runLanguageServerLoop(), clang::clangd::Diagnostic::severity, clang::clangd::toLSPDiags(), clang::clangd::Value, and clang::clangd::JSONOutput::writeMessage().


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