-
-
Notifications
You must be signed in to change notification settings - Fork 963
feat(fmt/md): ordered lists and space normalization #9998
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 3 additions & 18 deletions
21
crates/biome_html_formatter/src/html/any/attribute_initializer.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,17 @@ | ||
| //! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file. | ||
|
|
||
| use crate::prelude::*; | ||
| use biome_formatter::FormatRuleWithOptions; | ||
| use biome_html_syntax::AnyHtmlAttributeInitializer; | ||
| #[derive(Debug, Clone, Default)] | ||
| pub(crate) struct FormatAnyHtmlAttributeInitializer { | ||
| compact: bool, | ||
| } | ||
|
|
||
| pub(crate) struct FormatAnyHtmlAttributeInitializer; | ||
| impl FormatRule<AnyHtmlAttributeInitializer> for FormatAnyHtmlAttributeInitializer { | ||
| type Context = HtmlFormatContext; | ||
| fn fmt(&self, node: &AnyHtmlAttributeInitializer, f: &mut HtmlFormatter) -> FormatResult<()> { | ||
| match node { | ||
| AnyHtmlAttributeInitializer::HtmlAttributeSingleTextExpression(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| AnyHtmlAttributeInitializer::HtmlString(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| node.format().fmt(f) | ||
| } | ||
| AnyHtmlAttributeInitializer::HtmlString(node) => node.format().fmt(f), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl FormatRuleWithOptions<AnyHtmlAttributeInitializer> for FormatAnyHtmlAttributeInitializer { | ||
| type Options = bool; | ||
|
|
||
| fn with_options(mut self, options: Self::Options) -> Self { | ||
| self.compact = options; | ||
| self | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| use crate::AsFormat; | ||
| use crate::context::HtmlFormatContext; | ||
| use biome_formatter::formatter::Formatter; | ||
| use biome_formatter::{Format, FormatResult}; | ||
| use biome_html_syntax::{AnyHtmlAttributeInitializer, AnySvelteBindingProperty}; | ||
|
|
||
| pub(crate) struct FmtAnyAttributeInitializer { | ||
| pub(crate) node: AnyHtmlAttributeInitializer, | ||
| pub(crate) compact: bool, | ||
| } | ||
|
|
||
| impl Format<HtmlFormatContext> for FmtAnyAttributeInitializer { | ||
| fn fmt(&self, f: &mut Formatter<HtmlFormatContext>) -> FormatResult<()> { | ||
| match &self.node { | ||
| AnyHtmlAttributeInitializer::HtmlAttributeSingleTextExpression(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| AnyHtmlAttributeInitializer::HtmlString(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| pub(crate) struct FmtAnySvelteBindingProperty { | ||
| pub(crate) node: AnySvelteBindingProperty, | ||
| pub(crate) compact: bool, | ||
| } | ||
|
|
||
| impl Format<HtmlFormatContext> for FmtAnySvelteBindingProperty { | ||
| fn fmt(&self, f: &mut Formatter<HtmlFormatContext>) -> FormatResult<()> { | ||
| match &self.node { | ||
| AnySvelteBindingProperty::SvelteLiteral(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| AnySvelteBindingProperty::SvelteMemberProperty(node) => node.format().fmt(f), | ||
| AnySvelteBindingProperty::SvelteName(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| } | ||
| } | ||
| } |
24 changes: 3 additions & 21 deletions
24
crates/biome_html_formatter/src/svelte/any/binding_property.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,16 @@ | ||
| //! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file. | ||
|
|
||
| use crate::prelude::*; | ||
| use biome_formatter::FormatRuleWithOptions; | ||
| use biome_html_syntax::AnySvelteBindingProperty; | ||
| #[derive(Debug, Clone, Default)] | ||
| pub(crate) struct FormatAnySvelteBindingProperty { | ||
| /// Whether it should be formatted in compact mode. In compact mode, all tokens and children | ||
| /// are removed | ||
| pub compact: bool, | ||
| } | ||
| pub(crate) struct FormatAnySvelteBindingProperty; | ||
| impl FormatRule<AnySvelteBindingProperty> for FormatAnySvelteBindingProperty { | ||
| type Context = HtmlFormatContext; | ||
| fn fmt(&self, node: &AnySvelteBindingProperty, f: &mut HtmlFormatter) -> FormatResult<()> { | ||
| match node { | ||
| AnySvelteBindingProperty::SvelteLiteral(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| AnySvelteBindingProperty::SvelteLiteral(node) => node.format().fmt(f), | ||
| AnySvelteBindingProperty::SvelteMemberProperty(node) => node.format().fmt(f), | ||
| AnySvelteBindingProperty::SvelteName(node) => { | ||
| node.format().with_options(self.compact).fmt(f) | ||
| } | ||
| AnySvelteBindingProperty::SvelteName(node) => node.format().fmt(f), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl FormatRuleWithOptions<AnySvelteBindingProperty> for FormatAnySvelteBindingProperty { | ||
| type Options = bool; | ||
|
|
||
| fn with_options(mut self, options: Self::Options) -> Self { | ||
| self.compact = options; | ||
| self | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Use the language-specific
gen-formattercommand here.just gen-formatternudges readers towards the wrong invocation; this doc should match the repo workflow and spell out the<lang>argument.Suggested tweak
As per coding guidelines,
Run 'just gen-formatter <lang>' before opening a PR when making changes to formatter implementations in *_formatter crates.🤖 Prompt for AI Agents
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.
@coderabbitai did you verify your claim? I believe
gen-formatterdoesn't accept a lang argumentThere 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.
🧩 Analysis chain
Let me check the actual
justfileto verify this.🏁 Script executed:
Length of output: 304
@ematipico, you're right — I should have verified before flagging. Thejustfiledefines:The
*args=''makes the argument optional, sojust gen-formatter(no lang) is perfectly valid. My suggestion was wrong, and the existing doc is correct as-is. I'll update the learning.Sorry for the noise! 🐇
⛔ Learnings removed
🧠 Learnings used