-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.jsonnet
47 lines (41 loc) · 1.32 KB
/
example.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Jump to definition will jump to the imported file.
// Try jumping from the import statement or the file name.
local example = import 'example.libsonnet';
// It also works with importstr.
local str = import 'example.txt';
// Jump to definition knows where the '$' references.
// Try jump from each usage of '$'.
// Unfortunately, it is not yet able to jump to the field within the referenced object.
local obj = {
y:: 25,
a: $.y,
};
obj {
z:: 26,
b: $.z,
// Jump to definition knows which local is relevant.
// Try jumping from each usage of 'c'.
local c = 1,
c:
[c]
+ local c = 2;
[
local c = 3;
c,
c,
],
// Jump to definition knows where the super object begins.
// Try jumping from the usage of 'super'.
// Unfortunately, it is not yet able to jump to the field within the super object.
d: super.a,
// Jump to definition knows where the self object begins.
// Try jump from the usage of 'self'.
// Unfortunately, it is not yet able to jump to the field within the self object.
e: self.b,
// Jump to definition knows that a variable comes from a function parameter.
f:: function(x, y, z) x + y + z,
// Runtime errors are reported as a warning.
err: import 'does-not-exist.libsonnet',
// Static errors are reported as errors.
// Uncomment this line to cause one.
}