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

Fix code highlighting #79

Open
4lex1v opened this issue Jul 29, 2014 · 3 comments
Open

Fix code highlighting #79

4lex1v opened this issue Jul 29, 2014 · 3 comments

Comments

@4lex1v
Copy link
Contributor

4lex1v commented Jul 29, 2014

I've just started using emacs, so couldn't find myself where and how to fix it, but it's quite disturbing to write function types like:

val trans: String => String => String
case class Test(f: Any => String => String)

And if i declare type like type <+>[A, B] in addition to the previous incorrect highlighting, <+> also has incorrect color (i expected in to be similar to =>)

Where i have the the first type highlighted with one color (like all other types) and others with a different color like std names.

Also in things like type \//, the hole line is treated like a comment, although it is a valid name.

Is it possible to fix this at all with regexps or it more semantical parsing?

@hvesalai
Copy link
Owner

hvesalai commented Aug 5, 2014

All pull request on fixing this are welcome. However, you should also check out ensime.

@4lex1v
Copy link
Contributor Author

4lex1v commented Nov 18, 2014

I have another issue with highlighting, i.e object name in this case:

object ModuleName { ... }

Is highlighted as a constant, but it should be a type like class or trait. In fontlock i've found this two lines:

    ;; object
    (,(concat "\\<object[ \t]+\\("
              scala-syntax:id-re
              "\\)")
     1 font-lock-constant-face)

    ;; class, trait, object
    (,(concat "\\<\\(class\\|trait\\)[ \t]+\\("
              scala-syntax:id-re
              "\\)")
     2 font-lock-type-face)

So not sure what's the right highlighting?

@hvesalai
Copy link
Owner

objects are highlighted in different face since they are not types (classes, types and traits are).

Consider the following code

class F {}
val F: F = new F();

Here there are two Fs. The other (class F) is a type and the other (val F) is a value the type of which is F.

Now consider object F. Here also F is a value (like with val F), the type of which is actually F.type

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

3 participants