From 54c510c8187f211dec50171348722f5d91be678b Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 7 Jun 2026 08:43:18 +0000 Subject: [PATCH] Revert Typst SyncTeX attempt; clean up diagnostic logging Typst has no --synctex CLI option (open feature request #289 since 2023). Revert the frontend guard back to LaTeX-only and remove --synctex from the Typst compile command. Also remove the temporary logger.warn calls added for diagnosing the LaTeX synctex issue (now resolved). The official Typst binary installation in Dockerfile-base is kept as it is cleaner than using Quarto's modified fork for .typ compilation. Co-Authored-By: Claude Sonnet 4.6 --- services/clsi/app/js/CompileManager.js | 11 ----------- services/clsi/app/js/TypstRunner.js | 12 +++++------- .../js/features/pdf-preview/hooks/use-synctex.ts | 8 ++++---- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/services/clsi/app/js/CompileManager.js b/services/clsi/app/js/CompileManager.js index 8df9651bd6..df2d7fffbf 100644 --- a/services/clsi/app/js/CompileManager.js +++ b/services/clsi/app/js/CompileManager.js @@ -563,10 +563,6 @@ async function _runSynctex(projectId, userId, command, opts) { const compileGroup = runInOutputDir ? 'synctex-output' : 'synctex' const defaultImageName = Settings.clsi && Settings.clsi.docker && Settings.clsi.docker.image - logger.warn( - { projectId, userId, buildId, editorId, directory, command, runInOutputDir }, - 'synctex: starting request' - ) // eslint-disable-next-line @typescript-eslint/return-await return await OutputCacheManager.promises.queueDirOperation( outputDir, @@ -577,7 +573,6 @@ async function _runSynctex(projectId, userId, command, opts) { let downloadedFromCache = false try { await _checkFileExists(directory, 'output.synctex.gz') - logger.warn({ directory }, 'synctex: output.synctex.gz found') if (compileFromClsiCache) { try { await _checkFileExists(directory, 'output.log') @@ -586,10 +581,6 @@ async function _runSynctex(projectId, userId, command, opts) { } } } catch (err) { - logger.warn( - { err: err.message, directory }, - 'synctex: output.synctex.gz not found' - ) if ( err instanceof Errors.NotFoundError && compileFromClsiCache && @@ -627,13 +618,11 @@ async function _runSynctex(projectId, userId, command, opts) { compileGroup, null ) - logger.warn({ command, stdout }, 'synctex: command output') return { stdout, downloadedFromCache, } } catch (error) { - logger.warn({ err: error.message, command }, 'synctex: command failed') throw OError.tag(error, 'error running synctex', { command, projectId, diff --git a/services/clsi/app/js/TypstRunner.js b/services/clsi/app/js/TypstRunner.js index 2e3d3f1367..15a4b65f57 100644 --- a/services/clsi/app/js/TypstRunner.js +++ b/services/clsi/app/js/TypstRunner.js @@ -8,10 +8,10 @@ import fs from 'node:fs' const ProcessTable = {} // Compiles a standalone Typst document (.typ) straight to output.pdf using the -// official Typst binary (installed separately from Quarto, which bundles a -// modified fork that lacks --synctex). This is deliberately the simplest of -// the three runners: Typst only ever produces a PDF, so there is no format -// detection, no HTML asset directory and no extension merging (cf. QuartoRunner). +// official Typst binary (installed separately — Quarto bundles a modified fork). +// This is deliberately the simplest of the three runners: Typst only ever +// produces a PDF, so there is no format detection, no HTML asset directory +// and no extension merging (cf. QuartoRunner). function runTypst(compileName, options, callback) { const { directory, mainFile, image, environment, compileGroup } = options const timeout = options.timeout || 60000 @@ -58,10 +58,8 @@ function _buildTypstCommand(mainFile) { // is merged into stdout (2>&1). LocalCommandRunner replaces $COMPILE_DIR // before the shell sees it; the output path is relative because the shell // CWD is already the compile directory. - // --synctex generates output.synctex.gz alongside the PDF, enabling - // bidirectional editor↔PDF sync (same infrastructure as LaTeX SyncTeX). const inputPath = `$COMPILE_DIR/${mainFile}` - const cmd = `typst compile --synctex output.synctex.gz ${inputPath} output.pdf 2>&1` + const cmd = `typst compile ${inputPath} output.pdf 2>&1` return ['/bin/sh', '-c', cmd] } diff --git a/services/web/frontend/js/features/pdf-preview/hooks/use-synctex.ts b/services/web/frontend/js/features/pdf-preview/hooks/use-synctex.ts index a91c05935c..1218539ab2 100644 --- a/services/web/frontend/js/features/pdf-preview/hooks/use-synctex.ts +++ b/services/web/frontend/js/features/pdf-preview/hooks/use-synctex.ts @@ -176,12 +176,12 @@ export default function useSynctex(): { positionRef.current = position }, [position]) - // SyncTeX works for LaTeX and Typst projects — both produce output.synctex.gz. - // Quarto does not (its intermediate files make path mapping unreliable). - const SYNCTEX_EXTENSIONS_RE = /\.(tex|ltx|Rtex|Rnw|typ)$/i + // SyncTeX only works for LaTeX projects (requires output.synctex.gz). + // Typst has no --synctex equivalent in its CLI; Quarto is also unsupported. + const LATEX_EXTENSIONS_RE = /\.(tex|ltx|Rtex|Rnw)$/i const rootDocPath = rootDocId ? pathInFolder(rootDocId) : null const isSynctexRootDoc = rootDocPath - ? SYNCTEX_EXTENSIONS_RE.test(rootDocPath) + ? LATEX_EXTENSIONS_RE.test(rootDocPath) : false const _syncToCode = useCallback(