LLVM 22.0.0git
llvm::lsp::JSONTransport Class Reference

A transport class that performs the JSON-RPC communication with the LSP client. More...

#include "llvm/Support/LSP/Transport.h"

Public Member Functions

 JSONTransport (std::unique_ptr< JSONTransportInput > In, raw_ostream &Out, bool PrettyOutput=false)
 JSONTransport (std::FILE *In, raw_ostream &Out, JSONStreamStyle Style=JSONStreamStyle::Standard, bool PrettyOutput=false)
void notify (StringRef Method, llvm::json::Value Params)
 The following methods are used to send a message to the LSP client.
void call (StringRef Method, llvm::json::Value Params, llvm::json::Value Id)
void reply (llvm::json::Value Id, llvm::Expected< llvm::json::Value > Result)
llvm::Error run (MessageHandler &Handler)
 Start executing the JSON-RPC transport.

Detailed Description

A transport class that performs the JSON-RPC communication with the LSP client.

Definition at line 93 of file Transport.h.

Constructor & Destructor Documentation

◆ JSONTransport() [1/2]

llvm::lsp::JSONTransport::JSONTransport ( std::unique_ptr< JSONTransportInput > In,
raw_ostream & Out,
bool PrettyOutput = false )
inline

Definition at line 95 of file Transport.h.

References llvm::move().

◆ JSONTransport() [2/2]

llvm::lsp::JSONTransport::JSONTransport ( std::FILE * In,
raw_ostream & Out,
JSONStreamStyle Style = JSONStreamStyle::Standard,
bool PrettyOutput = false )
inline

Definition at line 99 of file Transport.h.

References llvm::lsp::Standard.

Member Function Documentation

◆ call()

void JSONTransport::call ( StringRef Method,
llvm::json::Value Params,
llvm::json::Value Id )

Definition at line 183 of file Transport.cpp.

References llvm::lsp::Method.

◆ notify()

void JSONTransport::notify ( StringRef Method,
llvm::json::Value Params )

The following methods are used to send a message to the LSP client.

Definition at line 176 of file Transport.cpp.

References llvm::lsp::Method.

◆ reply()

void JSONTransport::reply ( llvm::json::Value Id,
llvm::Expected< llvm::json::Value > Result )

Definition at line 192 of file Transport.cpp.

References encodeError().

◆ run()

llvm::Error JSONTransport::run ( MessageHandler & Handler)

Start executing the JSON-RPC transport.

Definition at line 209 of file Transport.cpp.

References llvm::lsp::Logger::error(), llvm::errorCodeToError(), llvm::json::parse(), llvm::succeeded(), llvm::Error::success(), and llvm::toString().


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