Dotty: Fix syntax highlighting for quoted expressions and types

Created on 24 Dec 2017  路  13Comments  路  Source: lampepfl/dotty

  • [x] Add fix to VS code
  • [x] Add fix to GitHub (https://github.com/github/linguist/pull/4044)

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

metaprogramming intermediate help wanted enhancement high fix available

All 13 comments

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.

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

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

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

Perfect, we only need to fix one highlighter :)

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

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

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.

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

I managed to edit that template and fix the issue.

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?

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.

FInally fixed

Was this page helpful?
0 / 5 - 0 ratings