Hello, Happy New Year! I got into a bug in my Vim syntax highlighting version. Highlight stays in lua mode after ctxlua macro is closed. Here is a MWE, where «this should not be highlitghted as a comment indeed is. \starttext Hello! \ctxlua{context("does the parser work?")} -- this should not be highlighted as a comment \stoptext Do other Vim users come into this? Is my syntax file outdated? I am using this Vim version on OpenBSD 7.3 -stable: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 6 2023 08:55:14) Included patches: 1-1876 Best regards, Damien Thiriet
Hello on my installation, it's working: [image: image.png] But I'm on an old version on debian: VIM - Vi IMproved 8.2 (2019 Dec 12 kompiliert am Oct 01 2021 01:51:08) Inklusive der Patches: 1-2434 Extra Patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428 Perhaps something has changed in version 9.0... Hope it helps Christian Am Sa., 6. Jan. 2024 um 13:04 Uhr schrieb Damien Thiriet via ntg-context < ntg-context@ntg.nl>:
Hello,
Happy New Year!
I got into a bug in my Vim syntax highlighting version. Highlight stays in lua mode after ctxlua macro is closed. Here is a MWE, where «this should not be highlitghted as a comment indeed is.
\starttext
Hello! \ctxlua{context("does the parser work?")}
-- this should not be highlighted as a comment
\stoptext
Do other Vim users come into this? Is my syntax file outdated?
I am using this Vim version on OpenBSD 7.3 -stable: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 6 2023 08:55:14) Included patches: 1-1876
Best regards,
Damien Thiriet
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
I was in touch with the maintainer of the context.vim syntax file about this. It turns out to be an issue with the lua.vim file that is included in the context one. Lua.vim highlights trailing parentheses as errors, but that’s done in a way that doesn’t work well when the file is included by other syntax files. It somehow steals the syntax context and makes Vim stay in Lua mode when it should go back to ConTeXt mode (I’m not too savvy of the details). The maintainer came up with a workaround [1] to force returning to ConTeXt mode, although the parenthesis remains highlighted as an error. That highlight bothers me, so my own workaround is to copy the lua.vim file in my own .vim/syntax folder and comment out the ‘syn match luaParenError ")"’ line (l.61 in my Vim version). Maybe playing with the ‘contained’ keyword (in lua.vim) could lead to a proper solution, but I’m happy enough with my workaround that I haven’t felt the need to investigate this issue any further. Hope that helps, Vincent [1] https://github.com/vim/vim/pull/13778 On 06/01/2024 12:28, Damien Thiriet via ntg-context wrote:
Hello,
Happy New Year!
I got into a bug in my Vim syntax highlighting version. Highlight stays in lua mode after ctxlua macro is closed. Here is a MWE, where «this should not be highlitghted as a comment indeed is.
\starttext
Hello! \ctxlua{context("does the parser work?")}
-- this should not be highlighted as a comment
\stoptext
Do other Vim users come into this? Is my syntax file outdated?
I am using this Vim version on OpenBSD 7.3 -stable: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 6 2023 08:55:14) Included patches: 1-1876
Best regards,
Damien Thiriet ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Thanks for your effort! I have the same problem in Neovim and linked the pull request there: https://github.com/neovim/neovim/issues/26966 Best, Gerion Am Montag, 8. Januar 2024, 12:16:14 CET schrieb Vincent Hennebert:
I was in touch with the maintainer of the context.vim syntax file about this. It turns out to be an issue with the lua.vim file that is included in the context one. Lua.vim highlights trailing parentheses as errors, but that’s done in a way that doesn’t work well when the file is included by other syntax files. It somehow steals the syntax context and makes Vim stay in Lua mode when it should go back to ConTeXt mode (I’m not too savvy of the details).
The maintainer came up with a workaround [1] to force returning to ConTeXt mode, although the parenthesis remains highlighted as an error.
That highlight bothers me, so my own workaround is to copy the lua.vim file in my own .vim/syntax folder and comment out the ‘syn match luaParenError ")"’ line (l.61 in my Vim version).
Maybe playing with the ‘contained’ keyword (in lua.vim) could lead to a proper solution, but I’m happy enough with my workaround that I haven’t felt the need to investigate this issue any further.
Hope that helps, Vincent
[1] https://github.com/vim/vim/pull/13778
On 06/01/2024 12:28, Damien Thiriet via ntg-context wrote:
Hello,
Happy New Year!
I got into a bug in my Vim syntax highlighting version. Highlight stays in lua mode after ctxlua macro is closed. Here is a MWE, where «this should not be highlitghted as a comment indeed is.
\starttext
Hello! \ctxlua{context("does the parser work?")}
-- this should not be highlighted as a comment
\stoptext
Do other Vim users come into this? Is my syntax file outdated?
I am using this Vim version on OpenBSD 7.3 -stable: VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 6 2023 08:55:14) Included patches: 1-1876
Best regards,
Damien Thiriet
participants (4)
-
Christian Prim
-
damien@thiriet.web4me.fr
-
Gerion Entrup
-
Vincent Hennebert