aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_lsp_server/tests/heavy_tests/main.rs45
1 files changed, 44 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs
index 641f84cfc..8e4e1fb88 100644
--- a/crates/ra_lsp_server/tests/heavy_tests/main.rs
+++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs
@@ -279,7 +279,7 @@ fn main() {}
279 PATH = tmp_dir.path().display() 279 PATH = tmp_dir.path().display()
280 ); 280 );
281 let server = project_with_tmpdir(tmp_dir, &code); 281 let server = project_with_tmpdir(tmp_dir, &code);
282 server.wait_for_feedback("workspace loaded"); 282 server.wait_for_message("workspace loaded");
283 let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None }; 283 let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None };
284 server.request::<CodeActionRequest>( 284 server.request::<CodeActionRequest>(
285 CodeActionParams { 285 CodeActionParams {
@@ -321,3 +321,46 @@ fn main() {}
321 json!([]), 321 json!([]),
322 ); 322 );
323} 323}
324
325#[test]
326fn completes_items_from_second_crate_in_json_project() {
327 let tmp_dir = TempDir::new().unwrap();
328 let code = format!(
329 r#"
330//- rust-project.json
331{{
332 "roots": [ "{PATH}" ],
333 "crates": [
334 {{
335 "root_module": "{PATH}/foo/lib.rs",
336 "deps": [
337 {{
338 "name": "bar",
339 "crate": 1
340 }}
341 ],
342 "edition": "2015"
343 }},
344 {{ "root_module": "{PATH}/bar/lib.rs", "deps": [], "edition": "2015" }}
345 ]
346}}
347
348//- bar/lib.rs
349pub struct Spam;
350pub struct CannedMeat;
351
352//- foo/lib.rs
353extern crate bar;
354use bar::Spam;
355"#,
356 PATH = tmp_dir.path().display()
357 );
358 let server = project_with_tmpdir(tmp_dir, &code);
359 server.wait_for_message("workspace loaded");
360 let res = server.send_request::<Completion>(CompletionParams {
361 text_document: server.doc_id("foo/lib.rs"),
362 context: None,
363 position: Position::new(1, 10),
364 });
365 assert!(format!("{}", res).contains("CannedMeat"));
366}