@@ -173,8 +173,10 @@ impl GlobalState {
173
173
}
174
174
175
175
if self . config . discover_workspace_config ( ) . is_none ( ) {
176
- let req = FetchWorkspaceRequest { path : None , force_crate_graph_reload : false } ;
177
- self . fetch_workspaces_queue . request_op ( "startup" . to_owned ( ) , req) ;
176
+ self . fetch_workspaces_queue . request_op (
177
+ "startup" . to_owned ( ) ,
178
+ FetchWorkspaceRequest { path : None , force_crate_graph_reload : false } ,
179
+ ) ;
178
180
if let Some ( ( cause, FetchWorkspaceRequest { path, force_crate_graph_reload } ) ) =
179
181
self . fetch_workspaces_queue . should_start_op ( )
180
182
{
@@ -545,6 +547,10 @@ impl GlobalState {
545
547
let snapshot = self . snapshot ( ) ;
546
548
self . task_pool . handle . spawn_with_sender ( ThreadIntent :: LatencySensitive , {
547
549
let subscriptions = subscriptions. clone ( ) ;
550
+ // Do not fetch semantic diagnostics (and populate query results) if we haven't even
551
+ // loaded the initial workspace yet.
552
+ let fetch_semantic =
553
+ self . vfs_done && self . fetch_workspaces_queue . last_op_result ( ) . is_some ( ) ;
548
554
move |sender| {
549
555
let diags = fetch_native_diagnostics (
550
556
& snapshot,
@@ -556,22 +562,29 @@ impl GlobalState {
556
562
. send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Syntax ( generation, diags) ) )
557
563
. unwrap ( ) ;
558
564
559
- let diags = fetch_native_diagnostics (
560
- & snapshot,
561
- subscriptions,
562
- slice,
563
- NativeDiagnosticsFetchKind :: Semantic ,
564
- ) ;
565
- sender
566
- . send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Semantic ( generation, diags) ) )
567
- . unwrap ( ) ;
565
+ if fetch_semantic {
566
+ let diags = fetch_native_diagnostics (
567
+ & snapshot,
568
+ subscriptions,
569
+ slice,
570
+ NativeDiagnosticsFetchKind :: Semantic ,
571
+ ) ;
572
+ sender
573
+ . send ( Task :: Diagnostics ( DiagnosticsTaskKind :: Semantic (
574
+ generation, diags,
575
+ ) ) )
576
+ . unwrap ( ) ;
577
+ }
568
578
}
569
579
} ) ;
570
580
start = end;
571
581
}
572
582
}
573
583
574
584
fn update_tests ( & mut self ) {
585
+ if !self . vfs_done {
586
+ return ;
587
+ }
575
588
let db = self . analysis_host . raw_database ( ) ;
576
589
let subscriptions = self
577
590
. mem_docs
@@ -1052,9 +1065,9 @@ impl GlobalState {
1052
1065
. on :: < NO_RETRY , lsp_request:: GotoImplementation > ( handlers:: handle_goto_implementation)
1053
1066
. on :: < NO_RETRY , lsp_request:: GotoTypeDefinition > ( handlers:: handle_goto_type_definition)
1054
1067
. on :: < NO_RETRY , lsp_request:: InlayHintRequest > ( handlers:: handle_inlay_hints)
1055
- . on :: < NO_RETRY , lsp_request:: InlayHintResolveRequest > ( handlers:: handle_inlay_hints_resolve)
1068
+ . on_identity :: < NO_RETRY , lsp_request:: InlayHintResolveRequest , _ > ( handlers:: handle_inlay_hints_resolve)
1056
1069
. on :: < NO_RETRY , lsp_request:: CodeLensRequest > ( handlers:: handle_code_lens)
1057
- . on :: < NO_RETRY , lsp_request:: CodeLensResolve > ( handlers:: handle_code_lens_resolve)
1070
+ . on_identity :: < NO_RETRY , lsp_request:: CodeLensResolve , _ > ( handlers:: handle_code_lens_resolve)
1058
1071
. on :: < NO_RETRY , lsp_request:: PrepareRenameRequest > ( handlers:: handle_prepare_rename)
1059
1072
. on :: < NO_RETRY , lsp_request:: Rename > ( handlers:: handle_rename)
1060
1073
. on :: < NO_RETRY , lsp_request:: References > ( handlers:: handle_references)
@@ -1081,7 +1094,7 @@ impl GlobalState {
1081
1094
. on :: < NO_RETRY , lsp_ext:: Runnables > ( handlers:: handle_runnables)
1082
1095
. on :: < NO_RETRY , lsp_ext:: RelatedTests > ( handlers:: handle_related_tests)
1083
1096
. on :: < NO_RETRY , lsp_ext:: CodeActionRequest > ( handlers:: handle_code_action)
1084
- . on :: < RETRY , lsp_ext:: CodeActionResolveRequest > ( handlers:: handle_code_action_resolve)
1097
+ . on_identity :: < RETRY , lsp_ext:: CodeActionResolveRequest , _ > ( handlers:: handle_code_action_resolve)
1085
1098
. on :: < NO_RETRY , lsp_ext:: HoverRequest > ( handlers:: handle_hover)
1086
1099
. on :: < NO_RETRY , lsp_ext:: ExternalDocs > ( handlers:: handle_open_docs)
1087
1100
. on :: < NO_RETRY , lsp_ext:: OpenCargoToml > ( handlers:: handle_open_cargo_toml)
0 commit comments