Skip to content

Commit ec9cd1f

Browse files
committed
Display compile time after build
1 parent 1aec1c7 commit ec9cd1f

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

LaTeXTools Build Output.sublime-syntax

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version: 2
77
hidden: true
88

99
variables:
10-
build_results: ^\[(?:Build (?:cancelled by user|failed|skipped)|Done)!\]$
10+
build_results: ^\[(?:(?:Build (?:cancelled by user|failed|skipped))!|Finished in .+)\]$
1111
log_file: ^((.+?)(?:(:)(\d+))?)(:)[ ](Double-click here to open the full log\.)$
1212

1313
contexts:
@@ -106,5 +106,5 @@ contexts:
106106
scope: meta.summary.failure.build.latextools message.error.build.latextools
107107
- match: ^\[Build cancelled by user!\]$\n?
108108
scope: meta.summary.failure.build.latextools message.warning.build.latextools
109-
- match: ^\[(?:Build skipped|Done)!\]$\n?
109+
- match: ^\[(?:Build skipped!|Finished in .+)\]$\n?
110110
scope: meta.summary.success.build.latextools message.info.build.latextools

latextools/make_pdf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import shutil
1414
import signal
1515
import threading
16+
import time
1617
import traceback
1718

1819
import sublime
@@ -60,6 +61,8 @@ def run(self):
6061
self.worker(activity_indicator)
6162

6263
def worker(self, activity_indicator):
64+
t1 = time.monotonic()
65+
6366
logger.debug(f"Welcome to thread {self.name}")
6467
self.caller.output(
6568
f"[Compiling '{self.caller.builder.tex_root}' with '{self.caller.builder.name}']\n"
@@ -306,7 +309,15 @@ def worker(self, activity_indicator):
306309
traceback.print_exc()
307310

308311
self.caller.output(content)
309-
self.caller.output("\n\n[Build failed!]" if aborted else "\n\n[Done!]")
312+
if aborted:
313+
self.caller.output("\n\n[Build failed!]")
314+
else:
315+
elapsed = time.monotonic() - t1
316+
if elapsed >= 60:
317+
elapsed = time.strftime("%M:%S", time.gmtime(elapsed))
318+
else:
319+
elapsed = f"{elapsed:0.1f}s"
320+
self.caller.output(f"\n\n[Finished in {elapsed}]")
310321

311322
self.caller.errors = errors
312323
self.caller.warnings = warnings

0 commit comments

Comments
 (0)