lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.41k stars 389 forks source link

Quickfix only gets populated using single shot compilation and at first compilation error of continuous mode #2847

Closed aabbccddeeffggj closed 9 months ago

aabbccddeeffggj commented 9 months ago

Description

Hi, compilations done within the continuous compilation mode only populates the quickfix list the first time it finds an error, in the subsequent compilations I do not get my quickfix populated.

Steps to reproduce

  1. Have errors, then compile.
  2. Check quickfix window, it's populated with the compiler error messages.
  3. Have no errors, then compile
  4. Check quickfix window, now there's no error messages.
  5. Have errors, then compile.
  6. Check quickfix window, now there's no error messages, but it should have been populated.

Expected behavior

Quickfix window always get populated with the compilers errors when there're such.

Actual behavior

Quickfix window only get populated with the compilers errors when there's such in the first time errors are found.

Do you use a latexmkrc file?

Yes, it's content is: "$pdf_mode = 4;"

VimtexInfo

System info:
  OS: Arch Linux
  Vim version: NVIM v0.9.4
  Has clientserver: true
  Servername: /run/user/1000/nvim.1349705.0

VimTeX project: tex
  base: tex.tex
  root: /home/user/8-working/tex
  tex: /home/user/8-working/tex/tex.tex
  main parser: current file verified
  document class: book
  packages: amsbsy amsgen amsmath amsopn amstext calc epstopdf-base etoolbox expl3 fix-cm fontenc fontspec fontspec-luatex geometry graphics graphicx iftex ifvtex keyval l3keys2e lualatex-math mathastext mathtools mhsetup trig unicode-math unicode-math-luatex xparse
  compiler: latexmk
    engine: -lualatex
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 5
      output: /tmp/nvim.user/3XoMvB/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode  -lualatex -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'tex.tex'
      pid: 1349740
  viewer: Zathura
    xwin id: 46137347
    cmd_start: zathura  -x "/usr/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" 'tex.pdf'&
  qf method: LaTeX logfile
lervag commented 9 months ago

Hi, compilations done within the continuous compilation mode only populates the quickfix list the first time it finds an error, in the subsequent compilations I do not get my quickfix populated.

Strange.

Steps to reproduce

  1. Have errors, then compile.

  2. Check quickfix window, it's populated with the compiler error messages.

  3. Have no errors, then compile

  4. Check quickfix window, now there's no error messages.

  5. Have errors, then compile.

  6. Check quickfix window, now there's no error messages, but it should have been populated.

I can't reproduce this. For me, this works as expected.

Can you provide a minimal config and minimal example as explained in the issue template? Repeated below for convenience.

Or, at least as a minimum, your personal configuration?


Steps to reproduce

Please include minimal test files (minimal.vim and minimal.tex) and include an initial step like:

  1. nvim --clean -u minimal.vim minimal.tex
  2. Do something
  3. Do something more

Example of minimal test files

minimal.vim

set nocompatible
let &runtimepath  = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
" Add relevant options and VimTeX configuration below.

minimal.tex

\documentclass{minimal}
\begin{document}
Hello world!
\end{document}
aabbccddeeffggj commented 9 months ago

Can you provide a minimal config and minimal example as explained in the issue template? Repeated below for convenience.

I tested with the test files, it worked, then I texted with my configuration, but without the auto-command I set for Trouble, and it also worked. The auto-command in question:

autocmd('User', {
    pattern = 'VimtexEventCompileFailed',
    callback = function()
        require('trouble').open('quickfix')
    end,
})

It seems like this auto-command is causing the quickfix list to not be updated.

lervag commented 9 months ago

It seems like this auto-command is causing the quickfix list to not be updated.

Yes, it sounds like the problem here is related to Trouble. I've never used that and barely know what it is.

Can you provide a listing of the minimal configuration you need to reproduce this? I.e., use my previously supplied minimal.vim. I believe you would need something like this:

set nocompatible
let &runtimepath  = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath  = '~/.vim/bundle/troublepath,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable

" Add relevant options and VimTeX configuration below.

autocmd User VimtexEventCompileFailed lua require('trouble').open('quickfix')
aabbccddeeffggj commented 9 months ago

Can you provide a listing of the minimal configuration you need to reproduce this?

set nocompatible
let &runtimepath  = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
" Add relevant options and VimTeX configuration below.

lua << EOF
-------------------------------------------------
--Plugin manager

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
  end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
  'lervag/vimtex',
  'folke/trouble.nvim'
})

-------------------------------------------------
--Vimtex options

vim.g.vimtex_syntax_conceal_disable = 1
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_view_forward_search_on_start = 0
vim.g.vimtex_quickfix_mode = 0

-------------------------------------------------
--Open Trouble in quickfix mode whenever there's a compilation error
vim.api.nvim_create_autocmd('User', {
  pattern = 'VimtexEventCompileFailed',
  callback = function()
    require('trouble').open('quickfix')
  end,
})
EOF

I'm sorry for not providing it earlier.

barely know what it is.

It's basically a window that can show different kinds of info, in this case it shows the quickfix window.

lervag commented 9 months ago

Thanks; I've pushed an update that I believe fixes this for you. Please update and test.

aabbccddeeffggj commented 9 months ago

All's working now, thanks once again for your efforts and kindness!

lervag commented 9 months ago

Glad to hear it!