@@ -85,6 +85,66 @@ fn test_references_for_usage_with_config() {
8585 interaction. shutdown ( ) ;
8686}
8787
88+ #[ test]
89+ fn test_references_workspace_smaller_than_config ( ) {
90+ let root = get_test_files_root ( ) ;
91+ let root_path = root. path ( ) . join ( "config_with_workspace_smaller" ) ;
92+ let scope_uri = Url :: from_file_path ( root_path. clone ( ) ) . unwrap ( ) ;
93+ let mut interaction = LspInteraction :: new_with_indexing_mode ( IndexingMode :: LazyBlocking ) ;
94+ interaction. set_root ( root_path. clone ( ) ) ;
95+ interaction. initialize ( InitializeSettings {
96+ workspace_folders : Some ( vec ! [ ( "test" . to_owned( ) , scope_uri) ] ) ,
97+ configuration : Some ( None ) ,
98+ ..Default :: default ( )
99+ } ) ;
100+
101+ let core = root_path. join ( "core.py" ) ;
102+ let usage_in_config = root_path. join ( "usage_in_config.py" ) ;
103+ let usage_outside_workspace = root_path. join ( "subdir/usage_outside_workspace.py" ) ;
104+
105+ interaction. server . did_open ( "core.py" ) ;
106+ interaction. server . did_open ( "usage_in_config.py" ) ;
107+
108+ interaction. server . references ( "core.py" , 6 , 7 , true ) ;
109+
110+ interaction. client . expect_response ( Response {
111+ id : RequestId :: from ( 2 ) ,
112+ result : Some ( serde_json:: json!( [
113+ {
114+ "range" : { "start" : { "line" : 5 , "character" : 17 } , "end" : { "character" : 22 , "line" : 5 } } ,
115+ "uri" : Url :: from_file_path( usage_outside_workspace. clone( ) ) . unwrap( ) . to_string( )
116+ } ,
117+ {
118+ "range" : { "start" : { "line" : 7 , "character" : 0 } , "end" : { "character" : 5 , "line" : 7 } } ,
119+ "uri" : Url :: from_file_path( usage_outside_workspace. clone( ) ) . unwrap( ) . to_string( )
120+ } ,
121+ {
122+ "range" : { "start" : { "line" : 8 , "character" : 0 } , "end" : { "character" : 5 , "line" : 8 } } ,
123+ "uri" : Url :: from_file_path( usage_outside_workspace. clone( ) ) . unwrap( ) . to_string( )
124+ } ,
125+ {
126+ "range" : { "start" : { "line" : 6 , "character" : 6 } , "end" : { "character" : 11 , "line" : 6 } } ,
127+ "uri" : Url :: from_file_path( core. clone( ) ) . unwrap( ) . to_string( )
128+ } ,
129+ {
130+ "range" : { "start" : { "line" : 5 , "character" : 17 } , "end" : { "character" : 22 , "line" : 5 } } ,
131+ "uri" : Url :: from_file_path( usage_in_config. clone( ) ) . unwrap( ) . to_string( )
132+ } ,
133+ {
134+ "range" : { "start" : { "line" : 7 , "character" : 0 } , "end" : { "character" : 5 , "line" : 7 } } ,
135+ "uri" : Url :: from_file_path( usage_in_config. clone( ) ) . unwrap( ) . to_string( )
136+ } ,
137+ {
138+ "range" : { "start" : { "line" : 8 , "character" : 0 } , "end" : { "character" : 5 , "line" : 8 } } ,
139+ "uri" : Url :: from_file_path( usage_in_config. clone( ) ) . unwrap( ) . to_string( )
140+ } ,
141+ ] ) ) ,
142+ error : None ,
143+ } ) ;
144+
145+ interaction. shutdown ( ) ;
146+ }
147+
88148#[ test]
89149fn test_references_cross_file_no_config ( ) {
90150 let root = get_test_files_root ( ) ;
0 commit comments