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

Haskell signature highlighting #12

Open
NickHu opened this issue Aug 2, 2017 · 5 comments
Open

Haskell signature highlighting #12

NickHu opened this issue Aug 2, 2017 · 5 comments

Comments

@NickHu
Copy link

NickHu commented Aug 2, 2017

Currently, the syntax highlighting for Haskell only highlights the first word before ::.

When I'm writing, I often like to provide a long list of type calculations; for instance, consider below

image

I believe that it would be better to highlight f x and f . g also; in general, I think it should highlight up to the preceding parenthesis (i.e. id should not be highlighted).

Another strange thing is that if the function before the double colon is fmap, no highlighting is applied...

image

@jgm
Copy link
Owner

jgm commented Aug 2, 2017

I've verified that this matches kate's highlighting behavior, so this isn't a bug in the implementation. Perhaps the haskell.xml file could be improved, though, to give better behavior.

Note that we apply the following local patch to the stock haskell.xml (and this explains why fmap isn't highlighted as a function, as it is in kate):

diff --git a/xml/haskell.xml b/xml/haskell.xml
index 27ca018..8997722 100644
--- a/xml/haskell.xml
+++ b/xml/haskell.xml
@@ -476,9 +476,9 @@
 
     <itemData name="Keyword"          defStyleNum="dsKeyword"  spellChecking="false" />
     <itemData name="Type Prelude"     defStyleNum="dsDataType" spellChecking="false" />
-    <itemData name="Function Prelude" defStyleNum="dsFunction" spellChecking="false" />
-    <itemData name="Data Prelude"     defStyleNum="dsKeyword"  spellChecking="false" />
-    <itemData name="Class Prelude"    defStyleNum="dsKeyword"  spellChecking="false" />
+    <itemData name="Function Prelude" defStyleNum="dsNormal"   spellChecking="false" />
+    <itemData name="Data Prelude"     defStyleNum="dsDataType" spellChecking="false" />
+    <itemData name="Class Prelude"    defStyleNum="dsDataType" spellChecking="false" />
 
     <itemData name="Signature"        defStyleNum="dsOthers"  spellChecking="false" />
     <itemData name="Function"         defStyleNum="dsNormal"   spellChecking="false" />

@NickHu
Copy link
Author

NickHu commented Aug 3, 2017

Yes, I had assumed this was a detail of the implementation rather than a bug. I started this issue to start a dialogue so that a consensus could be reached on whether or not this change is actually something that should be actioned. What is the rationale behind that patch?

I would submit a pull request myself, but I don't really know how the highlighting XML style works.

@jgm
Copy link
Owner

jgm commented Aug 3, 2017 via email

@ghost
Copy link

ghost commented Aug 7, 2017

Sorry, I don't remember my motivation for that patch. It has been a long time. So I don't know why I changed the XML like that. I can't help you here.

(Anyway, it's funny that we meet here again, @NickHu, after meeting at the xmonad-contrib repository. 😃 )

@ghost
Copy link

ghost commented Aug 7, 2017

You can see the effect of that patch between https://imgur.com/3FK5bOo and https://imgur.com/w3fAWZP

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

No branches or pull requests

2 participants