Skip to content

feat(compiler): add TeXpresso integration#3267

Merged
lervag merged 6 commits into
lervag:masterfrom
SeniorMars:texpresso-integration
Jun 24, 2026
Merged

feat(compiler): add TeXpresso integration#3267
lervag merged 6 commits into
lervag:masterfrom
SeniorMars:texpresso-integration

Conversation

@SeniorMars

@SeniorMars SeniorMars commented May 14, 2026

Copy link
Copy Markdown
Contributor

Add a VimTeX compiler backend for TeXpresso, a live-rendering LaTeX tool that updates the preview incrementally as the buffer changes. The backend communicates with TeXpresso through its JSON protocol over stdio and supports SyncTeX forward/inverse search, quickfix integration, and live buffer synchronization. Neovim buffer synchronization is handled through lua/vimtex/compiler/texpresso.lua.

This revives the work from PR #2975 and addresses the main review comments from that discussion:

  • Move the Neovim buffer-attach Lua code to lua/vimtex/compiler/texpresso.lua, with type annotations and a defensive check for compiler state during shutdown or reload.
  • Add documentation in doc/vimtex.txt modeled on the existing compiler backend sections, including a Requirements block and option docs.
  • Internalize the required -json and -lines flags so users cannot accidentally break the protocol by editing g:vimtex_compiler_texpresso.
  • Normalize passed_options spacing in __build_cmd with trim() so the function is robust regardless of whether the caller includes a leading space.
  • Add a stdin_pipe flag to the compiler template so that only TeXpresso enables stdin piping for its job, rather than changing the default for all continuous compiler backends.
  • Register texpresso in the valid compiler methods list in compiler.vim.
  • Add tests (test/test-compiler-texpresso/):
    • Unit tests (make / make vim) verify stdin_pipe, continuous mode, __build_cmd output, and passed_options spacing without requiring TeXpresso to be installed. These run under both Neovim and Vim.
    • Integration smoke test (make integration) starts a real TeXpresso process under Neovim, sends a reload message, and verifies that it stops cleanly.

Note: I'm a bit unfamiliar with the vim codebase, so additional tests may be needed; however, neovim has been tested.

Co-Authored-By: Tsung-Ju Chiang 71379180+tsung-ju@users.noreply.github.com

tsung-ju and others added 4 commits May 14, 2026 02:34
Add a VimTeX compiler backend for TeXpresso, a live-rendering LaTeX
tool that updates the preview incrementally as the buffer changes. The
backend communicates with TeXpresso through its JSON protocol over stdio
and supports SyncTeX forward/inverse search, quickfix integration, and
live buffer synchronization. Neovim buffer synchronization is handled
through lua/vimtex/compiler/texpresso.lua.

This revives the work from PR lervag#2975 and addresses the main review
comments from that discussion:

- Move the Neovim buffer-attach Lua code to
  lua/vimtex/compiler/texpresso.lua, with type annotations and a
  defensive check for compiler state during shutdown or reload.
- Add documentation in doc/vimtex.txt modeled on the existing compiler
  backend sections, including a Requirements block and option docs.
- Internalize the required -json and -lines flags so users cannot
  accidentally break the protocol by editing g:vimtex_compiler_texpresso.
- Normalize passed_options spacing in __build_cmd with trim() so the
  function is robust regardless of whether the caller includes a leading
  space.
- Add a stdin_pipe flag to the compiler template so that only TeXpresso
  enables stdin piping for its job, rather than changing the default for
  all continuous compiler backends.
- Register texpresso in the valid compiler methods list in compiler.vim.
- Add tests (test/test-compiler-texpresso/):
  - Unit tests (`make` / `make vim`) verify stdin_pipe, continuous mode,
    __build_cmd output, and passed_options spacing without requiring
    TeXpresso to be installed. These run under both Neovim and Vim.
  - Integration smoke test (`make integration`) starts a real TeXpresso
    process under Neovim, sends a reload message, and verifies that it
    stops cleanly.

Note: I'm a bit unfamiliar with the vim codebase, so additional tests
may be needed; however, neovim has been tested.

Co-Authored-By: Tsung-Ju Chiang <71379180+tsung-ju@users.noreply.github.com>

@lervag lervag left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This seems to be a good PR, and I only have a couple of minor code comments.

Note: I'm a bit unfamiliar with the vim codebase, so additional tests may be needed; however, neovim has been tested.

Thanks! I can probably test this with Vim when I get the time. I'm assuming that it should be easy to install texpresso on Arch Linux (which seems to be the case).

Is there anything specific you would advice me to test before accepting this?

Comment thread doc/vimtex.txt Outdated
Comment thread autoload/vimtex/compiler/texpresso.vim Outdated
@lervag

lervag commented Jun 13, 2026

Copy link
Copy Markdown
Owner

If the PR is ever merged, it should resolve #3262.

Open stdin for continuous Neovim compiler jobs that declare stdin_pipe, and cover live edit propagation with protocol tests.
@lervag

lervag commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Thanks for the updates! You're a person of few words; should I consider the PR ready for merge from your side?

@SeniorMars

Copy link
Copy Markdown
Contributor Author

Omg, sorry, for some reason I didn't read the previous comment.

Is there anything specific you would advice me to test before accepting this?

It would do wonders for me if you can confirm that vim works fine with this compiler. I tested it a bit, but honestly, I feel like you would have more experience on this compiler backend stuff.

Other than that, I do think it's ready to merge.

@lervag

lervag commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Great! I'll test it with Vim as soon as I get the time, then merge this after (unless I find a surprising glaring issue). I assume you agree that this resolves #3262?

@SeniorMars

Copy link
Copy Markdown
Contributor Author

Yes! Though I only tested it on one large file. I think it did it's job!

@lervag

lervag commented Jun 24, 2026

Copy link
Copy Markdown
Owner

I've tested with Vim, and it seems to work fine. Thanks for your contribution!

@lervag lervag merged commit 3f96414 into lervag:master Jun 24, 2026
1 check passed
lervag added a commit that referenced this pull request Jun 24, 2026
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.

3 participants