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

Scala mode doesn't ignore /* in `` #64

Open
jackcviers opened this issue Mar 18, 2014 · 5 comments
Open

Scala mode doesn't ignore /* in `` #64

jackcviers opened this issue Mar 18, 2014 · 5 comments

Comments

@jackcviers
Copy link

implicit val AssetUploadAndMetadataUnmarshaller = Unmarshaller[AssetUploadAndMetadata](ContentTypeRange(MediaRanges.`multipart/*`)){
  * case(HttpEntity.NonEmpty(contentType, data)) => "aaarg!"
}

Note that multipart/* is inside backticks. scala-mode-2 considers that to be the start of a comment, and C-M inserts a * at the beginning of the new line. Additionally, if I fix that and remove the hanging *, the indentation screws up:

implicit val AssetUploadAndMetadataUnmarshaller = Unmarshaller[AssetUploadAndMetadata](ContentTypeRange(MediaRanges.`multipart/*`)){
    case(HttpEntity.NonEmpty(contentType, data)) =>
    * "aaargh"

I think the culpable regex for the coloring is here: https://github.com/hvesalai/scala-mode2/blob/master/scala-mode2-fontlock.el#L489

But I am not sure. I will try adding a "not `" on the regex and make a pull request if that fixes it. I assume that something similar will be found for indentation.

@hvesalai
Copy link
Owner

You have nice variable names :)

The culpit is how emacs handles comments. Anything that is not a string is scanned for comment begin mark (/* or //) and since variable names (inside backticks or not) are not considered as strings, you get bitten.

The proper way to fix this would be to modify the syntax-propertize-function so that it marks the /* as "symbol constituent" when the sequence appears inside backticks. The current syntax-propertize-function is here: https://github.com/hvesalai/scala-mode2/blob/master/scala-mode2-syntax.el#L537.

An other option would be to make backticks be string delimiters (i.e. making scala symbols be strings from emacs' point of view) by modifying the syntax table that is here: https://github.com/hvesalai/scala-mode2/blob/master/scala-mode2-syntax.el#L406 and then to modify the function you pointed to to font-lock (i.e. colorise) them as normal code.

The latter would maybe be easyer.

The code line you pointed to just decides how comments and strings are colored, so changing that will not fix this issue.

I think I will not try to fix this issue my self, but I will gladly accept any clean fix for it as a pull request.

@hvesalai hvesalai added bug and removed bug labels Apr 13, 2014
@hvesalai hvesalai added this to the Waiting for pull request milestone Apr 13, 2014
@fommil fommil removed the wontfix label May 14, 2016
@emanresusername
Copy link

has there been any movement on this one?

@fommil
Copy link
Contributor

fommil commented Dec 24, 2016

Would you be interested in looking into it? It's the only way it'll get fixed because it's not bothering me or Heikki.

@emanresusername
Copy link

emanresusername commented Dec 24, 2016 via email

@fommil
Copy link
Contributor

fommil commented Dec 24, 2016

We have a contributors page is the Emacs section of ensime.org to get you started with some material.

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

4 participants