hvesalai / emacs-scala-mode

The definitive scala-mode for emacs
http://ensime.org
GNU General Public License v3.0
361 stars 68 forks source link

add string interpolation #116

Closed bmalehorn closed 8 years ago

bmalehorn commented 8 years ago

Before, scala-mode wouldn't highlight formatter variables, making them a bit difficult to pick out:

 val s = s"foo $bar"

Now, they're given a different color (font-lock-variable-name-face) than the surrounding string.

Text inside ${} will be highlighted homogenously (rather than recursively highlighted as constants, keywords, etc.). This is what ruby-mode does and it's definitely good enough.

Closes #60.

Here's what it looks like in action:

interpolation

CLAassistant commented 8 years ago

CLA assistant check
All committers have signed the CLA.

fommil commented 8 years ago

ensime adds semantic colouring of string interpolation. It occurs to me that scala-mode may be doing a lot of work that it doesn't need to when ensime is enabled... is there a way to selectively disable some regexps?

hvesalai commented 8 years ago

Yes, you can state which level of fontlock you want. I don't remember how it actually affects, but at least there is infrastructure in emacs for doing such selective fontlocking.

hvesalai commented 8 years ago

gnu.org is down for me at the moment, but see "GNU Emacs Lisp Reference Manual: Levels of Font Lock"

bmalehorn commented 8 years ago

So... thoughts? Any nits to pick? Or is it good as-is?

hvesalai commented 8 years ago

LGTM (based on code review). @fommil any further comments or do you want to test it? If not, can you merge?

fommil commented 8 years ago

good stuff!

bmalehorn commented 8 years ago

Thanks for the merge! It's fun to make a good package a bit better.

fommil commented 8 years ago

@bmalehorn plenty of other things in the larger ensime world to look at if you get bored :smile: