-
Notifications
You must be signed in to change notification settings - Fork 395
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
Too greedy errorformat match with textidote compiler when test contains pattern :\d+
#2736
Comments
Here is an examplatory fix for the issue, but not sure whether this is the way to go: diff --git a/compiler/textidote.vim b/compiler/textidote.vim
index 8ddd8feb..ba8ea1ba 100644
--- a/compiler/textidote.vim
+++ b/compiler/textidote.vim
@@ -39,6 +39,7 @@ let &l:makeprg = 'java -jar ' . shellescape(fnamemodify(s:cfg.jar, ':p'))
\ . (has_key(s:cfg, 'args') ? ' ' . s:cfg.args : '')
\ . ' --no-color --output singleline --check '
\ . s:get_textidote_lang(s:language) . ' %:S'
+ \ . ' \| sed -E "s/:([[:digit:]]+)/:\xE2\x80\x8C\1/"'
setlocal errorformat=
setlocal errorformat+=%f(L%lC%c-L%\\d%\\+C%\\d%\\+):\ %m It introduces a zero-space whitespace into the output. Unfortunately, vim is too clever to hide it, so it shows in the location list as
I don't know whether something similar can be achieved with vim itself so that there is no external tool dependency... |
Thanks, I can reproduce this problem. I will see if I can improve the errorformat here. If possible, that will be a better solution, I think. |
I pushed a possible fix; please test. |
Seems to work for me, both in the minified test case as well as in the larger document I originally encountered it in, and so far, I've not encountered any adverse effects. Thank you for the fix, can be closed from my side for now :) |
Great, glad to hear it! |
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
minimal.vimrc (make sure to adapt the jar path as required)
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
vim -u minimal.vimrc foo.tex
: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:
Location list after manual
:lopen
in bufferfoo.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):Output of a manual run of texidote with vimtex's usual parameters:
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
The text was updated successfully, but these errors were encountered: