nixd
Toggle main menu visibility
Loading...
Searching...
No Matches
nixd
lib
Protocol
AttrSet.cpp
Go to the documentation of this file.
1
#include "
nixd/Protocol/AttrSet.h
"
2
3
using namespace
nixd
;
4
using namespace
llvm::json;
5
6
Value
nixd::toJSON
(
const
OptionType
&Params) {
7
return
Object
{
8
{
"Description"
, Params.
Description
},
9
{
"Name"
, Params.
Name
},
10
};
11
}
12
13
bool
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
20
Value
nixd::toJSON
(
const
OptionDescription
&Params) {
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
}
30
bool
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
42
Value
nixd::toJSON
(
const
OptionField
&Params) {
43
return
Object
{
44
{
"Name"
, Params.
Name
},
45
{
"Description"
, Params.
Description
},
46
};
47
}
48
bool
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
56
Value
nixd::toJSON
(
const
PackageDescription
&Params) {
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
68
bool
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
82
Value
nixd::toJSON
(
const
ValueMeta
&Params) {
83
return
Object
{
84
{
"Type"
, Params.
Type
},
85
{
"Location"
, Params.
Location
},
86
};
87
}
88
89
bool
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
98
Value
nixd::toJSON
(
const
AttrPathInfoResponse
&Params) {
99
return
Object
{
100
{
"Meta"
, Params.
Meta
},
101
{
"PackageDesc"
, Params.
PackageDesc
},
102
{
"ValueDesc"
, Params.
ValueDesc
},
103
};
104
}
105
106
bool
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
116
Value
nixd::toJSON
(
const
AttrPathCompleteParams
&Params) {
117
return
Object
{{
"Scope"
, Params.
Scope
}, {
"Prefix"
, Params.
Prefix
}};
118
}
119
bool
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
128
llvm::json::Value
nixd::toJSON
(
const
ValueDescription
&Params) {
129
return
Object
{
130
{
"arity"
, Params.
Arity
},
131
{
"doc"
, Params.
Doc
},
132
{
"args"
, Params.
Args
},
133
};
134
}
135
bool
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
}
AttrSet.h
Types used in nixpkgs provider.
lspserver::Path
std::string Path
Definition
Path.h:24
lspserver::SymbolKind::Object
@ Object
Definition
lspserver/include/lspserver/Protocol.h:456
lspserver::CompletionItemKind::Value
@ Value
Definition
lspserver/include/lspserver/Protocol.h:408
nixd
Definition
CommandLine/Configuration.h:9
nixd::fromJSON
bool fromJSON(const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P)
nixd::toJSON
llvm::json::Value toJSON(const PackageDescription &Params)
Definition
AttrSet.cpp:56
nixd::AttrPathCompleteParams
Definition
AttrSet.h:107
nixd::AttrPathCompleteParams::Scope
Selector Scope
Definition
AttrSet.h:108
nixd::AttrPathCompleteParams::Prefix
std::string Prefix
Search for packages prefixed with this "prefix".
Definition
AttrSet.h:110
nixd::AttrPathInfoResponse
Definition
AttrSet.h:93
nixd::AttrPathInfoResponse::ValueDesc
std::optional< ValueDescription > ValueDesc
Definition
AttrSet.h:100
nixd::AttrPathInfoResponse::Meta
ValueMeta Meta
General value description.
Definition
AttrSet.h:95
nixd::AttrPathInfoResponse::PackageDesc
PackageDescription PackageDesc
Package description of the attribute path, if available.
Definition
AttrSet.h:98
nixd::OptionDescription
Definition
AttrSet.h:128
nixd::OptionDescription::Definitions
std::vector< lspserver::Location > Definitions
Definition
AttrSet.h:131
nixd::OptionDescription::Description
std::optional< std::string > Description
Definition
AttrSet.h:129
nixd::OptionDescription::Example
std::optional< std::string > Example
Definition
AttrSet.h:132
nixd::OptionDescription::Type
std::optional< OptionType > Type
Definition
AttrSet.h:134
nixd::OptionDescription::Declarations
std::vector< lspserver::Location > Declarations
Definition
AttrSet.h:130
nixd::OptionDescription::Default
std::optional< std::string > Default
Definition
AttrSet.h:133
nixd::OptionField
Definition
AttrSet.h:141
nixd::OptionField::Description
std::optional< OptionDescription > Description
Definition
AttrSet.h:143
nixd::OptionField::Name
std::string Name
Definition
AttrSet.h:142
nixd::OptionType
Definition
AttrSet.h:119
nixd::OptionType::Description
std::optional< std::string > Description
Definition
AttrSet.h:120
nixd::OptionType::Name
std::optional< std::string > Name
Definition
AttrSet.h:121
nixd::PackageDescription
Definition
AttrSet.h:50
nixd::PackageDescription::Name
std::optional< std::string > Name
Definition
AttrSet.h:51
nixd::PackageDescription::Version
std::optional< std::string > Version
Definition
AttrSet.h:53
nixd::PackageDescription::PName
std::optional< std::string > PName
Definition
AttrSet.h:52
nixd::PackageDescription::Description
std::optional< std::string > Description
Definition
AttrSet.h:54
nixd::PackageDescription::LongDescription
std::optional< std::string > LongDescription
Definition
AttrSet.h:55
nixd::PackageDescription::Position
std::optional< std::string > Position
Definition
AttrSet.h:56
nixd::PackageDescription::Homepage
std::optional< std::string > Homepage
Definition
AttrSet.h:57
nixd::ValueDescription
Using nix's ":doc" method to retrieve value's additional information.
Definition
AttrSet.h:83
nixd::ValueDescription::Arity
std::int64_t Arity
Definition
AttrSet.h:85
nixd::ValueDescription::Args
std::vector< std::string > Args
Definition
AttrSet.h:86
nixd::ValueDescription::Doc
std::string Doc
Definition
AttrSet.h:84
nixd::ValueMeta
General metadata of all nix::Values.
Definition
AttrSet.h:65
nixd::ValueMeta::Location
std::optional< lspserver::Location > Location
Location of the value.
Definition
AttrSet.h:75
nixd::ValueMeta::Type
int Type
Type of this value.
Definition
AttrSet.h:67
Generated by
1.17.0