latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.55k stars 53 forks source link

No error diagnostics when setting build directory to a subdirectory #563

Closed qsdrqs closed 2 years ago

qsdrqs commented 2 years ago

Hi, firstly many thanks for your work! I'm facing an issue that there will be no error diagnostics output when I set my output to a subdirectory. It will work fine when I don't use a subdirectory.

My vscode setting is below:

{
    "texlab.auxDirectory": "latex.out",
    "texlab.build.onSave": true,
    "texlab.build.args": [
        "-pdf",
        "-interaction=nonstopmode",
        "-synctex=1",
        "%f",
        "-outdir=./latex.out"
    ],
    "texlab.server.autoDownload": true,
    "window.zoomLevel": 3
}

Here is the way to reproduce it.

First, create a tex file under an empty directory as

\documentclass[UTF8]{article}                                                                                                                                                    
\begin{document} %COMPILE ERROR                                                                                                                                                  
test                                                                                                                                                                             
\end{document}

Then delete a character to make some error. For example, modify begin to bgin like following, and run texlab builtin "build" command. It will show up "build error" like below, but no error diagnostic is reported.

image

Besides, when I restart vscode at this time, I will be able to see the diagnostic error but it won't disappear after I correct it. I need to restart my vscode again then it will disappear.

image

I'm wondering is there any missing in my config? Thank you for your help!

dbucher97 commented 2 years ago

I have the same problem with texlab configured with nvim-lspconfig. Configuration looks similar

texlab = {
  build = {
    args = {
      "-pdf",
      "-interaction=nonstopmode",
      "-synctex=1",
      "-outdir=./build",
      "%f",
    },
    onSave = false,
  },
  auxDirectory = "build",
}

Build files are correctly produced in the build directory. However, errors and warnings do not get updated by texlab. But, when I restart vim I see the diagnostics from the previous build.

When no build directory is set, everything works fine 👍 .

Thanks for your help! 😃

pfoerster commented 2 years ago

Thanks for the detailed report!

I was able to reproduce the issue on my machine. The problem was caused by the file watching mechanism, which did not watch the output directory by default (one workaround would have been opening the aux file and rebuilding). This should be fixed with 10908316dd6e986df330cab7828674b43de33b22.

qsdrqs commented 2 years ago

Great! I tested it and it really fix that problem. Many thanks for your fast work!