-
Notifications
You must be signed in to change notification settings - Fork 52
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
Infer output paths from latexmkrc if possible #968
Conversation
I've tested it with kak-lsp and Kakoune, seems to work! My only question is: do we need to document this new behavior in Wiki? Wiki needs a separate PR, doesn't it? |
Also, if we pass the values through Writing to temporary file would have been cleaner, but I nevertheless think that the current approach good enough (and simpler). Ivan |
I tested more and got this error. Log from kak-lspThe
Does it look like texlab is looking at the wrong logfile? There were more errors of similar sort, I can carefully make a more detailed report later. |
From latexmk docs: Getting the directories where latexmk will put its files is more nuanced, apparently. If only if ($out_dir eq '' ){
# Default to cwd
$out_dir = '.';
}
if ( $aux_dir eq '' ){
# Default to out_dir
# ?? This is different than MiKTeX
$aux_dir = $out_dir;
} I read the docs more carefully, and found the option The problem is, it then proceeds to build the document. Is that ok for texlab that we read the $ ls main.tex .latexmkrc
.latexmkrc main.tex
$ time latexmk -dir-report | grep 'Normalized'
Latexmk: Normalized aux dir and out dir: 'build', 'build'
real 0m10.354s
user 0m9.652s
sys 0m0.747s In this example, latexmk immediately prints the (actual) directory names, but then spends 10s to build the whole document. Ivan |
One more update. I wrote to John Collins, the author of Latexmk, and asked if there's a clean way to do what we want. Here's what he says:
We don't know when the new release is coming, and how long it will take it to reach all the distros. So, probably, the best solution is to proceed with 2 for now. And later implement 1. Ivan |
https://github.com/gnull/texlab/tree/feature/latexmkrc-auto-config I tried implementing approach 2 here over your commits, @pfoerster . What do you think? It seems to work and I don't get those stack traces anymore. Ivan |
Yeah, I think so too because parsing blocks the main thread so we need to be quite fast here. Waiting for the entire document to build (which could also be stuck in an infinite loop if you are unlucky) is not ideal as it makes the server unresponsive.
Looks very good! Do you mind creating a PR? :)
The error that you are seeing is from another issue which is unrelated to the changes made in the PR. It has to do with the |
Done! PRing into this feature branch so that this PR tracks all the progress. Hope this is what you meant. Ivan |
3396a8e
to
a14efe0
Compare
) * Reliably determine latexmk's aux_dir and out_dir using -dir-report This commit makes texlab determine aux_dir and out_dir variables by calling latexmkrc -dir-report $TMPDIR/NONEXISTENT.tex Passing NONEXISTENT file is a hack to prevent latexmk from building anything. And the $TMPDIR part should ensure 100% that this file does not exist (to avoid event rarest cases when user may have a file called NONEXISTENT.tex in current working directory). This should be a more correct than `latexmk -r $TMPDIR/latexmkrc`, since -dir-report was intended exactly for this and it prints normalized values. * remove a reduntant check
Fixes #907.