diff options
author | Laurențiu Nicola <[email protected]> | 2020-06-27 13:31:19 +0100 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-06-27 17:34:48 +0100 |
commit | b4420626fbcc5f7b58e19f735fdbec1b0c48f045 (patch) | |
tree | d7373e0339c114703184921c2477c994181c0088 /crates/rust-analyzer | |
parent | 6a067ce947980d887a254d71d7183c3d306d8978 (diff) |
Add support for include_str
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/main.rs | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs index 58839b14a..cc079790e 100644 --- a/crates/rust-analyzer/tests/heavy_tests/main.rs +++ b/crates/rust-analyzer/tests/heavy_tests/main.rs | |||
@@ -494,6 +494,7 @@ fn main() { | |||
494 | } | 494 | } |
495 | //- /src/main.rs | 495 | //- /src/main.rs |
496 | #[rustc_builtin_macro] macro_rules! include {} | 496 | #[rustc_builtin_macro] macro_rules! include {} |
497 | #[rustc_builtin_macro] macro_rules! include_str {} | ||
497 | #[rustc_builtin_macro] macro_rules! concat {} | 498 | #[rustc_builtin_macro] macro_rules! concat {} |
498 | #[rustc_builtin_macro] macro_rules! env {} | 499 | #[rustc_builtin_macro] macro_rules! env {} |
499 | 500 | ||
@@ -512,6 +513,7 @@ fn main() { | |||
512 | let va = A; | 513 | let va = A; |
513 | let vb = B; | 514 | let vb = B; |
514 | let should_be_str = message(); | 515 | let should_be_str = message(); |
516 | let another_str = include_str!("main.rs"); | ||
515 | } | 517 | } |
516 | "###, | 518 | "###, |
517 | ) | 519 | ) |
@@ -523,7 +525,15 @@ fn main() { | |||
523 | let res = server.send_request::<HoverRequest>(HoverParams { | 525 | let res = server.send_request::<HoverRequest>(HoverParams { |
524 | text_document_position_params: TextDocumentPositionParams::new( | 526 | text_document_position_params: TextDocumentPositionParams::new( |
525 | server.doc_id("src/main.rs"), | 527 | server.doc_id("src/main.rs"), |
526 | Position::new(18, 10), | 528 | Position::new(19, 10), |
529 | ), | ||
530 | work_done_progress_params: Default::default(), | ||
531 | }); | ||
532 | assert!(res.to_string().contains("&str")); | ||
533 | let res = server.send_request::<HoverRequest>(HoverParams { | ||
534 | text_document_position_params: TextDocumentPositionParams::new( | ||
535 | server.doc_id("src/main.rs"), | ||
536 | Position::new(20, 10), | ||
527 | ), | 537 | ), |
528 | work_done_progress_params: Default::default(), | 538 | work_done_progress_params: Default::default(), |
529 | }); | 539 | }); |
@@ -532,23 +542,23 @@ fn main() { | |||
532 | GotoDefinitionParams { | 542 | GotoDefinitionParams { |
533 | text_document_position_params: TextDocumentPositionParams::new( | 543 | text_document_position_params: TextDocumentPositionParams::new( |
534 | server.doc_id("src/main.rs"), | 544 | server.doc_id("src/main.rs"), |
535 | Position::new(16, 9), | 545 | Position::new(17, 9), |
536 | ), | 546 | ), |
537 | work_done_progress_params: Default::default(), | 547 | work_done_progress_params: Default::default(), |
538 | partial_result_params: Default::default(), | 548 | partial_result_params: Default::default(), |
539 | }, | 549 | }, |
540 | json!([{ | 550 | json!([{ |
541 | "originSelectionRange": { | 551 | "originSelectionRange": { |
542 | "end": { "character": 10, "line": 16 }, | 552 | "end": { "character": 10, "line": 17 }, |
543 | "start": { "character": 8, "line": 16 } | 553 | "start": { "character": 8, "line": 17 } |
544 | }, | 554 | }, |
545 | "targetRange": { | 555 | "targetRange": { |
546 | "end": { "character": 9, "line": 7 }, | 556 | "end": { "character": 9, "line": 8 }, |
547 | "start": { "character": 0, "line": 6 } | 557 | "start": { "character": 0, "line": 7 } |
548 | }, | 558 | }, |
549 | "targetSelectionRange": { | 559 | "targetSelectionRange": { |
550 | "end": { "character": 8, "line": 7 }, | 560 | "end": { "character": 8, "line": 8 }, |
551 | "start": { "character": 7, "line": 7 } | 561 | "start": { "character": 7, "line": 8 } |
552 | }, | 562 | }, |
553 | "targetUri": "file:///[..]src/main.rs" | 563 | "targetUri": "file:///[..]src/main.rs" |
554 | }]), | 564 | }]), |
@@ -557,23 +567,23 @@ fn main() { | |||
557 | GotoDefinitionParams { | 567 | GotoDefinitionParams { |
558 | text_document_position_params: TextDocumentPositionParams::new( | 568 | text_document_position_params: TextDocumentPositionParams::new( |
559 | server.doc_id("src/main.rs"), | 569 | server.doc_id("src/main.rs"), |
560 | Position::new(17, 9), | 570 | Position::new(18, 9), |
561 | ), | 571 | ), |
562 | work_done_progress_params: Default::default(), | 572 | work_done_progress_params: Default::default(), |
563 | partial_result_params: Default::default(), | 573 | partial_result_params: Default::default(), |
564 | }, | 574 | }, |
565 | json!([{ | 575 | json!([{ |
566 | "originSelectionRange": { | 576 | "originSelectionRange": { |
567 | "end": { "character": 10, "line": 17 }, | 577 | "end": { "character": 10, "line": 18 }, |
568 | "start": { "character": 8, "line": 17 } | 578 | "start": { "character": 8, "line": 18 } |
569 | }, | 579 | }, |
570 | "targetRange": { | 580 | "targetRange": { |
571 | "end": { "character": 9, "line": 11 }, | 581 | "end": { "character": 9, "line": 12 }, |
572 | "start": { "character": 0, "line":10 } | 582 | "start": { "character": 0, "line":11 } |
573 | }, | 583 | }, |
574 | "targetSelectionRange": { | 584 | "targetSelectionRange": { |
575 | "end": { "character": 8, "line": 11 }, | 585 | "end": { "character": 8, "line": 12 }, |
576 | "start": { "character": 7, "line": 11 } | 586 | "start": { "character": 7, "line": 12 } |
577 | }, | 587 | }, |
578 | "targetUri": "file:///[..]src/main.rs" | 588 | "targetUri": "file:///[..]src/main.rs" |
579 | }]), | 589 | }]), |