nixd
Toggle main menu visibility
Loading...
Searching...
No Matches
nixd
lib
Eval
AttrSetClient.cpp
Go to the documentation of this file.
1
#include "nixd-config.h"
2
3
#include "
nixd/Eval/AttrSetClient.h
"
4
5
#include <signal.h>
// NOLINT(modernize-deprecated-headers)
6
7
using namespace
nixd
;
8
using namespace
lspserver
;
9
10
AttrSetClient::AttrSetClient
(std::unique_ptr<lspserver::InboundPort> In,
11
std::unique_ptr<lspserver::OutboundPort> Out)
12
:
LSPServer
(std::move(In), std::move(Out)) {
13
EvalExpr =
mkOutMethod<EvalExprParams, EvalExprResponse>
(
rpcMethod::EvalExpr
);
14
AttrPathInfo =
mkOutMethod<AttrPathInfoParams, AttrPathInfoResponse>
(
15
rpcMethod::AttrPathInfo
);
16
AttrPathComplete =
17
mkOutMethod<AttrPathCompleteParams, AttrPathCompleteResponse>
(
18
rpcMethod::AttrPathComplete
);
19
OptionInfo =
mkOutMethod<AttrPathInfoParams, OptionInfoResponse>
(
20
rpcMethod::OptionInfo
);
21
OptionComplete =
mkOutMethod<AttrPathCompleteParams, OptionCompleteResponse>
(
22
rpcMethod::OptionComplete
);
23
Exit =
mkOutNotifiction<std::nullptr_t>
(
rpcMethod::Exit
);
24
}
25
26
const
char
*
AttrSetClient::getExe
() {
27
if
(
const
char
*Env = std::getenv(
"NIXD_ATTRSET_EVAL"
))
28
return
Env;
29
return
NIXD_LIBEXEC
"/nixd-attrset-eval"
;
30
}
31
32
AttrSetClientProc::AttrSetClientProc
(
const
std::function<
int
()> &Action)
33
: Proc(Action), Client(Proc.mkIn(), Proc.mkOut()),
34
Input([this]() { Client.run(); }) {}
35
36
AttrSetClient
*
AttrSetClientProc::client
() {
37
if
(!kill(Proc.proc().PID, 0))
38
return
&Client;
39
return
nullptr
;
40
}
AttrSetClient.h
lspserver::LSPServer::mkOutMethod
llvm::unique_function< void(const ParamTy &, Callback< ResponseTy >)> mkOutMethod(llvm::StringRef Method, OutboundPort *O=nullptr)
Definition
LSPServer.h:69
lspserver::LSPServer::LSPServer
LSPServer(std::unique_ptr< InboundPort > In, std::unique_ptr< OutboundPort > Out)
Definition
LSPServer.h:87
lspserver::LSPServer::mkOutNotifiction
llvm::unique_function< void(const T &)> mkOutNotifiction(llvm::StringRef Method, OutboundPort *O=nullptr)
Definition
LSPServer.h:58
nixd::AttrSetClientProc::client
AttrSetClient * client()
Check if the process is still alive.
Definition
AttrSetClient.cpp:36
nixd::AttrSetClientProc::AttrSetClientProc
AttrSetClientProc(const std::function< int()> &Action)
Definition
AttrSetClient.cpp:32
nixd::AttrSetClient
Definition
AttrSetClient.h:12
nixd::AttrSetClient::getExe
static const char * getExe()
Definition
AttrSetClient.cpp:26
nixd::AttrSetClient::AttrSetClient
AttrSetClient(std::unique_ptr< lspserver::InboundPort > In, std::unique_ptr< lspserver::OutboundPort > Out)
Definition
AttrSetClient.cpp:10
lspserver
Whether current platform treats paths case insensitively.
Definition
Connection.h:11
nixd::rpcMethod::Exit
constexpr std::string_view Exit
Definition
AttrSet.h:35
nixd::rpcMethod::EvalExpr
constexpr std::string_view EvalExpr
Definition
AttrSet.h:30
nixd::rpcMethod::OptionInfo
constexpr std::string_view OptionInfo
Definition
AttrSet.h:33
nixd::rpcMethod::AttrPathInfo
constexpr std::string_view AttrPathInfo
Definition
AttrSet.h:31
nixd::rpcMethod::OptionComplete
constexpr std::string_view OptionComplete
Definition
AttrSet.h:34
nixd::rpcMethod::AttrPathComplete
constexpr std::string_view AttrPathComplete
Definition
AttrSet.h:32
nixd
Definition
CommandLine/Configuration.h:9
Generated by
1.17.0