You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: analysis/src/CompletionDecorators.ml
+45-39
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
-
type kind = TopLevel of string | Local of string | TopLevelOrLocal of string
2
-
3
-
let decorators =
1
+
letlocal =
4
2
[
5
-
( Local "as",
3
+
( "as",
6
4
[
7
5
{|The `@as` decorator is commonly used on record types to alias record field names to a different JavaScript attribute name.
8
6
@@ -12,7 +10,7 @@ It is also possible to map a ReScript record to a JavaScript array by passing in
12
10
13
11
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#as-decorator).|};
14
12
] );
15
-
( Local "dead",
13
+
( "dead",
16
14
[
17
15
{|The `@dead` decorator is for reanalyze, a static analysis tool for ReScript that can do dead code analysis.
18
16
@@ -22,21 +20,19 @@ It is also possible to map a ReScript record to a JavaScript array by passing in
22
20
23
21
> Hint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!|};
24
22
] );
25
-
( Local "deriving",
23
+
( "deriving",
26
24
[
27
25
{|When the `@deriving` decorator is applied to a record type, it expands the type into a factory function plus a set of getter/setter functions for its fields.
28
26
29
27
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#deriving-decorator).|};
30
28
] );
31
-
( TopLevelOrLocal "deprecated",
29
+
( "deprecated",
32
30
[
33
31
{|The `@deprecated` decorator is used to add deprecation notes to types, values andsubmodules. The compiler andeditor tooling will yield a warning whenever a deprecated entity is being used.
34
32
35
-
Alternatively, use the `@@deprecated` decorator to add a deprecation warning to the file level.
36
-
37
33
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#expression-deprecated-decorator).|};
38
34
] );
39
-
( Local "doesNotRaise",
35
+
( "doesNotRaise",
40
36
[
41
37
{|The `@doesNotRaise` decorator is for reanalyze, a static analysis tool for ReScript that can perform exception analysis.
42
38
@@ -47,55 +43,55 @@ could potentially raise.
47
43
[Read more andsee examples in the documentation](https://github.com/rescript-association/reanalyze/blob/master/EXCEPTION.md).
48
44
> Hint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!|};
49
45
] );
50
-
( Local "genType",
46
+
( "genType",
51
47
[
52
48
{|The @genType decorator may be used to export ReScript values andtypes to JavaScript, andimport JavaScript values andtypes into ReScript. It allows seamless integration of compiled ReScript modules in existing TypeScript, Flow, or plain JavaScript codebases, without loosing type information across different type systems.
53
49
54
50
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#gentype-decorator).|};
55
51
] );
56
-
( Local "genType.as",
52
+
( "genType.as",
57
53
[
58
54
{|The @genType decorator may be used to export ReScript values andtypes to JavaScript, andimport JavaScript values andtypes into ReScript. It allows seamless integration of compiled ReScript modules in existing TypeScript, Flow, or plain JavaScript codebases, without loosing type information across different type systems.
59
55
60
56
[Read more andsee examples in the documentation](https://rescript-lang.org/docs/gentype/latest/usage).|};
61
57
] );
62
-
( Local "genType.import",
58
+
( "genType.import",
63
59
[
64
60
{|The @genType decorator may be used to export ReScript values andtypes to JavaScript, andimport JavaScript values andtypes into ReScript. It allows seamless integration of compiled ReScript modules in existing TypeScript, Flow, or plain JavaScript codebases, without loosing type information across different type systems.
65
61
66
62
[Read more andsee examples in the documentation](https://rescript-lang.org/docs/gentype/latest/usage).|};
67
63
] );
68
-
( Local "genType.opaque",
64
+
( "genType.opaque",
69
65
[
70
66
{|The @genType decorator may be used to export ReScript values andtypes to JavaScript, andimport JavaScript values andtypes into ReScript. It allows seamless integration of compiled ReScript modules in existing TypeScript, Flow, or plain JavaScript codebases, without loosing type information across different type systems.
71
67
72
68
[Read more andsee examples in the documentation](https://rescript-lang.org/docs/gentype/latest/usage).|};
73
69
] );
74
-
( Local "get",
70
+
( "get",
75
71
[
76
72
{|The `@get` decorator is used to bind to a property of an object.
77
73
78
74
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#get-decorator).|};
79
75
] );
80
-
( Local "get_index",
76
+
( "get_index",
81
77
[
82
78
{|The `@get_index` decorator is used to access a dynamic property on an object, or an index of an array.
83
79
84
80
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#get-index-decorator).|};
85
81
] );
86
-
( Local "inline",
82
+
( "inline",
87
83
[
88
84
{|The `@inline` decorator tells the compiler to inline its value in every place the binding is being used, rather than use a variable.
89
85
90
86
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#inline-decorator).|};
91
87
] );
92
-
( Local "int",
88
+
( "int",
93
89
[
94
90
{|The `@int` decorator can be used with polymorphic variants andthe @as decorator on externals to modify the compiled JavaScript to use integers for the values instead of strings.
95
91
96
92
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#int-decorator).|};
97
93
] );
98
-
( Local "live",
94
+
( "live",
99
95
[
100
96
{|The `@live` decorator is for reanalyze, a static analysis tool for ReScript that can do dead code analysis.
101
97
@@ -105,32 +101,32 @@ could potentially raise.
105
101
106
102
Hint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!|};
107
103
] );
108
-
( Local "meth",
104
+
( "meth",
109
105
[
110
106
{|The `@meth` decorator is used to call a function on a JavaScript object, andavoid issues with currying.
111
107
112
108
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#meth-decorator).|};
113
109
] );
114
-
( Local "module",
110
+
( "module",
115
111
[
116
112
{|The `@module` decorator is used to bind to a JavaScript module.
117
113
118
114
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#module-decorator).|};
119
115
] );
120
-
( Local "new",
116
+
( "new",
121
117
[
122
118
{|
123
119
The `@new` decorator is used whenever you need to bind to a JavaScript class constructor that requires the new keword for instantiation.|
124
120
125
121
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#new-decorator).|};
126
122
] );
127
-
( Local "obj",
123
+
( "obj",
128
124
[
129
125
{|The `@obj` decorator is used to create functions that return JavaScript objects with properties that match the function's parameter labels.
130
126
131
127
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#obj-decorator).|};
132
128
] );
133
-
( Local "raises",
129
+
( "raises",
134
130
[
135
131
{|The `@raises` decorator is for reanalyze, a static analysis tool for ReScript that can perform exception analysis.
136
132
@@ -140,7 +136,7 @@ Example `@raises(Exn)` or `@raises([E1, E2, E3])` for multiple exceptions.
140
136
[Read more andsee examples in the documentation](https://github.com/rescript-association/reanalyze/blob/master/EXCEPTION.md).
141
137
> Hint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!|};
142
138
] );
143
-
( Local "react.component",
139
+
( "react.component",
144
140
[
145
141
{|The `@react.component` decorator is used to annotate functions that are RescriptReact components.
146
142
@@ -150,85 +146,95 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
150
146
151
147
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#react-component-decorator).|};
152
148
] );
153
-
( Local "return",
149
+
( "return",
154
150
[
155
151
{|The `@return` decorator is used to control how `null` and `undefined` values are converted to option types in ReScript.
156
152
157
153
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#return-decorator).|};
158
154
] );
159
-
( Local "scope",
155
+
( "scope",
160
156
[
161
157
{|The `@scope` decorator is used with other decorators such as `@val` and `@module` to declare a parent scope for the binding.
162
158
163
159
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#scope-decorator).|};
164
160
] );
165
-
( Local "send",
161
+
( "send",
166
162
[
167
163
{|The `@send` decorator is used to bind to a method on an object or array.
168
164
169
165
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#send-decorator).|};
170
166
] );
171
-
( Local "set",
167
+
( "set",
172
168
[
173
169
{|The `@set` decorator is used to set a property of an object.
174
170
175
171
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#set-decorator).|};
176
172
] );
177
-
( Local "set_index",
173
+
( "set_index",
178
174
[
179
175
{|The `@set_index` decorator is used to set a dynamic property on an object, or an index of an array.
180
176
181
177
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#set-index-decorator).|};
182
178
] );
183
-
( Local "string",
179
+
( "string",
184
180
[
185
181
{|The `@string` decorator can be used with polymorphic variants andthe `@as` decorator on externals to modify the string values used for the variants in the compiled JavaScript.
186
182
187
183
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#string-decorator).|};
188
184
] );
189
-
( Local "this",
185
+
( "this",
190
186
[
191
187
{|The `@this` decorator may be used to bind to an external callback function that require access to a this context.
192
188
193
189
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#this-decorator).|};
194
190
] );
195
-
( Local "unboxed",
191
+
( "unboxed",
196
192
[
197
193
{|The `@unboxed` decorator provides a way to unwrap variant constructors that have a single argument, or record objects that have a single field.
198
194
199
195
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#unboxed-decorator).|};
200
196
] );
201
-
( Local "uncurry",
197
+
( "uncurry",
202
198
[
203
199
{|The `@uncurry` decorator can be used to mark any callback argument within an external function as an uncurried function without the need for any explicit uncurried function syntax (`(.) => { ... }`).
204
200
205
201
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#uncurry-decorator).|};
206
202
] );
207
-
( Local "unwrap",
203
+
( "unwrap",
208
204
[
209
205
{|The `@unwrap` decorator may be used when binding to external functions that accept multiple types for an argument.
210
206
211
207
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#unwrap-decorator).|};
212
208
] );
213
-
( Local "val",
209
+
( "val",
214
210
[
215
211
{|The `@val` decorator allows you to bind to JavaScript values that are on the global scope.
216
212
217
213
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#val-decorator).|};
218
214
] );
219
-
( Local "variadic",
215
+
( "variadic",
220
216
[
221
217
{|The `@variadic` decorator is used to model JavaScript functions that take a variable number of arguments, where all arguments are of the same type.
222
218
223
219
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#variadic-decorator).|};
224
220
] );
225
-
( TopLevel "directive",
221
+
]
222
+
223
+
let toplevel =
224
+
[
225
+
( "deprecated",
226
+
[
227
+
{|The `@@deprecated` decorator is used to add a deprecation note to the file-level of a module. The compiler andeditor tooling will yield a warning whenever a deprecated file module is being used.
228
+
229
+
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#module-deprecated-decorator).|};
230
+
] );
231
+
( "directive",
226
232
[
227
233
{|The `@@directive` decorator will output that string verbatim at the very top of the generated JavaScript file, before any imports.
228
234
229
235
[Read more andsee examples in the documentation](https://rescript-lang.org/syntax-lookup#directive-decorator).|};
230
236
] );
231
-
( TopLevel "warning",
237
+
( "warning",
232
238
[
233
239
{|The `@@warning` decorator is used to modify the enabled compiler warnings for the current module. See here for all available warning numbers.
0 commit comments