Skip to content

Commit 73c6b9a

Browse files
committed
feat: improve format_parsed_file function
1 parent 95f229d commit 73c6b9a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dprint-plugin-typescript"
3-
version = "0.50.2"
3+
version = "0.51.0"
44
authors = ["David Sherret <dsherret@gmail.com>"]
55
edition = "2018"
66
homepage = "https://github.com/dprint/dprint-plugin-typescript"
@@ -29,7 +29,7 @@ dprint-core = { version = "0.44.0", features = ["formatting"] }
2929
fnv = "1.0.7"
3030
serde = { version = "1.0.118", features = ["derive"] }
3131
serde_json = { version = "1.0", optional = true }
32-
swc_ast_view = { version = "0.27.1", package = "dprint-swc-ecma-ast-view" }
32+
swc_ast_view = { version = "0.29.4", package = "dprint-swc-ecma-ast-view" }
3333
swc_common = "0.11.4"
3434
swc_ecmascript = { version = "0.52.1", features = ["parser"] }
3535

src/format_text.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ pub struct SourceFileInfo<'a> {
6666
}
6767

6868
/// Formats the already parsed file. This is useful as a performance optimization.
69-
pub fn format_parsed_file(info: &SourceFileInfo<'_>, config: &Configuration) -> Result<String, ErrBox> {
69+
pub fn format_parsed_file(info: &SourceFileInfo<'_>, config: &Configuration) -> String {
7070
if super::utils::file_text_has_ignore_comment(info.info.text(), &config.ignore_file_comment_text) {
71-
return Ok(info.info.text().to_string());
71+
return info.info.text().to_string();
7272
}
7373

74-
Ok(dprint_core::formatting::format(|| {
74+
dprint_core::formatting::format(|| {
7575
let print_items = parse(&info, config);
7676
// println!("{}", print_items.get_as_text());
7777
print_items
78-
}, config_to_print_options(info.info.text(), config)))
78+
}, config_to_print_options(info.info.text(), config))
7979
}
8080

8181
#[cfg(feature = "tracing")]

0 commit comments

Comments
 (0)