hylang / hy-mode

Hy mode for Emacs
GNU General Public License v3.0
189 stars 48 forks source link

FR: multi-methods syntax highlighting and indentation #67

Closed bennyandresen closed 6 years ago

bennyandresen commented 6 years ago

Hey,

it may only be a contrib module, but I think this is useful to have: http://docs.hylang.org/en/stable/contrib/multi.html#id1

I've tried adding defmulti to hy--kwds-defs and the syntax highlighting was there but the indentation wasn't equal to defn which I don't understand. It has the same amount of parameters.

defmethod probably needs extra work because it has additional parameters before the arguments.

Thanks in advance and this overhaul of hy-mode is very useful!

ekaschalk commented 6 years ago

ba9e3386248a111a78088904ec41040269144cd8 no extra work needed.

bennyandresen commented 6 years ago

In the following line:

(require [hy.contrib.multi [defmulti defmethod]])

defmulti gets font-locked by font-lock-keyword-face and defmethod gets font-locked with font-lock-function-face-name-face

ekaschalk commented 6 years ago

The function name face is coming from the previous defmulti.

Resolved with 0868b73236f5de26a99c85f57163a1442eaa677c, be aware def-likes now require the opening parenthesis to be attached on the left (defsomething ... for syntax highlighting to apply. Since Hy doesn't highlight the import names (right now), only way to resolve this.