Skip to content
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

Add Haddock highlighting #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions syntax/haskell.vim
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ syn region haskellBlockComment start="{-" end="-}"
\ haskellBlockComment,
\ haskellTodo,
\ @Spell

" FIXME: haddock block comments should be able to contain hsBlockComments, but
" it doesn't seem to work at the moment.
syn region haskellHaddockLineComment start='{-|' end='-}' contains=hsFIXME,@Spell
syn match hsLineComment "--.*$" contains=hsFIXME,@Spell
" Line-based haddock comments are trickier - they continue until
" the next line that isn't part of the same block of comments.
syn region haskellHaddockLineComment start='-- |' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell
syn region haskellHaddockLineComment start='-- \$\w\+' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell
syn region haskellHaddockLineComment start='-- ^' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell
" Haddock sections for import lists
syn match hsHaddockSection '-- \*.*$'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... it looks like I'm not even use this anywhere. Must be vestigial. If you decide after all that this is worth pulling, I'll remove it.

" Named documentation chunks (also for import lists)
syn match hsHaddockSection '-- \$.*$'


syn region haskellPragma start="{-#" end="#-}"
syn match haskellQuasiQuoted "." containedin=haskellQuasiQuote contained
syn region haskellQuasiQuote matchgroup=haskellTH start="\[[_a-z][a-zA-z0-9_']*|" end="|\]"
Expand Down Expand Up @@ -137,6 +153,8 @@ highlight def link haskellType Include
highlight def link haskellLineComment Comment
highlight def link haskellBlockComment Comment
highlight def link haskellPragma SpecialComment
highlight def link haskellHaddockLineComment SpecialComment
highlight def link haskellHaddockBlockComment SpecialComment
highlight def link haskellString String
highlight def link haskellChar String
highlight def link haskellBacktick Operator
Expand Down