@@ -4,9 +4,7 @@ use std::{collections::HashMap, path::PathBuf, time::Instant};
44
55use lsp_types:: {
66 notification:: DidOpenTextDocument ,
7- request:: {
8- CodeActionRequest , Completion , Formatting , GotoDefinition , GotoTypeDefinition , HoverRequest ,
9- } ,
7+ request:: { CodeActionRequest , Completion , Formatting , GotoTypeDefinition , HoverRequest } ,
108 CodeActionContext , CodeActionParams , CompletionParams , DidOpenTextDocumentParams ,
119 DocumentFormattingParams , FormattingOptions , GotoDefinitionParams , HoverParams ,
1210 PartialResultParams , Position , Range , TextDocumentItem , TextDocumentPositionParams ,
@@ -507,6 +505,10 @@ fn main() {
507505 println!("cargo:rerun-if-changed=build.rs");
508506}
509507//- 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+
510512include!(concat!(env!("OUT_DIR"), "/hello.rs"));
511513
512514#[cfg(atom_cfg)]
@@ -521,7 +523,7 @@ struct B;
521523fn main() {
522524 let va = A;
523525 let vb = B;
524- message();
526+ let should_be_str = message();
525527}
526528"### ,
527529 )
@@ -530,36 +532,35 @@ fn main() {
530532 } )
531533 . server ( ) ;
532534 server. wait_until_workspace_is_loaded ( ) ;
533- let res = server. send_request :: < GotoDefinition > ( GotoDefinitionParams {
535+ let res = server. send_request :: < HoverRequest > ( HoverParams {
534536 text_document_position_params : TextDocumentPositionParams :: new (
535537 server. doc_id ( "src/main.rs" ) ,
536- Position :: new ( 14 , 8 ) ,
538+ Position :: new ( 18 , 10 ) ,
537539 ) ,
538540 work_done_progress_params : Default :: default ( ) ,
539- partial_result_params : Default :: default ( ) ,
540541 } ) ;
541- assert ! ( format! ( "{}" , res) . contains( "hello.rs " ) ) ;
542+ assert ! ( res. to_string ( ) . contains( "&str " ) ) ;
542543 server. request :: < GotoTypeDefinition > (
543544 GotoDefinitionParams {
544545 text_document_position_params : TextDocumentPositionParams :: new (
545546 server. doc_id ( "src/main.rs" ) ,
546- Position :: new ( 12 , 9 ) ,
547+ Position :: new ( 16 , 9 ) ,
547548 ) ,
548549 work_done_progress_params : Default :: default ( ) ,
549550 partial_result_params : Default :: default ( ) ,
550551 } ,
551552 json ! ( [ {
552553 "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 }
555556 } ,
556557 "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 }
559560 } ,
560561 "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 }
563564 } ,
564565 "targetUri" : "file:///[..]src/main.rs"
565566 } ] ) ,
@@ -568,23 +569,23 @@ fn main() {
568569 GotoDefinitionParams {
569570 text_document_position_params : TextDocumentPositionParams :: new (
570571 server. doc_id ( "src/main.rs" ) ,
571- Position :: new ( 13 , 9 ) ,
572+ Position :: new ( 17 , 9 ) ,
572573 ) ,
573574 work_done_progress_params : Default :: default ( ) ,
574575 partial_result_params : Default :: default ( ) ,
575576 } ,
576577 json ! ( [ {
577578 "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 }
580581 } ,
581582 "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 }
584585 } ,
585586 "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 }
588589 } ,
589590 "targetUri" : "file:///[..]src/main.rs"
590591 } ] ) ,
0 commit comments