1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-18 05:14:21 -05:00
Bartek Iwańczuk 2024-12-03 01:04:55 +00:00 committed by GitHub
parent 76571fd5a5
commit 53936eda11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 30 additions and 8 deletions

4
Cargo.lock generated
View file

@ -4682,9 +4682,9 @@ dependencies = [
[[package]] [[package]]
name = "markup_fmt" name = "markup_fmt"
version = "0.16.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f303c36143671ac6c54112eb5aa95649b169dae783fdb6ead2c0e88b408c425c" checksum = "fa7605bb4ad755a9ab5c96f2ce3bfd4eb8acd559b842c041fc8a5f84d63aed3a"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"css_dataset", "css_dataset",

View file

@ -130,7 +130,7 @@ libz-sys.workspace = true
log = { workspace = true, features = ["serde"] } log = { workspace = true, features = ["serde"] }
lsp-types.workspace = true lsp-types.workspace = true
malva = "=0.11.0" malva = "=0.11.0"
markup_fmt = "=0.16.0" markup_fmt = "=0.18.0"
memmem.workspace = true memmem.workspace = true
monch.workspace = true monch.workspace = true
notify.workspace = true notify.workspace = true

View file

@ -440,8 +440,10 @@ pub fn format_html(
) )
} }
_ => { _ => {
let mut typescript_config = let mut typescript_config_builder =
get_resolved_typescript_config(fmt_options); get_typescript_config_builder(fmt_options);
typescript_config_builder.file_indent_level(hints.indent_level);
let mut typescript_config = typescript_config_builder.build();
typescript_config.line_width = hints.print_width as u32; typescript_config.line_width = hints.print_width as u32;
dprint_plugin_typescript::format_text( dprint_plugin_typescript::format_text(
&path, &path,
@ -919,9 +921,9 @@ fn files_str(len: usize) -> &'static str {
} }
} }
fn get_resolved_typescript_config( fn get_typescript_config_builder(
options: &FmtOptionsConfig, options: &FmtOptionsConfig,
) -> dprint_plugin_typescript::configuration::Configuration { ) -> dprint_plugin_typescript::configuration::ConfigurationBuilder {
let mut builder = let mut builder =
dprint_plugin_typescript::configuration::ConfigurationBuilder::new(); dprint_plugin_typescript::configuration::ConfigurationBuilder::new();
builder.deno(); builder.deno();
@ -953,7 +955,13 @@ fn get_resolved_typescript_config(
}); });
} }
builder.build() builder
}
fn get_resolved_typescript_config(
options: &FmtOptionsConfig,
) -> dprint_plugin_typescript::configuration::Configuration {
get_typescript_config_builder(options).build()
} }
fn get_resolved_markdown_config( fn get_resolved_markdown_config(
@ -1075,6 +1083,7 @@ fn get_resolved_markup_fmt_config(
}; };
let language_options = LanguageOptions { let language_options = LanguageOptions {
script_formatter: Some(markup_fmt::config::ScriptFormatter::Dprint),
quotes: Quotes::Double, quotes: Quotes::Double,
format_comments: false, format_comments: false,
script_indent: true, script_indent: true,

View file

@ -12,6 +12,10 @@
"broken": { "broken": {
"args": "fmt broken.html", "args": "fmt broken.html",
"output": "broken.out" "output": "broken.out"
},
"with_js": {
"args": "fmt --check with_js.html",
"output": "Checked 1 file\n"
} }
} }
} }

View file

@ -0,0 +1,9 @@
<html>
<body>
<script>
/* some multi-line comment
with function below it */
someFunc();
</script>
</body>
</html>