@@ -11,6 +11,7 @@ use flycheck::FlycheckHandle;
11
11
use ide_db:: base_db:: { SourceDatabaseExt , VfsPath } ;
12
12
use lsp_server:: { Connection , Notification , Request } ;
13
13
use lsp_types:: notification:: Notification as _;
14
+ use stdx:: thread:: ThreadIntent ;
14
15
use triomphe:: Arc ;
15
16
use vfs:: FileId ;
16
17
@@ -282,6 +283,7 @@ impl GlobalState {
282
283
}
283
284
}
284
285
}
286
+ let event_handling_duration = loop_start. elapsed ( ) ;
285
287
286
288
let state_changed = self . process_changes ( ) ;
287
289
let memdocs_added_or_removed = self . mem_docs . take_changes ( ) ;
@@ -392,9 +394,9 @@ impl GlobalState {
392
394
393
395
let loop_duration = loop_start. elapsed ( ) ;
394
396
if loop_duration > Duration :: from_millis ( 100 ) && was_quiescent {
395
- tracing:: warn!( "overly long loop turn took {loop_duration:?}: {event_dbg_msg}" ) ;
397
+ tracing:: warn!( "overly long loop turn took {loop_duration:?} (event handling took {event_handling_duration:?}) : {event_dbg_msg}" ) ;
396
398
self . poke_rust_analyzer_developer ( format ! (
397
- "overly long loop turn took {loop_duration:?}: {event_dbg_msg}"
399
+ "overly long loop turn took {loop_duration:?} (event handling took {event_handling_duration:?}) : {event_dbg_msg}"
398
400
) ) ;
399
401
}
400
402
Ok ( ( ) )
@@ -404,7 +406,7 @@ impl GlobalState {
404
406
tracing:: debug!( %cause, "will prime caches" ) ;
405
407
let num_worker_threads = self . config . prime_caches_num_threads ( ) ;
406
408
407
- self . task_pool . handle . spawn_with_sender ( stdx :: thread :: ThreadIntent :: Worker , {
409
+ self . task_pool . handle . spawn_with_sender ( ThreadIntent :: Worker , {
408
410
let analysis = self . snapshot ( ) . analysis ;
409
411
move |sender| {
410
412
sender. send ( Task :: PrimeCaches ( PrimeCachesProgress :: Begin ) ) . unwrap ( ) ;
@@ -761,18 +763,28 @@ impl GlobalState {
761
763
use lsp_types:: notification as notifs;
762
764
763
765
NotificationDispatcher { not : Some ( not) , global_state : self }
764
- . on :: < notifs:: Cancel > ( handlers:: handle_cancel) ?
765
- . on :: < notifs:: WorkDoneProgressCancel > ( handlers:: handle_work_done_progress_cancel) ?
766
- . on :: < notifs:: DidOpenTextDocument > ( handlers:: handle_did_open_text_document) ?
767
- . on :: < notifs:: DidChangeTextDocument > ( handlers:: handle_did_change_text_document) ?
768
- . on :: < notifs:: DidCloseTextDocument > ( handlers:: handle_did_close_text_document) ?
769
- . on :: < notifs:: DidSaveTextDocument > ( handlers:: handle_did_save_text_document) ?
770
- . on :: < notifs:: DidChangeConfiguration > ( handlers:: handle_did_change_configuration) ?
771
- . on :: < notifs:: DidChangeWorkspaceFolders > ( handlers:: handle_did_change_workspace_folders) ?
772
- . on :: < notifs:: DidChangeWatchedFiles > ( handlers:: handle_did_change_watched_files) ?
773
- . on :: < lsp_ext:: CancelFlycheck > ( handlers:: handle_cancel_flycheck) ?
774
- . on :: < lsp_ext:: ClearFlycheck > ( handlers:: handle_clear_flycheck) ?
775
- . on :: < lsp_ext:: RunFlycheck > ( handlers:: handle_run_flycheck) ?
766
+ . on_sync_mut :: < notifs:: Cancel > ( handlers:: handle_cancel) ?
767
+ . on_sync_mut :: < notifs:: WorkDoneProgressCancel > (
768
+ handlers:: handle_work_done_progress_cancel,
769
+ ) ?
770
+ . on_sync_mut :: < notifs:: DidOpenTextDocument > ( handlers:: handle_did_open_text_document) ?
771
+ . on_sync_mut :: < notifs:: DidChangeTextDocument > (
772
+ handlers:: handle_did_change_text_document,
773
+ ) ?
774
+ . on_sync_mut :: < notifs:: DidCloseTextDocument > ( handlers:: handle_did_close_text_document) ?
775
+ . on_sync_mut :: < notifs:: DidSaveTextDocument > ( handlers:: handle_did_save_text_document) ?
776
+ . on_sync_mut :: < notifs:: DidChangeConfiguration > (
777
+ handlers:: handle_did_change_configuration,
778
+ ) ?
779
+ . on_sync_mut :: < notifs:: DidChangeWorkspaceFolders > (
780
+ handlers:: handle_did_change_workspace_folders,
781
+ ) ?
782
+ . on_sync_mut :: < notifs:: DidChangeWatchedFiles > (
783
+ handlers:: handle_did_change_watched_files,
784
+ ) ?
785
+ . on_sync_mut :: < lsp_ext:: CancelFlycheck > ( handlers:: handle_cancel_flycheck) ?
786
+ . on_sync_mut :: < lsp_ext:: ClearFlycheck > ( handlers:: handle_clear_flycheck) ?
787
+ . on_sync_mut :: < lsp_ext:: RunFlycheck > ( handlers:: handle_run_flycheck) ?
776
788
. finish ( ) ;
777
789
Ok ( ( ) )
778
790
}
@@ -800,7 +812,7 @@ impl GlobalState {
800
812
801
813
// Diagnostics are triggered by the user typing
802
814
// so we run them on a latency sensitive thread.
803
- self . task_pool . handle . spawn ( stdx :: thread :: ThreadIntent :: LatencySensitive , move || {
815
+ self . task_pool . handle . spawn ( ThreadIntent :: LatencySensitive , move || {
804
816
let _p = profile:: span ( "publish_diagnostics" ) ;
805
817
let _ctx = stdx:: panic_context:: enter ( "publish_diagnostics" . to_owned ( ) ) ;
806
818
let diagnostics = subscriptions
0 commit comments