aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/tests/heavy_tests/main.rs45
1 files changed, 23 insertions, 22 deletions
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs
index 237aaa2a1..0e2a83c6a 100644
--- a/crates/rust-analyzer/tests/heavy_tests/main.rs
+++ b/crates/rust-analyzer/tests/heavy_tests/main.rs
@@ -4,9 +4,7 @@ use std::{collections::HashMap, path::PathBuf, time::Instant};
4 4
5use lsp_types::{ 5use lsp_types::{
6 notification::DidOpenTextDocument, 6 notification::DidOpenTextDocument,
7 request::{ 7 request::{CodeActionRequest, Completion, Formatting, GotoTypeDefinition, HoverRequest},
8 CodeActionRequest, Completion, Formatting, GotoDefinition, GotoTypeDefinition, HoverRequest,
9 },
10 CodeActionContext, CodeActionParams, CompletionParams, DidOpenTextDocumentParams, 8 CodeActionContext, CodeActionParams, CompletionParams, DidOpenTextDocumentParams,
11 DocumentFormattingParams, FormattingOptions, GotoDefinitionParams, HoverParams, 9 DocumentFormattingParams, FormattingOptions, GotoDefinitionParams, HoverParams,
12 PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams, 10 PartialResultParams, Position, Range, TextDocumentItem, TextDocumentPositionParams,
@@ -507,6 +505,10 @@ fn main() {
507 println!("cargo:rerun-if-changed=build.rs"); 505 println!("cargo:rerun-if-changed=build.rs");
508} 506}
509//- src/main.rs 507//- src/main.rs
508#[rustc_builtin_macro] macro_rules! include {}
509#[rustc_builtin_macro] macro_rules! concat {}
510#[rustc_builtin_macro] macro_rules! env {}
511
510include!(concat!(env!("OUT_DIR"), "/hello.rs")); 512include!(concat!(env!("OUT_DIR"), "/hello.rs"));
511 513
512#[cfg(atom_cfg)] 514#[cfg(atom_cfg)]
@@ -521,7 +523,7 @@ struct B;
521fn main() { 523fn main() {
522 let va = A; 524 let va = A;
523 let vb = B; 525 let vb = B;
524 message(); 526 let should_be_str = message();
525} 527}
526"###, 528"###,
527 ) 529 )
@@ -530,36 +532,35 @@ fn main() {
530 }) 532 })
531 .server(); 533 .server();
532 server.wait_until_workspace_is_loaded(); 534 server.wait_until_workspace_is_loaded();
533 let res = server.send_request::<GotoDefinition>(GotoDefinitionParams { 535 let res = server.send_request::<HoverRequest>(HoverParams {
534 text_document_position_params: TextDocumentPositionParams::new( 536 text_document_position_params: TextDocumentPositionParams::new(
535 server.doc_id("src/main.rs"), 537 server.doc_id("src/main.rs"),
536 Position::new(14, 8), 538 Position::new(18, 10),
537 ), 539 ),
538 work_done_progress_params: Default::default(), 540 work_done_progress_params: Default::default(),
539 partial_result_params: Default::default(),
540 }); 541 });
541 assert!(format!("{}", res).contains("hello.rs")); 542 assert!(res.to_string().contains("&str"));
542 server.request::<GotoTypeDefinition>( 543 server.request::<GotoTypeDefinition>(
543 GotoDefinitionParams { 544 GotoDefinitionParams {
544 text_document_position_params: TextDocumentPositionParams::new( 545 text_document_position_params: TextDocumentPositionParams::new(
545 server.doc_id("src/main.rs"), 546 server.doc_id("src/main.rs"),
546 Position::new(12, 9), 547 Position::new(16, 9),
547 ), 548 ),
548 work_done_progress_params: Default::default(), 549 work_done_progress_params: Default::default(),
549 partial_result_params: Default::default(), 550 partial_result_params: Default::default(),
550 }, 551 },
551 json!([{ 552 json!([{
552 "originSelectionRange": { 553 "originSelectionRange": {
553 "end": { "character": 10, "line": 12 }, 554 "end": { "character": 10, "line": 16 },
554 "start": { "character": 8, "line": 12 } 555 "start": { "character": 8, "line": 16 }
555 }, 556 },
556 "targetRange": { 557 "targetRange": {
557 "end": { "character": 9, "line": 3 }, 558 "end": { "character": 9, "line": 7 },
558 "start": { "character": 0, "line": 2 } 559 "start": { "character": 0, "line": 6 }
559 }, 560 },
560 "targetSelectionRange": { 561 "targetSelectionRange": {
561 "end": { "character": 8, "line": 3 }, 562 "end": { "character": 8, "line": 7 },
562 "start": { "character": 7, "line": 3 } 563 "start": { "character": 7, "line": 7 }
563 }, 564 },
564 "targetUri": "file:///[..]src/main.rs" 565 "targetUri": "file:///[..]src/main.rs"
565 }]), 566 }]),
@@ -568,23 +569,23 @@ fn main() {
568 GotoDefinitionParams { 569 GotoDefinitionParams {
569 text_document_position_params: TextDocumentPositionParams::new( 570 text_document_position_params: TextDocumentPositionParams::new(
570 server.doc_id("src/main.rs"), 571 server.doc_id("src/main.rs"),
571 Position::new(13, 9), 572 Position::new(17, 9),
572 ), 573 ),
573 work_done_progress_params: Default::default(), 574 work_done_progress_params: Default::default(),
574 partial_result_params: Default::default(), 575 partial_result_params: Default::default(),
575 }, 576 },
576 json!([{ 577 json!([{
577 "originSelectionRange": { 578 "originSelectionRange": {
578 "end": { "character": 10, "line": 13 }, 579 "end": { "character": 10, "line": 17 },
579 "start": { "character": 8, "line":13 } 580 "start": { "character": 8, "line": 17 }
580 }, 581 },
581 "targetRange": { 582 "targetRange": {
582 "end": { "character": 9, "line": 7 }, 583 "end": { "character": 9, "line": 11 },
583 "start": { "character": 0, "line":6 } 584 "start": { "character": 0, "line":10 }
584 }, 585 },
585 "targetSelectionRange": { 586 "targetSelectionRange": {
586 "end": { "character": 8, "line": 7 }, 587 "end": { "character": 8, "line": 11 },
587 "start": { "character": 7, "line": 7 } 588 "start": { "character": 7, "line": 11 }
588 }, 589 },
589 "targetUri": "file:///[..]src/main.rs" 590 "targetUri": "file:///[..]src/main.rs"
590 }]), 591 }]),