Skip to content

Commit

Permalink
Maybe fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jan 14, 2024
1 parent 580733b commit 03a7de0
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/wasm_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use dprint_core::generate_plugin_code;
use dprint_core::plugins::FileMatchingInfo;
use dprint_core::plugins::FormatResult;
use dprint_core::plugins::PluginInfo;
use dprint_core::plugins::SyncPluginInfo;
use dprint_core::plugins::SyncPluginHandler;
use std::path::Path;

Expand All @@ -18,15 +19,17 @@ impl SyncPluginHandler<Configuration> for DockerfilePluginHandler {
resolve_config(config, global_config)
}

fn plugin_info(&mut self) -> PluginInfo {
fn plugin_info(&mut self) -> SyncPluginInfo {
let version = env!("CARGO_PKG_VERSION").to_string();
PluginInfo {
name: env!("CARGO_PKG_NAME").to_string(),
version: version.clone(),
config_key: "dockerfile".to_string(),
help_url: "https://dprint.dev/plugins/dockerfile".to_string(),
config_schema_url: format!("https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/{}/schema.json", version),
update_url: Some("https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/latest.json".to_string()),
SyncPluginInfo {
info: PluginInfo {
name: env!("CARGO_PKG_NAME").to_string(),
version: version.clone(),
config_key: "dockerfile".to_string(),
help_url: "https://dprint.dev/plugins/dockerfile".to_string(),
config_schema_url: format!("https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/{}/schema.json", version),
update_url: Some("https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/latest.json".to_string()),
},
file_matching: FileMatchingInfo {
file_extensions: vec!["dockerfile".to_string()],
file_names: vec!["Dockerfile".to_string()],
Expand All @@ -41,11 +44,12 @@ impl SyncPluginHandler<Configuration> for DockerfilePluginHandler {
fn format(
&mut self,
file_path: &Path,
file_text: &str,
file_bytes: Vec<u8>,
config: &Configuration,
_format_with_host: impl FnMut(&Path, String, &ConfigKeyMap) -> FormatResult,
_format_with_host: impl FnMut(&Path, Vec<u8>, &ConfigKeyMap) -> FormatResult,
) -> FormatResult {
super::format_text(file_path, file_text, config)
let file_text = String::from_utf8(file_bytes)?;
super::format_text(file_path, &file_text, config).map(|maybe_file_text| maybe_file_text.map(|file_text| file_text.into_bytes()))
}
}

Expand Down

0 comments on commit 03a7de0

Please sign in to comment.