@@ -45,9 +45,7 @@ pub use crate::visitor::{NodeVisitor, Visitor, VisitorContext, VisitorFinishCont
4545pub use rule:: DeserializableRuleOptions ;
4646
4747use rome_console:: markup;
48- use rome_diagnostics:: {
49- category, Applicability , Diagnostic , DiagnosticExt , DiagnosticTags , FileId ,
50- } ;
48+ use rome_diagnostics:: { category, Applicability , Diagnostic , DiagnosticExt , DiagnosticTags } ;
5149use rome_rowan:: {
5250 AstNode , BatchMutation , Direction , Language , SyntaxElement , SyntaxToken , TextRange , TextSize ,
5351 TokenAtOffset , TriviaPieceKind , WalkEvent ,
@@ -75,7 +73,6 @@ pub struct Analyzer<'analyzer, L: Language, Matcher, Break, Diag> {
7573}
7674
7775pub struct AnalyzerContext < ' a , L : Language > {
78- pub file_id : FileId ,
7976 pub root : LanguageRoot < L > ,
8077 pub services : ServiceBag ,
8178 pub range : Option < TextRange > ,
@@ -140,7 +137,6 @@ where
140137 line_index : & mut line_index,
141138 line_suppressions : & mut line_suppressions,
142139 emit_signal : & mut emit_signal,
143- file_id : ctx. file_id ,
144140 root : & ctx. root ,
145141 services : & ctx. services ,
146142 range : ctx. range ,
@@ -178,7 +174,6 @@ where
178174
179175 let signal = DiagnosticSignal :: new ( || {
180176 SuppressionDiagnostic :: new (
181- ctx. file_id ,
182177 category ! ( "suppressions/unused" ) ,
183178 suppression. comment_span ,
184179 "Suppression comment is not being used" ,
@@ -216,8 +211,6 @@ struct PhaseRunner<'analyzer, 'phase, L: Language, Matcher, Break, Diag> {
216211 line_suppressions : & ' phase mut Vec < LineSuppression > ,
217212 /// Handles analyzer signals emitted by individual rules
218213 emit_signal : & ' phase mut SignalHandler < ' analyzer , L , Break > ,
219- /// ID if the file being analyzed
220- file_id : FileId ,
221214 /// Root node of the file being analyzed
222215 root : & ' phase L :: Root ,
223216 /// Service bag handle for this phase
@@ -263,7 +256,7 @@ where
263256
264257 // If this is a token enter event, process its text content
265258 WalkEvent :: Enter ( SyntaxElement :: Token ( token) ) => {
266- self . handle_token ( self . file_id , token) ?;
259+ self . handle_token ( token) ?;
267260
268261 continue ;
269262 }
@@ -276,7 +269,6 @@ where
276269 for visitor in self . visitors . iter_mut ( ) {
277270 let ctx = VisitorContext {
278271 phase : self . phase ,
279- file_id : self . file_id ,
280272 root : self . root ,
281273 services : self . services ,
282274 range : self . range ,
@@ -301,7 +293,6 @@ where
301293 for visitor in self . visitors . iter_mut ( ) {
302294 let ctx = VisitorContext {
303295 phase : self . phase ,
304- file_id : self . file_id ,
305296 root : self . root ,
306297 services : self . services ,
307298 range : self . range ,
@@ -323,7 +314,7 @@ where
323314 /// Process the text for a single token, parsing suppression comments and
324315 /// handling line breaks, then flush all pending query signals in the queue
325316 /// whose position is less then the end of the token within the file
326- fn handle_token ( & mut self , file_id : FileId , token : SyntaxToken < L > ) -> ControlFlow < Break > {
317+ fn handle_token ( & mut self , token : SyntaxToken < L > ) -> ControlFlow < Break > {
327318 // Process the content of the token for comments and newline
328319 for ( index, piece) in token. leading_trivia ( ) . pieces ( ) . enumerate ( ) {
329320 if matches ! (
@@ -336,14 +327,7 @@ where
336327 }
337328
338329 if let Some ( comment) = piece. as_comments ( ) {
339- self . handle_comment (
340- file_id,
341- & token,
342- true ,
343- index,
344- comment. text ( ) ,
345- piece. text_range ( ) ,
346- ) ?;
330+ self . handle_comment ( & token, true , index, comment. text ( ) , piece. text_range ( ) ) ?;
347331 }
348332 }
349333
@@ -360,14 +344,7 @@ where
360344 }
361345
362346 if let Some ( comment) = piece. as_comments ( ) {
363- self . handle_comment (
364- file_id,
365- & token,
366- false ,
367- index,
368- comment. text ( ) ,
369- piece. text_range ( ) ,
370- ) ?;
347+ self . handle_comment ( & token, false , index, comment. text ( ) , piece. text_range ( ) ) ?;
371348 }
372349 }
373350
@@ -445,7 +422,6 @@ where
445422 /// comments, and create line suppression entries accordingly
446423 fn handle_comment (
447424 & mut self ,
448- file_id : FileId ,
449425 token : & SyntaxToken < L > ,
450426 is_leading : bool ,
451427 index : usize ,
@@ -464,7 +440,7 @@ where
464440 let signal = DiagnosticSignal :: new ( move || {
465441 let location = diag. location ( ) ;
466442 let span = location. span . map_or ( range, |span| span + range. start ( ) ) ;
467- diag. clone ( ) . with_file_path ( file_id ) . with_file_span ( span)
443+ diag. clone ( ) . with_file_span ( span)
468444 } ) ;
469445
470446 ( self . emit_signal ) ( & signal) ?;
@@ -498,14 +474,12 @@ where
498474 // Emit a warning for the unknown rule
499475 let signal = DiagnosticSignal :: new ( move || match group_rule {
500476 Some ( ( group, rule) ) => SuppressionDiagnostic :: new (
501- file_id,
502477 category ! ( "suppressions/unknownRule" ) ,
503478 range,
504479 format_args ! ( "Unknown lint rule {group}/{rule} in suppression comment" ) ,
505480 ) ,
506481
507482 None => SuppressionDiagnostic :: new (
508- file_id,
509483 category ! ( "suppressions/unknownGroup" ) ,
510484 range,
511485 format_args ! ( "Unknown lint rule group {rule} in suppression comment" ) ,
@@ -527,17 +501,15 @@ where
527501 if has_legacy && range_match ( self . range , range) {
528502 let signal = DiagnosticSignal :: new ( move || {
529503 SuppressionDiagnostic :: new (
530- file_id,
531504 category ! ( "suppressions/deprecatedSyntax" ) ,
532505 range,
533506 "Suppression is using a deprecated syntax" ,
534507 )
535508 . with_tags ( DiagnosticTags :: DEPRECATED_CODE )
536509 } ) ;
537510
538- let signal = signal. with_action ( || {
539- update_suppression ( file_id, self . root , token, is_leading, index, text)
540- } ) ;
511+ let signal = signal
512+ . with_action ( || update_suppression ( self . root , token, is_leading, index, text) ) ;
541513
542514 ( self . emit_signal ) ( & signal) ?;
543515 }
@@ -642,7 +614,6 @@ pub enum SuppressionKind<'a> {
642614}
643615
644616fn update_suppression < L : Language > (
645- file_id : FileId ,
646617 root : & L :: Root ,
647618 token : & SyntaxToken < L > ,
648619 is_leading : bool ,
@@ -687,7 +658,6 @@ fn update_suppression<L: Language>(
687658
688659 Some ( AnalyzerAction {
689660 rule_name : None ,
690- file_id,
691661 category : ActionCategory :: QuickFix ,
692662 applicability : Applicability :: Always ,
693663 message : markup ! {
0 commit comments