diff options
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | cli/Cargo.toml | 2 | ||||
-rw-r--r-- | cli/tools/fmt.rs | 12 | ||||
-rw-r--r-- | tests/specs/fmt/html/broken.out | 2 |
4 files changed, 5 insertions, 15 deletions
diff --git a/Cargo.lock b/Cargo.lock index 063811848..a1a02e3e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4342,9 +4342,9 @@ dependencies = [ [[package]] name = "markup_fmt" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74fc137a4a591720176339bf7e857586a48ff35c0caee7ad6cf709327901232c" +checksum = "9dab5ae899659fbe5c8835b2c8ca8d3e357974a3e454138925b404004973361f" dependencies = [ "aho-corasick", "css_dataset", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index b4fd053d7..21affb900 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -124,7 +124,7 @@ libz-sys.workspace = true log = { workspace = true, features = ["serde"] } lsp-types.workspace = true malva = "=0.10.1" -markup_fmt = "=0.13.0" +markup_fmt = "=0.13.1" memmem.workspace = true monch.workspace = true notify.workspace = true diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index a7f4fd554..8a4bc4e6c 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -437,25 +437,15 @@ pub fn format_html( ) .map_err(|error| match error { markup_fmt::FormatError::Syntax(error) => { - // TODO(bartlomieju): rework when better error support in `markup_fmt` lands fn inner( error: &markup_fmt::SyntaxError, file_path: &Path, ) -> Option<String> { - let error_str = format!("{}", error); - let error_str = error_str.strip_prefix("syntax error '")?; - - let reason = error_str - .split("' at") - .collect::<Vec<_>>() - .first() - .map(|s| s.to_string())?; - let url = Url::from_file_path(file_path).ok()?; let error_msg = format!( "Syntax error ({}) at {}:{}:{}\n", - reason, + error.kind, url.as_str(), error.line, error.column diff --git a/tests/specs/fmt/html/broken.out b/tests/specs/fmt/html/broken.out index c2815552e..05021a197 100644 --- a/tests/specs/fmt/html/broken.out +++ b/tests/specs/fmt/html/broken.out @@ -1,4 +1,4 @@ Error formatting: [WILDCARD]broken.html - Syntax error (expect close tag) at file://[WILDCARD]broken.html:3:0 + Syntax error (expected close tag) at file://[WILDCARD]broken.html:3:0 Checked 1 file |