diff options
author | Aleksey Kladov <[email protected]> | 2019-04-11 14:22:10 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-11 14:37:29 +0100 |
commit | 5471c1ef4b2fda2fbaa63f7d8404abf04a3e9da4 (patch) | |
tree | b5a77b6b7474e728f5884969b41f53f0c2ebceb2 /crates/ra_ide_api | |
parent | 07cc047b4ffe3049dfe95fc5cd59383336976e2d (diff) |
generalize SourceAnalyzer to handle all defs with bodies
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_dot.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 358057364..4a111aba5 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs | |||
@@ -308,4 +308,28 @@ mod tests { | |||
308 | ]"### | 308 | ]"### |
309 | ); | 309 | ); |
310 | } | 310 | } |
311 | |||
312 | #[test] | ||
313 | fn test_completion_works_in_consts() { | ||
314 | assert_debug_snapshot_matches!( | ||
315 | do_ref_completion( | ||
316 | r" | ||
317 | struct A { the_field: u32 } | ||
318 | const X: u32 = { | ||
319 | A { the_field: 92 }.<|> | ||
320 | }; | ||
321 | ", | ||
322 | ), | ||
323 | @r###"[ | ||
324 | CompletionItem { | ||
325 | label: "the_field", | ||
326 | source_range: [106; 106), | ||
327 | delete: [106; 106), | ||
328 | insert: "the_field", | ||
329 | kind: Field, | ||
330 | detail: "u32" | ||
331 | } | ||
332 | ]"### | ||
333 | ); | ||
334 | } | ||
311 | } | 335 | } |