@@ -4,9 +4,7 @@ use std::{collections::HashMap, path::PathBuf, time::Instant};
4
4
5
5
use lsp_types:: {
6
6
notification:: DidOpenTextDocument ,
7
- request:: {
8
- CodeActionRequest , Completion , Formatting , GotoDefinition , GotoTypeDefinition , HoverRequest ,
9
- } ,
7
+ request:: { CodeActionRequest , Completion , Formatting , GotoTypeDefinition , HoverRequest } ,
10
8
CodeActionContext , CodeActionParams , CompletionParams , DidOpenTextDocumentParams ,
11
9
DocumentFormattingParams , FormattingOptions , GotoDefinitionParams , HoverParams ,
12
10
PartialResultParams , Position , Range , TextDocumentItem , TextDocumentPositionParams ,
@@ -507,6 +505,10 @@ fn main() {
507
505
println!("cargo:rerun-if-changed=build.rs");
508
506
}
509
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
+
510
512
include!(concat!(env!("OUT_DIR"), "/hello.rs"));
511
513
512
514
#[cfg(atom_cfg)]
@@ -521,7 +523,7 @@ struct B;
521
523
fn main() {
522
524
let va = A;
523
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
533
. server ( ) ;
532
534
server. wait_until_workspace_is_loaded ( ) ;
533
- let res = server. send_request :: < GotoDefinition > ( GotoDefinitionParams {
535
+ let res = server. send_request :: < HoverRequest > ( HoverParams {
534
536
text_document_position_params : TextDocumentPositionParams :: new (
535
537
server. doc_id ( "src/main.rs" ) ,
536
- Position :: new ( 14 , 8 ) ,
538
+ Position :: new ( 18 , 10 ) ,
537
539
) ,
538
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
543
server. request :: < GotoTypeDefinition > (
543
544
GotoDefinitionParams {
544
545
text_document_position_params : TextDocumentPositionParams :: new (
545
546
server. doc_id ( "src/main.rs" ) ,
546
- Position :: new ( 12 , 9 ) ,
547
+ Position :: new ( 16 , 9 ) ,
547
548
) ,
548
549
work_done_progress_params : Default :: default ( ) ,
549
550
partial_result_params : Default :: default ( ) ,
550
551
} ,
551
552
json ! ( [ {
552
553
"originSelectionRange" : {
553
- "end" : { "character" : 10 , "line" : 12 } ,
554
- "start" : { "character" : 8 , "line" : 12 }
554
+ "end" : { "character" : 10 , "line" : 16 } ,
555
+ "start" : { "character" : 8 , "line" : 16 }
555
556
} ,
556
557
"targetRange" : {
557
- "end" : { "character" : 9 , "line" : 3 } ,
558
- "start" : { "character" : 0 , "line" : 2 }
558
+ "end" : { "character" : 9 , "line" : 7 } ,
559
+ "start" : { "character" : 0 , "line" : 6 }
559
560
} ,
560
561
"targetSelectionRange" : {
561
- "end" : { "character" : 8 , "line" : 3 } ,
562
- "start" : { "character" : 7 , "line" : 3 }
562
+ "end" : { "character" : 8 , "line" : 7 } ,
563
+ "start" : { "character" : 7 , "line" : 7 }
563
564
} ,
564
565
"targetUri" : "file:///[..]src/main.rs"
565
566
} ] ) ,
@@ -568,23 +569,23 @@ fn main() {
568
569
GotoDefinitionParams {
569
570
text_document_position_params : TextDocumentPositionParams :: new (
570
571
server. doc_id ( "src/main.rs" ) ,
571
- Position :: new ( 13 , 9 ) ,
572
+ Position :: new ( 17 , 9 ) ,
572
573
) ,
573
574
work_done_progress_params : Default :: default ( ) ,
574
575
partial_result_params : Default :: default ( ) ,
575
576
} ,
576
577
json ! ( [ {
577
578
"originSelectionRange" : {
578
- "end" : { "character" : 10 , "line" : 13 } ,
579
- "start" : { "character" : 8 , "line" : 13 }
579
+ "end" : { "character" : 10 , "line" : 17 } ,
580
+ "start" : { "character" : 8 , "line" : 17 }
580
581
} ,
581
582
"targetRange" : {
582
- "end" : { "character" : 9 , "line" : 7 } ,
583
- "start" : { "character" : 0 , "line" : 6 }
583
+ "end" : { "character" : 9 , "line" : 11 } ,
584
+ "start" : { "character" : 0 , "line" : 10 }
584
585
} ,
585
586
"targetSelectionRange" : {
586
- "end" : { "character" : 8 , "line" : 7 } ,
587
- "start" : { "character" : 7 , "line" : 7 }
587
+ "end" : { "character" : 8 , "line" : 11 } ,
588
+ "start" : { "character" : 7 , "line" : 11 }
588
589
} ,
589
590
"targetUri" : "file:///[..]src/main.rs"
590
591
} ] ) ,
0 commit comments