开发者

Is Vim's Haskell syntax highlighting broken?

开发者 https://www.devze.com 2022-12-19 03:12 出处:网络
It seems to me that Vim\'s synt开发者_运维知识库ax highlighting for Haskell is broken, or very buggy. Multiline comments in Haskell (beginning with {- and ending with -}) are arbitrarily greened-out a

It seems to me that Vim's synt开发者_运维知识库ax highlighting for Haskell is broken, or very buggy. Multiline comments in Haskell (beginning with {- and ending with -}) are arbitrarily greened-out and un-greened-out. Sometimes dragging the mouse over the commented code causes it to reverse color.

Has anyone else been experiencing this problem?


Vim's syntax highlighting trades off accuracy for performance, by default. To do this, it only examines a certain number of lines before the current position to determine how things should be highlighted. This means that it can sometimes get out of sync.

The different methods it uses to determine how much text to examine can be seen at :help :syn-sync. If you want it to Just Work, use :syn sync fromstart to make Vim consider the entire buffer up to the cursor to determine the highlighting.


This happens with other languages as well, it's just the way vim works. It does not actually use a parser, which would be required to be completely accurate all of the time. Actually, sometimes you may need more than just a syntax parser.

http://vimdoc.sourceforge.net/htmldoc/syntax.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号