File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
crates/rust-analyzer/src/handlers Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -139,16 +139,26 @@ impl RequestDispatcher<'_> {
139139 self . on_with_thread_intent :: < true , ALLOW_RETRYING , R > ( ThreadIntent :: Worker , f)
140140 }
141141
142- /// Dispatches a latency-sensitive request onto the thread pool.
142+ /// Dispatches a latency-sensitive request onto the thread pool. When the VFS is marked not
143+ /// ready this will return a default constructed [`R::Result`].
143144 pub ( crate ) fn on_latency_sensitive < const ALLOW_RETRYING : bool , R > (
144145 & mut self ,
145146 f : fn ( GlobalStateSnapshot , R :: Params ) -> anyhow:: Result < R :: Result > ,
146147 ) -> & mut Self
147148 where
148- R : lsp_types:: request:: Request + ' static ,
149- R :: Params : DeserializeOwned + panic:: UnwindSafe + Send + fmt:: Debug ,
150- R :: Result : Serialize ,
149+ R : lsp_types:: request:: Request <
150+ Params : DeserializeOwned + panic:: UnwindSafe + Send + fmt:: Debug ,
151+ Result : Serialize + Default ,
152+ > + ' static ,
151153 {
154+ if !self . global_state . vfs_done {
155+ if let Some ( lsp_server:: Request { id, .. } ) =
156+ self . req . take_if ( |it| it. method == R :: METHOD )
157+ {
158+ self . global_state . respond ( lsp_server:: Response :: new_ok ( id, R :: Result :: default ( ) ) ) ;
159+ }
160+ return self ;
161+ }
152162 self . on_with_thread_intent :: < true , ALLOW_RETRYING , R > ( ThreadIntent :: LatencySensitive , f)
153163 }
154164
You can’t perform that action at this time.
0 commit comments