SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 366 forks source link

Compiling a latex file with errors freeze Sublime? #1090

Open xiaoweiz opened 7 years ago

xiaoweiz commented 7 years ago

I have a latex file having many (>20) latex errors. After compiling the file, Sublime immediately is frozen and not usable.

I'm on macOS Sierra with ST3 and the most recent version of latextools.

r-stein commented 7 years ago

Does it unfreeze after a while? Can you provide a minimal example/log file?

xiaoweiz commented 7 years ago

While preparing a minimal example, I find that severeness of the lagging depends on the size of the file and the number of errors. My file is large so it appears that the freezing takes for ever and never recovers. However, the following minimal example does not freeze for a long time, albeit a noticeable lag.

Here is a minimal example

\documentclass[11pt]{article}
\begin{document}
$\x$ 
$\x$ % repeat this error 200 times. the issue won't be noticed with only 2 errors. 
\end{document}

The log file is

<class '_latextools_traditionalBuilder.TraditionalBuilder'>
19
Welcome to thread Thread-1358
['latexmk', '-cd', '-f', '-pdf', '-interaction=nonstopmode', '-synctex=1', 'test.tex']
Running "latexmk -cd -f -pdf -interaction=nonstopmode -synctex=1 test.tex"
Finished normally
0

After compiling, if I click an error message, it's supposed to jump to the location of the error in the file. Now, a clear lag would appear.

r-stein commented 7 years ago

I don't have noticeable lag and it just stops after 100 erros. Can you open your settings and set highlight_build_panel to false.

The log file is the file, which is in the same directory as you root file, but is called .log instead of .tex. You can just rename it to .log.txt to upload it.

xiaoweiz commented 7 years ago

There is still a noticeable lag after setting highlight_build_panel to false. But the issue seems mitigated a bit. Now, the lag only exists if I click the error message, i.e. it waits for a couple of seconds before the cursor jumps to the corresponding location in the file. After the cursor jumps, Sublime resumes to work, as opposed to being frozen for a long time.

This is the log file test.log.txt

xiaoweiz commented 7 years ago

After poking around, I find the cause of the issue is probably the error phantoms. After setting show_error_phantoms to "none", the issue disappears (even with highlight_build_panel being true).

r-stein commented 7 years ago

Ah I should have thought of that.

xiaoweiz commented 7 years ago

I really like this feature (error phantoms). Can it be fixed?

r-stein commented 7 years ago

This seems to be more like performance issue with adding to much phantoms. I don't have it with my PC on Windows. Not sure whether it is less performant on OSX, but it can only fixed from ST itself. However we may add a option to only add a maximum of phantoms per view.

xiaoweiz commented 7 years ago

I see. I presume the math-preview feature may potentially suffer from this issue as well? It's a good idea to add an option to set a maximum number of phantoms. Or even only show phantoms on the current view page of the file?

r-stein commented 7 years ago

Yes, the preview feature may also suffer from this, but the default settings only show the phantoms of the selected environment, so it is not that problematic. In addition I don't want to make it more complicated without good reasons.

Also also think only showing the phantoms in the current viewport makes it too complicated and requires additional resources (listen to viewport changes).

xiaoweiz commented 7 years ago

Thanks for the explanation. I hope the option of maximum number of phantoms can be implemented.

I run into this issue because this manuscript was written using my own template. Then, I switched to a journal-specified template with many inconsistencies with mine, hence a large number of errors appear in the first run after a plain copy/paste. I imagine this situation is quite common for many people.

r-stein commented 7 years ago

You can just manually edit the source files. Above or below this line just add (change 50 to your wanted number)

errs = errs[:50]

Even if we add this it will not be too soon and I don't know whether we will to it, because it does not seem to be a common issue.