-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathSignatureHelp.res
163 lines (122 loc) · 3.05 KB
/
SignatureHelp.res
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
type someVariant = One | Two | Three
/** Does stuff. */
let someFunc = (one: int, ~two: option<string>=?, ~three: unit => unit, ~four: someVariant, ()) => {
ignore(one)
ignore(two)
ignore(three())
ignore(four)
}
let otherFunc = (first: string, second: int, third: float) => {
ignore(first)
ignore(second)
ignore(third)
}
// let _ = someFunc(
// ^she
// let _ = someFunc(1
// ^she
// let _ = someFunc(123, ~two
// ^she
// let _ = someFunc(123, ~two="123"
// ^she
// let _ = someFunc(123, ~two="123", ~four
// ^she
// let _ = someFunc(123, ~two="123", ~four=O
// ^she
// let _ = otherFunc(
// ^she
// let _ = otherFunc("123"
// ^she
// let _ = otherFunc("123", 123, 123.0)
// ^she
// let _ = Completion.Lib.foo(~age
// ^she
let iAmSoSpecial = (iJustHaveOneArg: string) => {
ignore(iJustHaveOneArg)
}
// let _ = iAmSoSpecial(
// ^she
// let _ = "hello"->otherFunc(1
// ^she
let fn = (age: int, name: string, year: int) => {
ignore(age)
ignore(name)
ignore(year)
}
// let _ = fn(22, )
// ^she
// let _ = fn(22, , 2023)
// ^she
// let _ = fn(12, "hello", )
// ^she
// let _ = fn({ iAmSoSpecial() })
// ^she
// let _ = fn({ iAmSoSpecial({ someFunc() }) })
// ^she
/** This is my own special thing. */
type mySpecialThing = string
type t =
| /** One is cool. */ One({miss?: bool, hit?: bool, stuff?: string})
| /** Two is fun! */ Two(mySpecialThing)
| /** Three is... three */ Three(mySpecialThing, array<option<string>>)
let _one = One({})
// ^she
let _one = One({miss: true})
// ^she
let _one = One({hit: true, miss: true})
// ^she
let two = Two("true")
// ^she
let three = Three("", [])
// ^she
let three2 = Three("", [])
// ^she
let _deepestTakesPrecedence = [12]->Js.Array2.map(v =>
if v > 0 {
One({})
// ^she
} else {
Two("")
}
)
/** Main docstring here. */
let map = (arr, mapper) => {
Array.map(mapper, arr)
}
let _usesCorrectTypeInfo = [12]->map(v => v)
// ^she
/** Type x... */
type x = {
age?: int,
name?: string,
}
/** Type tt! */
type tt = One
/** Some stuff */
let stuffers = (x: x, y: tt) => {
ignore(x)
ignore(y)
"hello"
}
let _ = stuffers({}, One)
// ^she
let _ = stuffers({}, One)
// ^she
let _ = switch _one {
| One({hit: _hit}) => ""
// ^she
| One(_a) => ""
// ^she
| Two(_ms) => ""
// ^she
| Three(_a, []) => ""
// ^she
| Three(_, _b) => ""
// ^she
}
let _bb = Ok(true)
// ^she
let _bbb = Error("err")
// ^she
let _cc = Some(true)
// ^she