Skip to content

Commit 2dd111f

Browse files
committed
[WARP] Do not show the report in the UI if file is very large
It will just end up freezing the UI for an unreasonable time, just open the generated report in a real web browser or text editor, QTextBrowser falls over and fixing it would be more effort than its worth.
1 parent f2782d4 commit 2dd111f

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

plugins/warp/src/plugin/create.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,25 @@ impl CreateFromCurrentView {
209209
let _ = std::fs::write(report_path, &report_string);
210210
}
211211

212-
match report_kind {
213-
ReportKindField::None => {}
214-
ReportKindField::Html => {
215-
view.show_html_report("Generated WARP File", report_string.as_str(), "");
216-
}
217-
ReportKindField::Markdown => {
218-
view.show_markdown_report("Generated WARP File", report_string.as_str(), "");
219-
}
220-
ReportKindField::Json => {
221-
view.show_plaintext_report("Generated WARP File", report_string.as_str());
212+
// The ReportWidget uses a QTextBrowser, which cannot render large files very well.
213+
if file_size > 10000000 {
214+
log::warn!("WARP report file is too large to show in the UI. Please see the report file on disk.");
215+
} else {
216+
match report_kind {
217+
ReportKindField::None => {}
218+
ReportKindField::Html => {
219+
view.show_html_report("Generated WARP File", report_string.as_str(), "");
220+
}
221+
ReportKindField::Markdown => {
222+
view.show_markdown_report(
223+
"Generated WARP File",
224+
report_string.as_str(),
225+
"",
226+
);
227+
}
228+
ReportKindField::Json => {
229+
view.show_plaintext_report("Generated WARP File", report_string.as_str());
230+
}
222231
}
223232
}
224233
}

0 commit comments

Comments
 (0)