6#include "nixd-config.h"
16#include <llvm/Support/CommandLine.h>
20using namespace llvm::json;
21using namespace llvm::cl;
28 desc(
"Default expression intrepreted as `import <nixpkgs> { }`"),
33 desc(
"Default expression interpreted as option declarations"),
35 init(
"(let pkgs = import <nixpkgs> { }; in (pkgs.lib.evalModules { modules "
36 "= (import <nixpkgs/nixos/modules/module-list.nix>) ++ [ ({...}: { "
37 "nixpkgs.hostPlatform = builtins.currentSystem;} ) ] ; })).options")};
40 desc(
"Enable/Disable semantic tokens"),
62 std::string_view Description) {
64 auto Action = [Token, Description = std::string(Description),
65 this](llvm::Expected<EvalExprResponse>
Resp) {
69 std::string(Description)},
76 createWorkDoneProgress({Token});
77 beginWorkDoneProgress({.token = Token,
79 .
title =
"evaluating " + std::string(Description),
95 {
"change", (
int)TextDocumentSyncKind::Incremental},
102 {
"resolveProvider",
false},
105 {
"definitionProvider",
true},
106 {
"documentLinkProvider",
Object{}},
107 {
"documentSymbolProvider",
true},
108 {
"inlayHintProvider",
true},
109 {
"completionProvider",
111 {
"resolveProvider",
true},
112 {
"triggerCharacters", {
"."}},
114 {
"referencesProvider",
true},
115 {
"documentHighlightProvider",
true},
116 {
"hoverProvider",
true},
117 {
"documentFormattingProvider",
true},
120 {
"prepareProvider",
true},
169 ClientCaps =
Params.capabilities;
174 if (nixpkgsClient()) {
181 std::lock_guard
_(OptionsLock);
202 ReceivedShutdown =
true;
Allow default configuration being passed via CLI.
void evalExpr(const EvalExprParams &Params, lspserver::Callback< EvalExprResponse > Reply)
Request eval some expression. The expression should be evaluted to attrset.
Whether current platform treats paths case insensitively.
llvm::unique_function< void(llvm::Expected< T >)> Callback
void elog(const char *Fmt, Ts &&...Vals)
std::string EvalExprParams
bool fromJSON(const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P)
llvm::cl::OptionCategory NixdCategory
void startOption(const std::string &Name, std::unique_ptr< AttrSetClientProc > &Worker)
nixd::Configuration parseCLIConfig()
Parse the CLI flag and initialize the config nixd::DefaultConfig.
void startNixpkgs(std::unique_ptr< AttrSetClientProc > &NixpkgsEval)
llvm::cl::opt< bool > LitTest
Indicating that we are in lit-test mode.
static const llvm::StringLiteral QUICKFIX_KIND
Signals the end of progress reporting.
std::optional< std::string > message