Skip to content

Commit 57b3e95

Browse files
committed
feat(napi/playground): return codeframe
1 parent e696fda commit 57b3e95

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

napi/playground/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub struct Oxc {
5151
pub prettier_ir_text: String,
5252
comments: Vec<Comment>,
5353
diagnostics: Vec<OxcDiagnostic>,
54+
source_text: String,
5455
}
5556

5657
#[napi]
@@ -62,7 +63,7 @@ impl Oxc {
6263

6364
#[napi]
6465
pub fn get_diagnostics(&self) -> Vec<OxcError> {
65-
self.diagnostics.iter().map(OxcError::from).collect()
66+
OxcError::from_diagnostics("", &self.source_text, self.diagnostics.clone())
6667
}
6768

6869
#[napi]
@@ -75,6 +76,7 @@ impl Oxc {
7576
#[napi]
7677
#[allow(clippy::allow_attributes, clippy::needless_pass_by_value)]
7778
pub fn run(&mut self, source_text: String, options: OxcOptions) -> napi::Result<()> {
79+
self.source_text.clone_from(&source_text);
7880
self.diagnostics = vec![];
7981
self.scope_text = String::new();
8082
self.symbols_json = String::new();

0 commit comments

Comments
 (0)