@@ -77,6 +77,9 @@ pub(crate) struct Session {
77
77
/// Has the client requested the server to shutdown.
78
78
shutdown_requested : bool ,
79
79
80
+ /// Is the connected client a `TestServer` instance.
81
+ in_test : bool ,
82
+
80
83
deferred_messages : VecDeque < Message > ,
81
84
}
82
85
@@ -113,6 +116,7 @@ impl Session {
113
116
global_options : GlobalOptions ,
114
117
workspace_folders : Vec < ( Url , ClientOptions ) > ,
115
118
native_system : Arc < dyn System + ' static + Send + Sync + RefUnwindSafe > ,
119
+ in_test : bool ,
116
120
) -> crate :: Result < Self > {
117
121
let index = Arc :: new ( Index :: new ( global_options. into_settings ( ) ) ) ;
118
122
@@ -132,6 +136,7 @@ impl Session {
132
136
resolved_client_capabilities : ResolvedClientCapabilities :: new ( client_capabilities) ,
133
137
request_queue : RequestQueue :: new ( ) ,
134
138
shutdown_requested : false ,
139
+ in_test,
135
140
} )
136
141
}
137
142
@@ -458,6 +463,7 @@ impl Session {
458
463
. collect ( ) ,
459
464
index : self . index . clone ( ) . unwrap ( ) ,
460
465
position_encoding : self . position_encoding ,
466
+ in_test : self . in_test ,
461
467
resolved_client_capabilities : self . resolved_client_capabilities ,
462
468
}
463
469
}
@@ -649,6 +655,7 @@ pub(crate) struct SessionSnapshot {
649
655
index : Arc < Index > ,
650
656
position_encoding : PositionEncoding ,
651
657
resolved_client_capabilities : ResolvedClientCapabilities ,
658
+ in_test : bool ,
652
659
653
660
/// IMPORTANT: It's important that the databases come last, or at least,
654
661
/// after any `Arc` that we try to extract or mutate in-place using `Arc::into_inner`
@@ -678,6 +685,10 @@ impl SessionSnapshot {
678
685
pub ( crate ) fn resolved_client_capabilities ( & self ) -> ResolvedClientCapabilities {
679
686
self . resolved_client_capabilities
680
687
}
688
+
689
+ pub ( crate ) const fn in_test ( & self ) -> bool {
690
+ self . in_test
691
+ }
681
692
}
682
693
683
694
#[ derive( Debug , Default ) ]
0 commit comments