diff options
Diffstat (limited to 'cli/tools')
-rw-r--r-- | cli/tools/fmt.rs | 19 | ||||
-rw-r--r-- | cli/tools/repl.rs | 2 |
2 files changed, 6 insertions, 15 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs index 5d33240a5..9ac9557cd 100644 --- a/cli/tools/fmt.rs +++ b/cli/tools/fmt.rs @@ -220,24 +220,15 @@ pub fn format_file( } } -pub fn format_parsed_module( +pub fn format_parsed_source( parsed_source: &ParsedSource, fmt_options: FmtOptionsConfig, -) -> String { - dprint_plugin_typescript::format_parsed_file( - &dprint_plugin_typescript::SourceFileInfo { - is_jsx: matches!( - parsed_source.media_type(), - deno_ast::MediaType::Jsx | deno_ast::MediaType::Tsx - ), - info: parsed_source.source(), - leading_comments: parsed_source.comments().leading_map(), - trailing_comments: parsed_source.comments().trailing_map(), - module: parsed_source.module(), - tokens: parsed_source.tokens(), - }, +) -> Result<String, String> { + dprint_plugin_typescript::format_parsed_source( + parsed_source, &get_resolved_typescript_config(&fmt_options), ) + .map_err(|e| e.to_string()) } async fn check_source_files( diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index 7bad940d4..f3ba626af 100644 --- a/cli/tools/repl.rs +++ b/cli/tools/repl.rs @@ -540,7 +540,7 @@ impl ReplSession { Some(diagnostic) => Ok(EvaluationOutput::Error(format!( "{}: {} at {}:{}", colors::red("parse error"), - diagnostic.message, + diagnostic.message(), diagnostic.display_position.line_number, diagnostic.display_position.column_number, ))), |