nixd
Loading...
Searching...
No Matches
AttrSet.cpp
Go to the documentation of this file.
2
3using namespace nixd;
4using namespace llvm::json;
5
7 return Object{
8 {"Description", Params.Description},
9 {"Name", Params.Name},
10 };
11}
12
13bool nixd::fromJSON(const Value &Params, OptionType &R, Path P) {
14 ObjectMapper O(Params, P);
15 return O //
16 && O.mapOptional("Description", R.Description) //
17 && O.mapOptional("Name", R.Name);
18}
19
21 return Object{
22 {"Description", Params.Description},
23 {"Declarations", Params.Declarations},
24 {"Definitions", Params.Definitions},
25 {"Example", Params.Example},
26 {"Default", Params.Default},
27 {"Type", Params.Type},
28 };
29}
30bool nixd::fromJSON(const Value &Params, OptionDescription &R, Path P) {
31 ObjectMapper O(Params, P);
32 return O //
33 && O.mapOptional("Description", R.Description) //
34 && O.mapOptional("Declarations", R.Declarations) //
35 && O.mapOptional("Definitions", R.Definitions) //
36 && O.mapOptional("Example", R.Example) //
37 && O.mapOptional("Default", R.Default) //
38 && O.mapOptional("Type", R.Type) //
39 ;
40}
41
43 return Object{
44 {"Name", Params.Name},
45 {"Description", Params.Description},
46 };
47}
48bool nixd::fromJSON(const Value &Params, OptionField &R, Path P) {
49 ObjectMapper O(Params, P);
50 return O //
51 && O.mapOptional("Description", R.Description) //
52 && O.mapOptional("Name", R.Name) //
53 ;
54}
55
57 return Object{
58 {"Name", Params.Name},
59 {"PName", Params.PName},
60 {"Version", Params.Version},
61 {"Description", Params.Description},
62 {"LongDescription", Params.LongDescription},
63 {"Position", Params.Position},
64 {"Homepage", Params.Homepage},
65 };
66}
67
68bool nixd::fromJSON(const llvm::json::Value &Params, PackageDescription &R,
69 llvm::json::Path P) {
70 ObjectMapper O(Params, P);
71 return O //
72 && O.map("Name", R.Name) //
73 && O.map("PName", R.PName) //
74 && O.map("Version", R.Version) //
75 && O.map("Description", R.Description) //
76 && O.map("LongDescription", R.LongDescription) //
77 && O.map("Position", R.Position) //
78 && O.map("Homepage", R.Homepage) //
79 ;
80}
81
83 return Object{
84 {"Type", Params.Type},
85 {"Location", Params.Location},
86 };
87}
88
89bool nixd::fromJSON(const llvm::json::Value &Params, ValueMeta &R,
90 llvm::json::Path P) {
91 ObjectMapper O(Params, P);
92 return O //
93 && O.map("Type", R.Type) //
94 && O.mapOptional("Location", R.Location) //
95 ;
96}
97
99 return Object{
100 {"Meta", Params.Meta},
101 {"PackageDesc", Params.PackageDesc},
102 {"ValueDesc", Params.ValueDesc},
103 };
104}
105
106bool nixd::fromJSON(const llvm::json::Value &Params, AttrPathInfoResponse &R,
107 llvm::json::Path P) {
108 ObjectMapper O(Params, P);
109 return O //
110 && O.map("Meta", R.Meta) //
111 && O.mapOptional("PackageDesc", R.PackageDesc) //
112 && O.mapOptional("ValueDesc", R.ValueDesc) //
113 ;
114}
115
117 return Object{{"Scope", Params.Scope}, {"Prefix", Params.Prefix}};
118}
119bool nixd::fromJSON(const llvm::json::Value &Params, AttrPathCompleteParams &R,
120 llvm::json::Path P) {
121 ObjectMapper O(Params, P);
122 return O //
123 && O.map("Scope", R.Scope) //
124 && O.map("Prefix", R.Prefix) //
125 ;
126}
127
128llvm::json::Value nixd::toJSON(const ValueDescription &Params) {
129 return Object{
130 {"arity", Params.Arity},
131 {"doc", Params.Doc},
132 {"args", Params.Args},
133 };
134}
135bool nixd::fromJSON(const llvm::json::Value &Params, ValueDescription &R,
136 llvm::json::Path P) {
137
138 ObjectMapper O(Params, P);
139 return O //
140 && O.map("arity", R.Arity) //
141 && O.map("doc", R.Doc) //
142 && O.map("args", R.Args);
143}
Types used in nixpkgs provider.
std::string Path
Definition Path.h:24
bool fromJSON(const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P)
llvm::json::Value toJSON(const PackageDescription &Params)
Definition AttrSet.cpp:56
std::string Prefix
Search for packages prefixed with this "prefix".
Definition AttrSet.h:110
std::optional< ValueDescription > ValueDesc
Definition AttrSet.h:100
ValueMeta Meta
General value description.
Definition AttrSet.h:95
PackageDescription PackageDesc
Package description of the attribute path, if available.
Definition AttrSet.h:98
std::vector< lspserver::Location > Definitions
Definition AttrSet.h:131
std::optional< std::string > Description
Definition AttrSet.h:129
std::optional< std::string > Example
Definition AttrSet.h:132
std::optional< OptionType > Type
Definition AttrSet.h:134
std::vector< lspserver::Location > Declarations
Definition AttrSet.h:130
std::optional< std::string > Default
Definition AttrSet.h:133
std::optional< OptionDescription > Description
Definition AttrSet.h:143
std::string Name
Definition AttrSet.h:142
std::optional< std::string > Description
Definition AttrSet.h:120
std::optional< std::string > Name
Definition AttrSet.h:121
std::optional< std::string > Name
Definition AttrSet.h:51
std::optional< std::string > Version
Definition AttrSet.h:53
std::optional< std::string > PName
Definition AttrSet.h:52
std::optional< std::string > Description
Definition AttrSet.h:54
std::optional< std::string > LongDescription
Definition AttrSet.h:55
std::optional< std::string > Position
Definition AttrSet.h:56
std::optional< std::string > Homepage
Definition AttrSet.h:57
Using nix's ":doc" method to retrieve value's additional information.
Definition AttrSet.h:83
std::int64_t Arity
Definition AttrSet.h:85
std::vector< std::string > Args
Definition AttrSet.h:86
std::string Doc
Definition AttrSet.h:84
General metadata of all nix::Values.
Definition AttrSet.h:65
std::optional< lspserver::Location > Location
Location of the value.
Definition AttrSet.h:75
int Type
Type of this value.
Definition AttrSet.h:67