Skip to content

Too greedy errorformat match with textidote compiler when test contains pattern :\d+ #2736

@noctux

Description

@noctux

Description

I want to use the textidote compiler/grammar checker with my tex files, however, the location list is populated with bogus, too long entries as the pattern :\d+ within a line is matched as a location<->message separator (I guess).

Here is a minimal working (or more precisely non-working) example:

foo.tex

\documentclass{article}
\begin{document}
Hellor Worlsd!~\cite{peterpan:2022:fictional}
\end{document}

minimal.vimrc (make sure to adapt the jar path as required)

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

let textidote_jar_path = '/usr/share/java/textidote.jar'
if filereadable(textidote_jar_path)
	let g:vimtex_grammar_textidote = {
		\ 'jar': textidote_jar_path,
		\}
endif

Please note: I'm not 100% sure whether this is a vimtex bug per se, as vimtex does no real processing in this particular case and it's more a thing between textidote and vim's errorfmt parsing. But maybe replacing/escaping semicolons in the message part of the violations can be done in a wrapper or something...

(sorry if this issue is a confusing read, I'm not really sure how this issue form will end up in the actual issue text. Thank you for vimtex as such and your patience in this case)

Steps to reproduce

  1. vim -u minimal.vimrc foo.tex
  2. In vim, type: :compiler textidote | lmake

Expected behavior

I stay within my document, the location list opens, and focus is moved to the first issue in my document as reported by textidote.

Actual behavior

I am moved to a buffer titled foo.tex(L3C1-L3C7): Possible spelling mistake found.. Suggestions: [Hello, Heller, Hellos, Hel l or, Mellor] (0) "Hellor Worlsd!~\cite{peterpan, I do not see a location list.

Additional Information:

:buffers
  1 #    "foo.tex"                      line 1
  2 %a   "foo.tex(L3C1-L3C7): Possible spelling mistake found.. Suggestions: [Hello, Heller, Hellos, Hel
l or, Mellor] (0) "Hellor Worlsd!~\cite{peterpan" line 1

Location list after manual :lopen in buffer foo.tex (Please note the |2022| that indicate that vim seems to (probably) assume that this is the linenumber and everything left of it potentially the filename):

foo.tex(L3C1-L3C7): Possible spelling mistake found.. Suggestions: [Hello, Heller, Hellos, Hell or, Mellor] (0) "Hellor Worlsd!~\cite{peterpan|2022| fictional}"                                                                                                                                                              
foo.tex(L3C8-L3C14): Possible spelling mistake found.. Suggestions: [World, Worlds] (7) "Hellor Worlsd!~\cite{peterpan|2022| fictional}"

Output of a manual run of texidote with vimtex's usual parameters:

java -jar '/usr/share/java/textidote.jar' --no-color --output singleline --check en foo.tex             
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=setting
TeXtidote v0.8.3 - A linter for LaTeX documents and others
(C) 2018-2021 Sylvain Hallé - All rights reserved

Found 2 warning(s)
Total analysis time: 4 second(s)

foo.tex(L3C1-L3C7): Possible spelling mistake found.. Suggestions: [Hello, Heller, Hellos, Hell or, Mellor] (0) "Hellor Worlsd!~\cite{peterpan:2022:fictional}"
foo.tex(L3C8-L3C14): Possible spelling mistake found.. Suggestions: [World, Worlds] (7) "Hellor Worlsd!~\cite{peterpan:2022:fictional}"

I guess that vim misinterprets the linter output around peterpan:2022 when splitting it to obtain filenames.

Do you use a latexmkrc file?

Yes, but happens without it as well

VimtexInfo

System info:
  OS: Arch Linux
  Vim version: VIM 9.0 (1-1572)
  Has clientserver: true
  Servername: undefined (vim started without --servername)

VimTeX project: foo
  base: foo.tex
  root: /tmp
  tex: /tmp/foo.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions