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

Conversation

johntyree
Copy link
Contributor

I swiped some highlighting tricks from my old syntax/haskell.vim file. This particular group adds highlighting of Haddock docs as SpecialComments

@raichoo
Copy link
Member

raichoo commented Sep 22, 2015

Stupid question. What benefits does this have? I thought SpecialComment was meant to be for things like pragmas? I'd personally prefer to have Pragmas stand out, once you have a lot of haddock in your code pragmas kind of fade to the background a little bit too much for my taste.

@johntyree
Copy link
Contributor Author

There is a highlight group called "PreProc" that is used for C pragmas. I would think haddock is very the definition of a "special comment," as it is literally a comment with special meaning in some contexts.

If you have a lot of haddock and find it distracting, you might rather choose a less intense color, but personally I like it to stand out. If I find myself needing to refer to comments frequently to be able to understand and use my code, it is helpful to have a visual reminder that the doc-comments really should be exported.

It also helps identify places where I'm accidentally not writing haddock when I meant to, which is usually a silent error.

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.

@raichoo
Copy link
Member

raichoo commented Sep 25, 2015

I recall that I made the pragmas SpecialComment because ghc-mod is using this group to complete Language extensions and pragmas alike. Slipped my mind.

@johntyree
Copy link
Contributor Author

Oh! Good to know...

Patching that is a much bigger pain...

@NickHu
Copy link

NickHu commented Jul 26, 2017

Is there any hope that this will be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants