summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-10-21 10:18:18 -0400
committerGitHub <noreply@github.com>2021-10-21 10:18:18 -0400
commit43cd0459b9ca383f18ca5b01b8c48e77737c3f1d (patch)
tree05eababf594247aaebc3d4f4f4a2a0f36415f2cb /cli/tools/fmt.rs
parent299702161533d731db799f1bb6c7c95fd92c0c11 (diff)
fix(lsp): formatting should error on certain additional swc diagnostics (#12491)
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs19
1 files changed, 5 insertions, 14 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(