neovim / tree-sitter-vimdoc

Tree-sitter parser for Vim help files
Apache License 2.0
104 stars 13 forks source link

backtick( and backtick{ start inline code block #143

Closed xian-wen closed 3 hours ago

xian-wen commented 3 hours ago

Sorry, if this is a duplicate of any other issues, forgive me, please. Thank you so much. Problem On the latest stable Neovim, the help.txt file does not highlight correctly. Especially for characters following ` (single backtick), all are highlighted just like a comment starting from the open backtick to the end of line. See the details here https://github.com/neovim/neovim/issues/30930.

justinmk commented 3 hours ago

sample text:

                            *'(* *`(*
'(  `(          To the start of the current sentence, like the |(|
            command.

                            *')* *`)*
')  `)          To the end of the current sentence, like the |)|
            command.

                            *'{* *`{*
'{  `{          To the start of the current paragraph, like the |{|
            command.

                            *'}* *`}*
'}  `}          To the end of the current paragraph, like the |}|
            command.
justinmk commented 3 hours ago

I am not sure this is worth "fixing" but can track it here for now. The parser is doing the correct thing for this help text.

related:

xian-wen commented 3 hours ago

Thank you so much for the modification. In fact, it is not only backtick( and backtick{, it is backtick(mark). Any marks (expect the backtick mark itself) following backtick have the same issue. See :h motion.txt.

clason commented 3 hours ago

Yes, I don't think this can be solved without lookahead (i.e., an external scanner). It's usually better to rewrite the docs to avoid these situations (e.g., use quotes).

justinmk commented 3 hours ago

In fact, it is not only backtick( and backtick{, it is backtick(mark). Any marks following backtick have the same issue. See :h motion.txt.

Duplicate of https://github.com/neovim/tree-sitter-vimdoc/issues/113