File tree Expand file tree Collapse file tree 3 files changed +28
-15
lines changed
Expand file tree Collapse file tree 3 files changed +28
-15
lines changed Original file line number Diff line number Diff line change 11use itertools:: Itertools ;
2- use log:: info;
2+ use log:: { debug , info} ;
33use ra_ap_base_db:: SourceDatabase ;
44use ra_ap_base_db:: SourceDatabaseFileInputExt ;
55use ra_ap_hir:: Semantics ;
@@ -119,10 +119,21 @@ pub fn find_project_manifests(
119119 . map ( |path| AbsPathBuf :: assert_utf8 ( current. join ( path) ) )
120120 . collect ( ) ;
121121 let ret = ra_ap_project_model:: ProjectManifest :: discover_all ( & abs_files) ;
122- info ! (
123- "found manifests: {}" ,
124- ret. iter( ) . map( |m| format!( "{m}" ) ) . join( ", " )
125- ) ;
122+ let iter = || ret. iter ( ) . map ( |m| format ! ( " {m}" ) ) ;
123+ const log_limit: usize = 10 ;
124+ if ret. len ( ) <= log_limit {
125+ info ! ( "found manifests:\n {}" , iter( ) . join( "\n " ) ) ;
126+ } else {
127+ info ! (
128+ "found manifests:\n {}\n and {} more" ,
129+ iter( ) . take( log_limit) . join( "\n " ) ,
130+ ret. len( ) - log_limit
131+ ) ;
132+ debug ! (
133+ "rest of the manifests found:\n {}" ,
134+ iter( ) . dropping( log_limit) . join( "\n " )
135+ ) ;
136+ }
126137 Ok ( ret)
127138}
128139fn from_utf8_lossy ( v : & [ u8 ] ) -> ( Cow < ' _ , str > , Option < SyntaxError > ) {
Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ impl<'a> Translator<'a> {
142142 self . trap . emit_location ( self . label , label, start, end)
143143 } else {
144144 self . emit_diagnostic (
145- DiagnosticSeverity :: Info ,
145+ DiagnosticSeverity :: Debug ,
146146 "locations" . to_owned ( ) ,
147147 "missing location for AstNode" . to_owned ( ) ,
148148 "missing location for AstNode" . to_owned ( ) ,
@@ -189,14 +189,16 @@ impl<'a> Translator<'a> {
189189 start. col + 1 ,
190190 & error_message
191191 ) ;
192- let location = self . trap . emit_location_label ( self . label , start, end) ;
193- self . trap . emit_diagnostic (
194- severity,
195- error_tag,
196- error_message,
197- full_error_message,
198- location,
199- ) ;
192+ if severity != DiagnosticSeverity :: Debug {
193+ let location = self . trap . emit_location_label ( self . label , start, end) ;
194+ self . trap . emit_diagnostic (
195+ severity,
196+ error_tag,
197+ error_message,
198+ full_error_message,
199+ location,
200+ ) ;
201+ }
200202 }
201203 pub fn emit_parse_error ( & mut self , owner : & impl ast:: AstNode , err : & SyntaxError ) {
202204 let owner_range: TextRange = owner. syntax ( ) . text_range ( ) ;
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ pub struct TrapFile {
128128 compression : Compression ,
129129}
130130
131- #[ derive( Copy , Clone ) ]
131+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
132132pub enum DiagnosticSeverity {
133133 Debug = 10 ,
134134 Info = 20 ,
You can’t perform that action at this time.
0 commit comments