File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
code_analysis/src/config/configs Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ pub struct EmmyrcDiagnostic {
2828 /// A list of diagnostic codes that are enabled.
2929 #[ serde( default ) ]
3030 pub enables : Vec < DiagnosticCode > ,
31+ /// The interval in milliseconds to perform diagnostics.
32+ pub diagnostic_interval : Option < u64 > ,
3133}
3234
3335impl Default for EmmyrcDiagnostic {
@@ -39,6 +41,7 @@ impl Default for EmmyrcDiagnostic {
3941 globals_regex : Vec :: new ( ) ,
4042 severity : HashMap :: new ( ) ,
4143 enables : Vec :: new ( ) ,
44+ diagnostic_interval : Some ( 500 ) ,
4245 }
4346 }
4447}
Original file line number Diff line number Diff line change @@ -44,14 +44,16 @@ impl FileDiagnostic {
4444 drop ( tokens) ; // free the lock
4545
4646 let analysis = self . analysis . clone ( ) ;
47+ let emmyrc = analysis. read ( ) . await . get_emmyrc ( ) ;
48+ let interval = emmyrc. diagnostics . diagnostic_interval . unwrap_or ( 500 ) ;
4749 let client = self . client . clone ( ) ;
4850 let diagnostic_tokens = self . diagnostic_tokens . clone ( ) ;
4951 let file_id_clone = file_id. clone ( ) ;
5052
5153 // Spawn a new task to perform diagnostic
5254 tokio:: spawn ( async move {
5355 tokio:: select! {
54- _ = tokio:: time:: sleep( Duration :: from_millis( 500 ) ) => {
56+ _ = tokio:: time:: sleep( Duration :: from_millis( interval ) ) => {
5557 let analysis = analysis. read( ) . await ;
5658 if let Some ( uri) = analysis. get_uri( file_id_clone) {
5759 let diagnostics = analysis. diagnose_file( file_id_clone, cancel_token) . await ;
Original file line number Diff line number Diff line change 3636 },
3737 "diagnostics" : {
3838 "default" : {
39+ "diagnosticInterval" : 500 ,
3940 "disable" : [],
4041 "enable" : true ,
4142 "enables" : [],
413414 "description" : " Represents the diagnostic configuration for Emmyrc." ,
414415 "type" : " object" ,
415416 "properties" : {
417+ "diagnosticInterval" : {
418+ "description" : " The interval in milliseconds to perform diagnostics." ,
419+ "type" : [
420+ " integer" ,
421+ " null"
422+ ],
423+ "format" : " uint64" ,
424+ "minimum" : 0.0
425+ },
416426 "disable" : {
417427 "description" : " A list of diagnostic codes that are disabled." ,
418428 "default" : [],
You can’t perform that action at this time.
0 commit comments