Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation doesn't terminate until previewer is closed #588

Closed
potamides opened this issue Mar 28, 2022 · 5 comments
Closed

Compilation doesn't terminate until previewer is closed #588

potamides opened this issue Mar 28, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@potamides
Copy link

First, thank you for this awesome project, it made writing my thesis a fun undertaking! I was able to reproduce my problem with the following minimal configuration:

latexmkrc:

$pdf_mode = 4;
$pdf_previwer = 'start qpdfview --unique %S';

LSP configuration (through nvim-lspconfig):

settings = {
  texlab = {
    build = {
      args = {"-interaction=nonstopmode", "-synctex=1", "-pv", "%f"},
      forwardSearchAfter = false
    }
  }
}

The issue I have seems to manifest itself when I configure a previewer to run on build (i.e. using the -pv flag). Latexmk seems to be running fine but texlab only reports successful (or unsuccessful) compilation back to my editor when I close the preview window. When I look at the LSP logs it seems that these two messages are only sent after the preview window is closed:

[DEBUG][2022-03-28 12:19:01] .../vim/lsp/rpc.lua:454	"rpc.receive"	{  jsonrpc = "2.0",  method = "$/progress",  params = {    token = "texlab-build-1166aa7e-9700-4f34-9009-2e376db35e20",    value = {      kind = "end"    }  }}
[DEBUG][2022-03-28 12:19:01] .../vim/lsp/rpc.lua:454	"rpc.receive"	{  id = 3,  jsonrpc = "2.0",  result = {    status = 0  }}

Interestingly, when I use a single previewer instance and the previewer is already open then it works just fine.

@pfoerster pfoerster added the bug Something isn't working label Mar 29, 2022
@pfoerster
Copy link
Member

Thanks for the report!

It looks like it has to with the capturing the output of the latexmk process. The stdio and stderr streams are not closed when latexmk exits. I think that qpdfview inherits the streams which causes the problem.

I am working on a fix.

pfoerster added a commit that referenced this issue Mar 29, 2022
@pfoerster
Copy link
Member

I am working on a fix.

c9f3fd2 should prevent this issue. When the process has exited, the output capturing is stopped and texlab should no longer wait indefinitely for a response.

First, thank you for this awesome project, it made writing my thesis a fun undertaking!

You’re welcome!

@potamides
Copy link
Author

c9f3fd2 should prevent this issue.

Awesome! I gave it a run and it indeed seems to fix my issue. However, interestingly my "quickfix" I used to circumvent this bug earlier stopped working. Consider the following configuration, where I instead of previewing through -pv execute a forward search after compiling:

settings = {
  texlab = {
    build = {
      args = {"-interaction=nonstopmode", "-synctex=1", "%f"},
      forwardSearchAfter = true
    },
    forwardSearch = {
      executable = "qpdfview",
      args = {"--unique", "%p#src:%f:%l:1"}
    }
  }
}

If I now repeatedly trigger textDocument/build, texlab stops responding after a while and sometimes doesn't even open qpdfview. If this bug is not related, please let me know and I'll open a separate issue.

pfoerster added a commit that referenced this issue Mar 30, 2022
@pfoerster
Copy link
Member

Can you try out 14c981d, please?

@potamides
Copy link
Author

I tried it and now everything seems to work as expected.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 29, 2022
## [4.0.0] - 25.05.2022

### Added

- Add `--version` command line flag
- Provide pre-built binaries for `aarch64-apple-darwin` architecture ([#591](latex-lsp/texlab#591))
- Autocomplete files based on `\graphicspath` ([#590](latex-lsp/texlab#590))
- Release `texlab` on `crates.io` ([#399](latex-lsp/texlab#399))

### Changed

- _BREAKING_: Use client-side file watching instead of server-side notifications (`workspace/didChangeWatchedFiles`)
- _BREAKING_: Bump minimum supported Rust version to 1.58.1
- _BREAKING_: Do not use `citeproc-rs` to render citations. Instead, use a custom approach that tries to resemble the `BibLaTeX` output ([#629](latex-lsp/texlab#629))

### Fixed

- Parse `\subinputfrom` command correctly ([#610](latex-lsp/texlab#610))
- Parse verbatim environments correctly ([#490](latex-lsp/texlab#490))
- Stop capturing stdout when build exits ([#588](latex-lsp/texlab#588))
- Fix parsing of key-value pairs ([#573](latex-lsp/texlab#573))
- Normalize `texlab.rootDirectory` when resolving includes ([#571](latex-lsp/texlab#571))
- Allow optional arguments in environment definitions ([#570](latex-lsp/texlab#570))
- Allow `=` in include paths ([#568](latex-lsp/texlab#568))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants