Skip to content

Fix syntax highlighting for quoted expressions and types #3699

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

Closed
2 tasks done
nicolasstucki opened this issue Dec 24, 2017 · 13 comments
Closed
2 tasks done

Fix syntax highlighting for quoted expressions and types #3699

nicolasstucki opened this issue Dec 24, 2017 · 13 comments

Comments

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Dec 24, 2017

We are currently using the first kind of quote to avoid formatting issues as shown below. Currently ' assumes that it contains a single Char or an encoded Char such as '\n'.

It would be good to make it an alias to allow users to copy-paste code from the documentation. I have already had this issue and the error message is not that helpful.

val expr1 = ’{ 1 + x }
val expr2 = ’{ y - 9 }
val expr1 = '{ 1 + x }
val expr2 = '{ y - 9 }
'[Int]
'[List[Int]]

Screenshot:
screen shot 2018-02-22 at 14 38 43

@smarter
Copy link
Member

smarter commented Dec 25, 2017

According to https://github.com/github/linguist/blob/master/vendor/README.md, syntax highligthing for Scala in Github is done using https://github.com/mads-hartmann/scala.tmbundle/tree/master/Syntaxes. The grammar could be fixed there.

@smarter
Copy link
Member

smarter commented Dec 25, 2017

In fact, the syntax highlighting of ' is already broken in some cases: mads-hartmann/scala.tmbundle#59

@nicolasstucki
Copy link
Contributor Author

For the record, the same issue exists in the IDE.

@smarter
Copy link
Member

smarter commented Dec 25, 2017

Yes, because the IDE syntax highlighting file is based on the one from https://github.com/mads-hartmann/scala.tmbundle/tree/master/Syntaxes :).

@nicolasstucki
Copy link
Contributor Author

Perfect, we only need to fix one highlighter :)

@odersky
Copy link
Contributor

odersky commented Dec 27, 2017

I would say, let's do both: Fix the syntax highlighting and introduce the alias.

@nicolasstucki nicolasstucki removed this from the 0.6 Tech Preview milestone Jan 16, 2018
@nicolasstucki
Copy link
Contributor Author

mads-hartmann/scala.tmbundle#63 fixes the highlighting issue with the quoted symbols. We should try to enhance that fix to also fix quoted expressions and types.

@nicolasstucki nicolasstucki changed the title Should be an alias for ' Fix syntax highlighting for quoted expressions an types Jan 19, 2018
@smarter
Copy link
Member

smarter commented Jan 19, 2018

The PR you link to has been open for 16 days with zero response. If the repo owner is unresponsive we should consider forking it and somehow convince Github to switch to our version.

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Jan 19, 2018

Yes, I saw that. We should instead look at https://github.com/daltonjorge/vscode-scala and maybe fork it

@nicolasstucki
Copy link
Contributor Author

I managed to edit that template and fix the issue.

@nicolasstucki
Copy link
Contributor Author

I created a copy of the VS code extension Scala (Dotty) Syntax.

screen shot 2018-01-19 at 21 28 40 1

@smarter the Dotty Language server should depend on this extension now. How do we do this?

@smarter
Copy link
Member

smarter commented Jan 19, 2018

The simplest thing to do would be to just inline the content of this extension in vscode-dotty and not depend on anything. However we need to check what happens if multiple extensions for Scala syntax are installed together. Do they conflict with each other in some way? If so, the best thing to do would indeed be to make a separate extension but also to get every other Scala vscode extension to depend on this one. Grep for daltonjorge.scala in the dotty repo to see how vscode-dotty currently depends on this extension.

@nicolasstucki nicolasstucki changed the title Fix syntax highlighting for quoted expressions an types Fix syntax highlighting for quoted expressions and types Feb 15, 2018
@nicolasstucki nicolasstucki self-assigned this Feb 22, 2018
@nicolasstucki
Copy link
Contributor Author

FInally fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants