Skip to content
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

feat(format/grit): add basic formatting for where pattern #4095

Merged
merged 35 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bf2781f
Update tests
branberry Sep 26, 2024
c331c41
Update Cargo.toml
branberry Sep 26, 2024
8faaa59
fix test
branberry Sep 28, 2024
9a7ae07
Merge branch 'main' into feat/like
branberry Sep 28, 2024
083e1bf
fix(js-api): update code (#4111)
ematipico Sep 28, 2024
38fcbd3
fix(deps): update rust crate libc to 0.2.159 (#4126)
renovate[bot] Sep 30, 2024
4388e1e
fix(bench): typo in `.prettierignore` (#4134)
Jayllyz Sep 30, 2024
f783130
Resolve conflicts
branberry Sep 30, 2024
9b1757e
Update formatting for definition list
branberry Sep 30, 2024
45cb896
chore(deps): update pnpm to v9.11.0 (#4132)
renovate[bot] Sep 30, 2024
0037040
chore(deps): update dependency eslint to v9.11.1 (#4130)
renovate[bot] Sep 30, 2024
ab75e3d
chore(deps): update rust crate oxc_resolver to 1.12.0 (#4133)
renovate[bot] Sep 30, 2024
0e853fc
chore(deps): update actions/checkout action to v4.2.0 (#4127)
renovate[bot] Sep 30, 2024
5dea2f5
chore(deps): update rust:1.81.0 docker digest to a21d540 (#4123)
renovate[bot] Sep 30, 2024
af988a2
chore(deps): update dependency @typescript-eslint/eslint-plugin to v8…
renovate[bot] Sep 30, 2024
2e0173e
chore(deps): update @biomejs packages (#4124)
renovate[bot] Sep 30, 2024
aab92ef
fix(noMisleadingCharacterClass): properly handle escaping and improve…
Conaclos Sep 30, 2024
71d547e
ci: update codspeed action (#4139)
ematipico Sep 30, 2024
4a22da8
feat(biome_css_analyze): implement `noDescendingSpecificity` (#4097)
tunamaguro Sep 30, 2024
69faa78
Add formatting for predicate list and pattern where
branberry Oct 2, 2024
6061b25
Resolve merge conflicts
branberry Oct 2, 2024
fe7667d
Reorder tokens
branberry Oct 3, 2024
29ca5c4
Add where predicate
branberry Oct 5, 2024
de98431
Remove comments
branberry Oct 5, 2024
3cb4ad4
Add simple whitespace
branberry Oct 5, 2024
8949a61
Merge branch 'main' into feat/like
branberry Oct 5, 2024
73bb691
Create specific test for where pattern
branberry Oct 5, 2024
9d60af7
Undo change to package.json
branberry Oct 5, 2024
a6593fa
Add missing changes to get grit formatter options read in
branberry Oct 6, 2024
47c4f8a
Add basic error handling for predicate and definition lists
branberry Oct 6, 2024
07eb7bb
Revert test change
branberry Oct 7, 2024
092662f
Address PR comments and remove quote style
branberry Oct 7, 2024
a984aac
Update crates/biome_grit_formatter/src/grit/lists/definition_list.rs
branberry Oct 7, 2024
d44ea04
Remove comment
branberry Oct 7, 2024
834f340
format
branberry Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_grit_formatter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ biome_rowan = { workspace = true }
[dev-dependencies]
biome_configuration = { path = "../biome_configuration" }
biome_formatter_test = { path = "../biome_formatter_test" }
biome_fs = { workspace = true }
branberry marked this conversation as resolved.
Show resolved Hide resolved
biome_grit_factory = { path = "../biome_grit_factory" }
biome_grit_parser = { path = "../biome_grit_parser" }
biome_parser = { path = "../biome_parser" }
Expand Down
15 changes: 12 additions & 3 deletions crates/biome_grit_formatter/tests/language.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use biome_formatter_test::TestFormatLanguage;
use biome_fs::BiomePath;
use biome_grit_formatter::{context::GritFormatContext, GritFormatLanguage};
use biome_grit_parser::parse_grit;
use biome_grit_syntax::GritLanguage;
use biome_service::settings::ServiceLanguage;

#[derive(Default)]
pub struct GritTestFormatLanguage;
Expand All @@ -17,9 +19,16 @@ impl TestFormatLanguage for GritTestFormatLanguage {

fn to_format_language(
&self,
_settings: &biome_service::settings::Settings,
_file_source: &biome_service::workspace::DocumentFileSource,
settings: &biome_service::settings::Settings,
file_source: &biome_service::workspace::DocumentFileSource,
) -> Self::FormatLanguage {
todo!()
let options = Self::ServiceLanguage::resolve_format_options(
Some(&settings.formatter),
Some(&settings.override_settings),
None,
&BiomePath::new(""),
file_source,
);
GritFormatLanguage::new(options)
}
}
18 changes: 18 additions & 0 deletions crates/biome_grit_formatter/tests/specs/grit/file_node.grit.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ file(body = contains `console.$method` => `println`)```



## Unimplemented nodes/tokens

"file(body = contains `console.$method` => `println`)" => 0..52
## Output 1

-----
Indent style: Tab
Indent width: 2
Line ending: LF
Line width: 80
Attribute Position: Auto
-----

```grit
file(body = contains `console.$method` => `println`)```



## Unimplemented nodes/tokens

"file(body = contains `console.$method` => `println`)" => 0..52
1 change: 1 addition & 0 deletions crates/biome_grit_formatter/tests/specs/grit/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
ah-yu marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
`$method('$message')` where {
if ($message <: r"Hello, .*!") {
$method => `console.info`
} else {
$method => `console.warn`
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
ah-yu marked this conversation as resolved.
Show resolved Hide resolved
Loading