Haskell has a bunch of language extensions, which can be enabled with LANGUAGE pragma. I often forget how a pragma is spelled, so I thought adding these as keywords is a good idea.
Details
- Reviewers
dhaumann cullmann - Group Reviewers
Framework: Syntax Highlighting - Commits
- R216:d2a38d790914: Haskell: Add all language pragmas as keywords.
This patch has a flaw and I wasn't able to figure out where the problem lies. If I place the cursor onto emtpy line and then type "{-# Over", the keyword completion doesn't pop out. But if I then press "Ctrl+Backspace" to delete "Over" and start typing it again, the completion does show.
Diff Detail
- Repository
- R216 Syntax Highlighting
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
I just found that the same problem exists for import_keywords too - when I type import qual, the completion doesn't show up, and deleteting qual and typing it again causes it to show.
So, it seems to be a coding bug.
I will change the patch slightly and commit: Instead of StringDetect, we better use WordDetect. Also, we need to increase the version="" number. Besides that, the patch looks good.
@arrowdodger Isn't there a line missing:
+ <context attribute="Pragma" lineEndContext="#pop" name="pragma">
+ <keyword attribute="Pragma" context="#stay" String="language_pragmas" />
+ <StringDetect attribute="Pragma" context="#pop" String="#-}"/> <------------------ This line ?
+ </context>
Also, is the lineEndContext #pop or should it rather be #stay?
Please clarify/confirm.
Also: could you provide us with a small demo code so that we can extend our unit test?
- Use WordDetect instead of StringDetect for omport keyword.
- Pop Pragma context on #-} string, not newline.
Demo for the highlighting rule - I don't think I can say anything to the auto completion issue. I am pretty sure it is unrelated to your xml file.
Sure. Pragmas have following form:
{-# blabla #-}
Specifically, pragmas that enable language extensions looks like
{-# LANGUAGE OverlappingInstances, BangPatterns #-}
As I've found today, pragmas can span onto multiple lines:
{-# LANGUAGE OverlappingInstances, BangPatterns #-}
Added autotests. Not sure if .ref file should be updated, as the tests pass as they are now.
Hmm, interesting, I would assume you need to update the ref given the input did change.