14 #include "llvm/Support/CommandLine.h"
15 #include "llvm/Support/Program.h"
21 llvm::cl::opt<JSONStreamStyle> inputStyle{
23 llvm::cl::desc(
"Input JSON stream encoding"),
25 "usual LSP protocol"),
27 "messages delimited by `// -----` lines, "
28 "with // comment support")),
32 llvm::cl::opt<bool> litTest{
35 "Abbreviation for -input-style=delimited -pretty -log=verbose. "
36 "Intended to simplify lit tests"),
37 llvm::cl::init(
false),
39 llvm::cl::opt<Logger::Level> logLevel{
41 llvm::cl::desc(
"Verbosity of log messages written to stderr"),
45 "High level execution tracing"),
49 llvm::cl::opt<bool> prettyPrint{
51 llvm::cl::desc(
"Pretty-print JSON output"),
52 llvm::cl::init(
false),
54 llvm::cl::list<std::string> extraIncludeDirs(
55 "tablegen-extra-dir", llvm::cl::desc(
"Extra directory of include files"),
56 llvm::cl::value_desc(
"directory"), llvm::cl::Prefix);
57 llvm::cl::list<std::string> compilationDatabases(
58 "tablegen-compilation-database",
59 llvm::cl::desc(
"Compilation YAML databases containing additional "
60 "compilation information for .td files"));
62 llvm::cl::ParseCommandLineOptions(argc, argv,
"TableGen LSP Language Server");
74 llvm::sys::ChangeStdinToBinary();
75 JSONTransport transport(stdin, llvm::outs(), inputStyle, prettyPrint);
static llvm::ManagedStatic< PassManagerOptions > options
A transport class that performs the JSON-RPC communication with the LSP client.
static void setLogLevel(Level logLevel)
Set the severity level of the logger.
This class implements all of the TableGen related functionality necessary for a language server.
@ Delimited
Messages are delimited by a '// --—' line. Comment lines start with //.
@ Standard
Encoding per the LSP specification, with mandatory Content-Length header.
llvm::LogicalResult runTableGenLSPServer(TableGenServer &server, JSONTransport &transport)
Run the main loop of the LSP server using the given TableGen server and transport.
Include the generated interface declarations.
llvm::LogicalResult TableGenLspServerMain(int argc, char **argv)
Implementation for tools like tblgen-lsp-server.