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 1
1
use itertools:: Itertools ;
2
- use log:: info;
2
+ use log:: { debug , info} ;
3
3
use ra_ap_base_db:: SourceDatabase ;
4
4
use ra_ap_base_db:: SourceDatabaseFileInputExt ;
5
5
use ra_ap_hir:: Semantics ;
@@ -119,10 +119,21 @@ pub fn find_project_manifests(
119
119
. map ( |path| AbsPathBuf :: assert_utf8 ( current. join ( path) ) )
120
120
. collect ( ) ;
121
121
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
+ }
126
137
Ok ( ret)
127
138
}
128
139
fn 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> {
142
142
self . trap . emit_location ( self . label , label, start, end)
143
143
} else {
144
144
self . emit_diagnostic (
145
- DiagnosticSeverity :: Info ,
145
+ DiagnosticSeverity :: Debug ,
146
146
"locations" . to_owned ( ) ,
147
147
"missing location for AstNode" . to_owned ( ) ,
148
148
"missing location for AstNode" . to_owned ( ) ,
@@ -189,14 +189,16 @@ impl<'a> Translator<'a> {
189
189
start. col + 1 ,
190
190
& error_message
191
191
) ;
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
+ }
200
202
}
201
203
pub fn emit_parse_error ( & mut self , owner : & impl ast:: AstNode , err : & SyntaxError ) {
202
204
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 {
128
128
compression : Compression ,
129
129
}
130
130
131
- #[ derive( Copy , Clone ) ]
131
+ #[ derive( Copy , Clone , PartialEq , Eq ) ]
132
132
pub enum DiagnosticSeverity {
133
133
Debug = 10 ,
134
134
Info = 20 ,
You can’t perform that action at this time.
0 commit comments