1#include "nixd-config.h"
9#include <llvm/ADT/ArrayRef.h>
10#include <llvm/Support/CommandLine.h>
17using namespace llvm::cl;
19OptionCategory Misc(
"miscellaneous options");
20OptionCategory
Debug(
"debug-only options (for developers)");
24opt<JSONStreamStyle> InputStyle{
26 desc(
"Input JSON stream encoding"),
28 clEnumValN(JSONStreamStyle::Standard,
"standard",
"usual LSP protocol"),
29 clEnumValN(JSONStreamStyle::Delimited,
"delimited",
30 "messages delimited by `// -----` lines, "
31 "with // comment support")),
32 init(JSONStreamStyle::Standard),
38 "log", desc(
"Verbosity of log messages written to stderr"),
40 clEnumValN(Logger::Level::Error,
"error",
"Error messages only"),
41 clEnumValN(Logger::Level::Info,
"info",
"High level execution tracing"),
42 clEnumValN(Logger::Level::Debug,
"debug",
"Debugging details"),
43 clEnumValN(Logger::Level::Verbose,
"verbose",
"Low level details")),
44 init(Logger::Level::Info), cat(Misc)};
45opt<bool> PrettyPrint{
"pretty", desc(
"Pretty-print JSON output"), init(
false),
50int main(
int argc,
char *argv[]) {
51 SetVersionPrinter([](llvm::raw_ostream &OS) {
52 OS <<
"nixd, version: ";
61 HideUnrelatedOptions(NixdCatogories);
62 ParseCommandLineOptions(argc, argv,
"nixd language server",
nullptr,
66 InputStyle = JSONStreamStyle::Delimited;
67 LogLevel = Logger::Level::Verbose;
74 auto In = std::make_unique<lspserver::InboundPort>(STDIN_FILENO, InputStyle);
76 auto Out = std::make_unique<lspserver::OutboundPort>(PrettyPrint);
79 std::make_unique<nixd::Controller>(std::move(In), std::move(Out));
Interface to allow custom logging in clangd.
Only one LoggingSession can be active at a time.
Whether current platform treats paths case insensitively.
llvm::cl::OptionCategory NixdCategory
llvm::cl::opt< bool > LitTest
Indicating that we are in lit-test mode.
int main(int argc, char *argv[])