Closed drriguz closed 1 year ago
This is by design. A quick fix is to use TeX root
comment to define the root file.
However, the description of latex.watch.files.ignore
states files to ignore from the watching mechanism used for triggering autobuild.
Now the config is used to stop sub-file parsing, but allows for findRootFromActive()
. Shall we change the logic so that files defined in ignore
won't be selected as root? @jlelong
This is actually more complicated than I thought and the logic is sometimes hard to follow. I will make a detailed report shortly.
Hi there, since it's more complicated than I originally thought, I'm taking another approach now. I'll use another file extension for the half-done tex files, ie.
\src
- main.txt
\ chapters
- ch01.txt
\ generated
- main.tex
Thus there's no conflication anymore.
BTW, I'm trying to copy the latexmk commands to a Makefile, however I cannot compile using the same commands copied from the output window. It seems that some magic things is used in latex-workshop, maybe TEXTINPUTS
? Where can I found the complete latex make commands (as well as other environment varibles) that is using when latex-workshop compiles the file?
The description of the setting latex.watch.files.ignore
is not completely correct. This setting has a much wider impact than just auto-build and unfortunately it is not always coherent.
Consider the case of a main.tex
file including subfile.tex
and add subfile.tex
to latex.watch.files.ignore
. There are two different situations depending on which file is edited
Open main.tex
. The file subfile.tex
is almost completely ignored:
main.tex
in this.extension.manager.cachedContent['main.tex']
this.extension.manager.cachedContent['subfile.tex']
existsparseFileAndSubs
subfile.tex
are not available for completion) and (external) changes to the file will not trigger auto build even when set to on file change.Switch to subfile.tex
this.extension.manager.cachedContent['subfile.tex']
intellisense.update.aggressive.enabled
is set to true
, updateCompleter
is called and the content of the file becomes available for intellisense.I will think about all this and try to come with clearer and more coherent logic. I think its deserves a dedicated issue.
For the time being, I am against changing the behaviour of findRootFromActive
. This has to be part of a more general reflexion.
@drriguz If I understand your use case correctly, you edit the files in src
, but you want those in generated
to be compiled. If this is the case, I suggest you to keep the .tex
extension for the files in src
otherwise lots of LW features will not work. Create a recipe to run your preprocessing and then to build the files in generated
, which means running latexmk path/to/generated/main.tex
.
Trying to extract commands from latexmk
is a bad idea because latexmk
is a very sophisticated tool to handle dependencies and LaTeX multiple compilations.
With the new cacher
design, latex.watch.files.ignore
behavior seems a bit more coherent. This config is used only to determine whether a file should be watched / cached. Together with other big and small refactors, now the user-sensible behavior are changed to
Open main.tex. The file subfile.tex is almost completely ignored:
main.tex
in this.extension.manager.cachedContent['main.tex']
lw.cacher.contexts['main.tex'].children
lw.cacher.contexts['subfile.tex']
does not existparseFileAndSubs
)Switch to subfile.tex
lw.cacher.contexts['subfile.tex']
, therefore not watchedintellisense.update.aggressive.enabled
is set to true
, onSave
, but not onFileChanged
as it is never watchedTo summarize:
onSave
I think the current behavior is more understandable. What about I update the description to this config according to the summary and call it a day? @jlelong
The new behaviour of latex.watch.files.ignore
looks much more natural. I agree that updating its description based in the above summary is probably enough to consider that the issue is solved.
Thanks for the awesome work! :p
Hi, I'd like to make some pre-processing to generate a "final" tex from the original one, the file structure looks like bellow:
So I would like latex workshop to watch only the
generated
folder, but not thesrc
one, because it is actually not a valid tex file. I setlatex.watch.files.ignore=src/**
orlatex.watch.files.ignore=**/src/**
, but latex woskshop still will try to build it when save src/main.tex.I'm not sure whether this is the intended behavior, any help will be appreciated.