Skip to content

Commit 2db929a

Browse files
committed
more
1 parent ca4cede commit 2db929a

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xtask/codegen/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ biome_configuration = { workspace = true, optional = true }
2222
biome_css_analyze = { workspace = true, optional = true }
2323
biome_css_syntax = { workspace = true, optional = true }
2424
biome_diagnostics = { workspace = true, optional = true }
25+
biome_formatter = { workspace = true, optional = true }
2526
biome_graphql_analyze = { workspace = true, optional = true }
2627
biome_graphql_parser = { workspace = true, optional = true }
2728
biome_graphql_syntax = { workspace = true, optional = true }
@@ -68,6 +69,7 @@ schema = [
6869
"biome_json_parser",
6970
"biome_diagnostics",
7071
"biome_configuration",
72+
"biome_formatter",
7173
]
7274

7375
[lints]

xtask/codegen/src/generate_bindings.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use biome_js_factory::make;
2-
use biome_js_formatter::{context::JsFormatOptions, format_node};
2+
use biome_js_formatter::{
3+
context::JsFormatOptions, format_node, JsForeignLanguage, JsForeignLanguageFormatter,
4+
};
35
use biome_js_syntax::{
46
AnyJsBinding, AnyJsBindingPattern, AnyJsCallArgument, AnyJsDeclaration, AnyJsDeclarationClause,
57
AnyJsExportClause, AnyJsExpression, AnyJsFormalParameter, AnyJsImportClause,
@@ -13,6 +15,19 @@ use biome_string_case::Case;
1315
use xtask::{project_root, Mode, Result};
1416
use xtask_codegen::update;
1517

18+
#[derive(Debug, Clone)]
19+
struct FakeFormater;
20+
21+
impl JsForeignLanguageFormatter for FakeFormater {
22+
fn format(
23+
&self,
24+
_language: JsForeignLanguage,
25+
_content: &str,
26+
) -> biome_formatter::FormatResult<biome_formatter::prelude::Document> {
27+
Err(biome_formatter::FormatError::SyntaxError)
28+
}
29+
}
30+
1631
pub(crate) fn generate_workspace_bindings(mode: Mode) -> Result<()> {
1732
let bindings_path = project_root().join("packages/@biomejs/backend-jsonrpc/src/workspace.ts");
1833
let methods = methods();
@@ -424,7 +439,12 @@ pub(crate) fn generate_workspace_bindings(mode: Mode) -> Result<()> {
424439
)
425440
.build();
426441

427-
let formatted = format_node(JsFormatOptions::new(JsFileSource::ts()), module.syntax()).unwrap();
442+
let formatted = format_node(
443+
JsFormatOptions::new(JsFileSource::ts()),
444+
FakeFormater,
445+
module.syntax(),
446+
)
447+
.unwrap();
428448
let printed = formatted.print().unwrap();
429449
let code = printed.into_code();
430450

0 commit comments

Comments
 (0)