Skip to content

Stream mode complete#137

Open
merv1n34k wants to merge 15 commits into
let-def:mainfrom
merv1n34k:stream-mode-complete
Open

Stream mode complete#137
merv1n34k wants to merge 15 commits into
let-def:mainfrom
merv1n34k:stream-mode-complete

Conversation

@merv1n34k
Copy link
Copy Markdown
Contributor

@merv1n34k merv1n34k commented May 20, 2026

Hey @let-def!

I have rebased your changes on top of the main. Few things added after #130:

1. Bug fix

editor_notify_lookup in editor.c has a switch with no break statements — every (lookup-file ...) notification falls through to abort() and crashes texpresso.

Fix: add break after each case. 3 lines change.

2. Feature: (pause) / (resume)

In -stream mode, texpresso starts compiling immediately, before the editor has a chance to push the root file. The engine fails, the editor sends register + open, and the engine restarts. With multiple files this means several wasted restarts at startup.

(pause) lets the editor freeze the engine while priming the VFS:

launch -stream root.tex
(pause)
(register "root.tex")
(open "root.tex" ...)
(resume)

The engine then steps once with everything already in place. Works in both sexp and JSON. Backward compatible — clients that never pause behave identically.

Implementation: new EDIT_PAUSE / EDIT_RESUME commands, paused flag on persistent_state, guards on every engine_step call site. Test script included (make test-pause-resume).


Seems this is the last bit, and I could finally move towards stream mode wiring to the texpresso.vim (texpresso.nvim) and my other project.

@merv1n34k
Copy link
Copy Markdown
Contributor Author

UPD: bring back previous fix from #125 for interpret_open: relative_path() was called unconditionally, mangling relative paths so (open ...) from the editor never matched the deferred query target. Guard behind path[0] == '/' to mirror what interpret_register already does.

And also update test-register to lookup-file instead of request-file (target no longer exist as we removed it).

@merv1n34k
Copy link
Copy Markdown
Contributor Author

On top of that, also replaced legacy test-request-file with test-lookup-file, updated all test to make them reproducible and deterministic and added 3 new test targets to CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants