-
-
Notifications
You must be signed in to change notification settings - Fork 566
fix(cli): relative file path formatting (#5565) #5568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1f951cf
to
ad73ecd
Compare
ad73ecd
to
4752041
Compare
I'm afraid that failing test indicates a regression... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this approach doesn't work. There are a few things to keep in mind:
-
diagnostics aren't - and shouldn't - be aware of the concept of "relative" and "absolute" paths.
-
File paths are provided to the diagnostics at the source, when we create them, meaning we should avoid as much mutation as possible by the time we print them.
-
Some diagnostics are created during the crawling of the file system. These diagnostics say "Biome can't handle this file extension". This is the struct:
biome/crates/biome_service/src/diagnostics.rs
Lines 317 to 321 in 8227773
pub struct SourceFileNotSupported { file_source: DocumentFileSource, path: String, extension: Option<String>, } We throw this error in a couple of places, and the tricky one is when we use this function, because it's a pure function used in few palces:
biome/crates/biome_service/src/diagnostics.rs
Lines 427 to 434 in 8227773
pub fn extension_error(path: &BiomePath) -> WorkspaceError { let file_source = DocumentFileSource::from_path(path); WorkspaceError::source_file_not_supported( file_source, path.clone().to_string(), path.clone().extension().map(|p| p.to_string()), ) }
@@ -119,7 +119,7 @@ impl ReporterVisitor for ConsoleReporterVisitor<'_> { | |||
} | |||
|
|||
if diagnostic.severity() >= diagnostics_payload.diagnostic_level { | |||
if diagnostic.tags().is_verbose() && diagnostics_payload.verbose { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed? Both conditions must be checked
let name = if verbose { | ||
name | ||
} else { | ||
get_relative_file_path(name) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this change. Can you explain it?
Summary
Here is a potential fix for the issue #5565
Closes #5565
Test Plan
Here is new output format: