diff --git a/crates/ruff_fmt_dprint/src/format_text.rs b/crates/ruff_fmt_dprint/src/format_text.rs index 8ee8db2..b2f5bc4 100644 --- a/crates/ruff_fmt_dprint/src/format_text.rs +++ b/crates/ruff_fmt_dprint/src/format_text.rs @@ -9,7 +9,7 @@ pub fn format_text(text: &str, file_path: &Path, config: &Configuration) -> Form let config = config.clone().with_path(file_path.to_string_lossy().to_string()); format_module_source(text, config.into()) .map_err(|err| err.into()) - .map(|result| (result.as_code() != text).then_some(result.into_code())) + .map(|result| (result.as_code() != text).then_some(result.into_code().into_bytes())) } #[cfg(test)] diff --git a/crates/ruff_fmt_dprint/src/wasm_plugin.rs b/crates/ruff_fmt_dprint/src/wasm_plugin.rs index 8e7a982..5afeecb 100644 --- a/crates/ruff_fmt_dprint/src/wasm_plugin.rs +++ b/crates/ruff_fmt_dprint/src/wasm_plugin.rs @@ -1,5 +1,3 @@ -use std::path::Path; - use dprint_core::configuration::ConfigKeyMap; use dprint_core::configuration::GlobalConfiguration; use dprint_core::configuration::ResolveConfigurationResult; @@ -60,11 +58,11 @@ impl SyncPluginHandler for RuffFmtWasmPlugin { fn format( &mut self, file_path: &std::path::Path, - file_text: &str, + file_bytes: Vec, config: &Configuration, - mut _format_with_host: impl FnMut(&Path, String, &ConfigKeyMap) -> FormatResult, + _format_with_host: impl FnMut(&std::path::Path, Vec, &ConfigKeyMap) -> FormatResult, ) -> FormatResult { - format_text(file_text, file_path, config) + format_text(&String::from_utf8_lossy(&file_bytes), file_path, config) } }