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

How to show Build Error message in neovim to show what was wrong? #836

Open
amalgame21 opened this issue Jan 2, 2023 · 5 comments
Open
Labels
bug Something isn't working needs more info Issue requires more information from poster

Comments

@amalgame21
Copy link

I am using the https://github.com/nvim-lua/kickstart.nvim init.lua script and configure it to use texlab lsp.

When I type :TexlabBuild to build the tex file, when all things in the .tex file is correct, the bottom left corner display Build Success

However when the .tex file have something wrong, like I comment out the `% \end{document}

type :TexlabBuild to build the tex file, bottom left corner display Build Error, but nothing more.

In vimtex, the Error message will pop up to show what was messed up in the file.

In texlab, how can I see the error message to see which part causing build error?

@pfoerster
Copy link
Member

@amalgame21 I am not familiar with kickstart.nvim but texlab reports build errors using the LSP diagnostics (textDocument/publishDiagnostics) so there should be a way to see them from the client (either through an error list somewhere or they are shown inline)

@Unpredictability
Copy link

Hi, I have the same problem.
The chktex diagnostics works well and I can see a sign wherever there's an error. But when I write something bad and the chetex couldn't recognize, I build it and only get a Build Error message. I am confused where the error is.
but texlab compiles much faster than vimtex, so I still want to use texlab to compile.

@pfoerster pfoerster added bug Something isn't working needs more info Issue requires more information from poster labels Jan 18, 2023
@pfoerster
Copy link
Member

@amalgame21 @Unpredictability Can you try the same thing with texlab 4.3.2? ChkTeX diagnostics are published through the same channel as the build errors but the project resolution might be wrong so the build errors are not picked up properly.

@krisfans
Copy link

Hi, I have the same problem.
I use sublime text 4 with sublimelsp/LSP-TexLab. If I compile my .tex file successfully, I can get waring message. But if I fail to compile my .tex file , the lsp client will only show Build error and there is no LSP diagnostics message .

@anwaralameddin
Copy link

Hello, there are a couple of things that may be relevant here:

  • The mentioned script installs the plugin neovim/nvim-lspconfig, which configures the LSP servers if you (or a plugin) do not override them. nvim-lspconfig respects the TexLab's default settings listed in the configuration wiki entry, and Mason does not override these settings for TexLab. In particular, it sets both of texlab.chktex.onOpenAndSave and texlab.chktex.onEdit to false. Except for the last point below, changing these to true should be sufficient to get inlay diagnostic hints after building. You could include the below in init.lua or a lua module required by it.

    local lsp_config = require('lspconfig')
    lsp_config['texlab'].setup({
        settings={
            texlab = {
                chktex = {
                    onEdit = true,
                    onOpenAndSave = true
                },
            }
        }
    })

    Then, commenting out \end{document} should result in the inlay diagnostic hint No match found for `document' in the line containing \begin{document}.

  • Apart from inlay diagnostic hints, NeoVim provides a couple of ways to display the diagnostics published by the server, but it does not default to applying either of them. You could use

    :lua vim.diagnostic.setqflist()

    or

    :lua vim.diagnostic.setloclist()

    to list the diagnostics in the Quickfix List or Location List, respectively.

  • TexLab has been improving support for .latexmkrc, but it does not handle all relevant variables yet, and some may still cause complications, e.g. failure to display diagnostics. However, given that .latexmkrc was not explicitly mentioned in the OP, it may be better to discuss this in a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs more info Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants