diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_dot.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 252 |
1 files changed, 135 insertions, 117 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 2e8084699..5bf289c63 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -66,16 +66,18 @@ mod tests { | |||
66 | } | 66 | } |
67 | ", | 67 | ", |
68 | ), | 68 | ), |
69 | @r###"[ | 69 | @r###" |
70 | CompletionItem { | 70 | ⋮[ |
71 | label: "the_field", | 71 | ⋮ CompletionItem { |
72 | source_range: [94; 94), | 72 | ⋮ label: "the_field", |
73 | delete: [94; 94), | 73 | ⋮ source_range: [94; 94), |
74 | insert: "the_field", | 74 | ⋮ delete: [94; 94), |
75 | kind: Field, | 75 | ⋮ insert: "the_field", |
76 | detail: "u32" | 76 | ⋮ kind: Field, |
77 | } | 77 | ⋮ detail: "u32", |
78 | ]"### | 78 | ⋮ }, |
79 | ⋮] | ||
80 | "### | ||
79 | ); | 81 | ); |
80 | } | 82 | } |
81 | 83 | ||
@@ -95,27 +97,29 @@ mod tests { | |||
95 | } | 97 | } |
96 | ", | 98 | ", |
97 | ), | 99 | ), |
98 | @r###"[ | 100 | @r###" |
99 | CompletionItem { | 101 | ⋮[ |
100 | label: "foo", | 102 | ⋮ CompletionItem { |
101 | source_range: [187; 187), | 103 | ⋮ label: "foo", |
102 | delete: [187; 187), | 104 | ⋮ source_range: [187; 187), |
103 | insert: "foo()$0", | 105 | ⋮ delete: [187; 187), |
104 | kind: Method, | 106 | ⋮ insert: "foo()$0", |
105 | detail: "fn foo(self)" | 107 | ⋮ kind: Method, |
106 | }, | 108 | ⋮ detail: "fn foo(self)", |
107 | CompletionItem { | 109 | ⋮ }, |
108 | label: "the_field", | 110 | ⋮ CompletionItem { |
109 | source_range: [187; 187), | 111 | ⋮ label: "the_field", |
110 | delete: [187; 187), | 112 | ⋮ source_range: [187; 187), |
111 | insert: "the_field", | 113 | ⋮ delete: [187; 187), |
112 | kind: Field, | 114 | ⋮ insert: "the_field", |
113 | detail: "(u32,)", | 115 | ⋮ kind: Field, |
114 | documentation: Documentation( | 116 | ⋮ detail: "(u32,)", |
115 | "This is the_field" | 117 | ⋮ documentation: Documentation( |
116 | ) | 118 | ⋮ "This is the_field", |
117 | } | 119 | ⋮ ), |
118 | ]"### | 120 | ⋮ }, |
121 | ⋮] | ||
122 | "### | ||
119 | ); | 123 | ); |
120 | } | 124 | } |
121 | 125 | ||
@@ -132,24 +136,26 @@ mod tests { | |||
132 | } | 136 | } |
133 | ", | 137 | ", |
134 | ), | 138 | ), |
135 | @r###"[ | 139 | @r###" |
136 | CompletionItem { | 140 | ⋮[ |
137 | label: "foo", | 141 | ⋮ CompletionItem { |
138 | source_range: [126; 126), | 142 | ⋮ label: "foo", |
139 | delete: [126; 126), | 143 | ⋮ source_range: [126; 126), |
140 | insert: "foo()$0", | 144 | ⋮ delete: [126; 126), |
141 | kind: Method, | 145 | ⋮ insert: "foo()$0", |
142 | detail: "fn foo(&self)" | 146 | ⋮ kind: Method, |
143 | }, | 147 | ⋮ detail: "fn foo(&self)", |
144 | CompletionItem { | 148 | ⋮ }, |
145 | label: "the_field", | 149 | ⋮ CompletionItem { |
146 | source_range: [126; 126), | 150 | ⋮ label: "the_field", |
147 | delete: [126; 126), | 151 | ⋮ source_range: [126; 126), |
148 | insert: "the_field", | 152 | ⋮ delete: [126; 126), |
149 | kind: Field, | 153 | ⋮ insert: "the_field", |
150 | detail: "(u32, i32)" | 154 | ⋮ kind: Field, |
151 | } | 155 | ⋮ detail: "(u32, i32)", |
152 | ]"### | 156 | ⋮ }, |
157 | ⋮] | ||
158 | "### | ||
153 | ); | 159 | ); |
154 | } | 160 | } |
155 | 161 | ||
@@ -182,16 +188,18 @@ mod tests { | |||
182 | } | 188 | } |
183 | ", | 189 | ", |
184 | ), | 190 | ), |
185 | @r###"[ | 191 | @r###" |
186 | CompletionItem { | 192 | ⋮[ |
187 | label: "the_method", | 193 | ⋮ CompletionItem { |
188 | source_range: [144; 144), | 194 | ⋮ label: "the_method", |
189 | delete: [144; 144), | 195 | ⋮ source_range: [144; 144), |
190 | insert: "the_method()$0", | 196 | ⋮ delete: [144; 144), |
191 | kind: Method, | 197 | ⋮ insert: "the_method()$0", |
192 | detail: "fn the_method(&self)" | 198 | ⋮ kind: Method, |
193 | } | 199 | ⋮ detail: "fn the_method(&self)", |
194 | ]"### | 200 | ⋮ }, |
201 | ⋮] | ||
202 | "### | ||
195 | ); | 203 | ); |
196 | } | 204 | } |
197 | 205 | ||
@@ -208,16 +216,18 @@ mod tests { | |||
208 | } | 216 | } |
209 | ", | 217 | ", |
210 | ), | 218 | ), |
211 | @r###"[ | 219 | @r###" |
212 | CompletionItem { | 220 | ⋮[ |
213 | label: "the_method", | 221 | ⋮ CompletionItem { |
214 | source_range: [151; 151), | 222 | ⋮ label: "the_method", |
215 | delete: [151; 151), | 223 | ⋮ source_range: [151; 151), |
216 | insert: "the_method()$0", | 224 | ⋮ delete: [151; 151), |
217 | kind: Method, | 225 | ⋮ insert: "the_method()$0", |
218 | detail: "fn the_method(&self)" | 226 | ⋮ kind: Method, |
219 | } | 227 | ⋮ detail: "fn the_method(&self)", |
220 | ]"### | 228 | ⋮ }, |
229 | ⋮] | ||
230 | "### | ||
221 | ); | 231 | ); |
222 | } | 232 | } |
223 | 233 | ||
@@ -257,16 +267,18 @@ mod tests { | |||
257 | } | 267 | } |
258 | ", | 268 | ", |
259 | ), | 269 | ), |
260 | @r###"[ | 270 | @r###" |
261 | CompletionItem { | 271 | ⋮[ |
262 | label: "the_method", | 272 | ⋮ CompletionItem { |
263 | source_range: [249; 249), | 273 | ⋮ label: "the_method", |
264 | delete: [249; 249), | 274 | ⋮ source_range: [249; 249), |
265 | insert: "the_method()$0", | 275 | ⋮ delete: [249; 249), |
266 | kind: Method, | 276 | ⋮ insert: "the_method()$0", |
267 | detail: "fn the_method(&self)" | 277 | ⋮ kind: Method, |
268 | } | 278 | ⋮ detail: "fn the_method(&self)", |
269 | ]"### | 279 | ⋮ }, |
280 | ⋮] | ||
281 | "### | ||
270 | ); | 282 | ); |
271 | } | 283 | } |
272 | 284 | ||
@@ -281,24 +293,26 @@ mod tests { | |||
281 | } | 293 | } |
282 | ", | 294 | ", |
283 | ), | 295 | ), |
284 | @r###"[ | 296 | @r###" |
285 | CompletionItem { | 297 | ⋮[ |
286 | label: "0", | 298 | ⋮ CompletionItem { |
287 | source_range: [75; 75), | 299 | ⋮ label: "0", |
288 | delete: [75; 75), | 300 | ⋮ source_range: [75; 75), |
289 | insert: "0", | 301 | ⋮ delete: [75; 75), |
290 | kind: Field, | 302 | ⋮ insert: "0", |
291 | detail: "i32" | 303 | ⋮ kind: Field, |
292 | }, | 304 | ⋮ detail: "i32", |
293 | CompletionItem { | 305 | ⋮ }, |
294 | label: "1", | 306 | ⋮ CompletionItem { |
295 | source_range: [75; 75), | 307 | ⋮ label: "1", |
296 | delete: [75; 75), | 308 | ⋮ source_range: [75; 75), |
297 | insert: "1", | 309 | ⋮ delete: [75; 75), |
298 | kind: Field, | 310 | ⋮ insert: "1", |
299 | detail: "f64" | 311 | ⋮ kind: Field, |
300 | } | 312 | ⋮ detail: "f64", |
301 | ]"### | 313 | ⋮ }, |
314 | ⋮] | ||
315 | "### | ||
302 | ); | 316 | ); |
303 | } | 317 | } |
304 | 318 | ||
@@ -322,16 +336,18 @@ mod tests { | |||
322 | } | 336 | } |
323 | ", | 337 | ", |
324 | ), | 338 | ), |
325 | @r###"[ | 339 | @r###" |
326 | CompletionItem { | 340 | ⋮[ |
327 | label: "blah", | 341 | ⋮ CompletionItem { |
328 | source_range: [299; 300), | 342 | ⋮ label: "blah", |
329 | delete: [299; 300), | 343 | ⋮ source_range: [299; 300), |
330 | insert: "blah()$0", | 344 | ⋮ delete: [299; 300), |
331 | kind: Method, | 345 | ⋮ insert: "blah()$0", |
332 | detail: "pub fn blah(&self)" | 346 | ⋮ kind: Method, |
333 | } | 347 | ⋮ detail: "pub fn blah(&self)", |
334 | ]"### | 348 | ⋮ }, |
349 | ⋮] | ||
350 | "### | ||
335 | ); | 351 | ); |
336 | } | 352 | } |
337 | 353 | ||
@@ -346,16 +362,18 @@ mod tests { | |||
346 | }; | 362 | }; |
347 | ", | 363 | ", |
348 | ), | 364 | ), |
349 | @r###"[ | 365 | @r###" |
350 | CompletionItem { | 366 | ⋮[ |
351 | label: "the_field", | 367 | ⋮ CompletionItem { |
352 | source_range: [106; 106), | 368 | ⋮ label: "the_field", |
353 | delete: [106; 106), | 369 | ⋮ source_range: [106; 106), |
354 | insert: "the_field", | 370 | ⋮ delete: [106; 106), |
355 | kind: Field, | 371 | ⋮ insert: "the_field", |
356 | detail: "u32" | 372 | ⋮ kind: Field, |
357 | } | 373 | ⋮ detail: "u32", |
358 | ]"### | 374 | ⋮ }, |
375 | ⋮] | ||
376 | "### | ||
359 | ); | 377 | ); |
360 | } | 378 | } |
361 | } | 379 | } |