Skip to content

Highlighting issue in VSCODE for string interpolation s2 #222

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
tiphdousset opened this issue Oct 19, 2021 · 2 comments · Fixed by #223
Closed

Highlighting issue in VSCODE for string interpolation s2 #222

tiphdousset opened this issue Oct 19, 2021 · 2 comments · Fixed by #223

Comments

@tiphdousset
Copy link

In VSCODE the highlighting for s2 string interpolation seems to be broken. See screenshots
correctHighlightingWithS
noHighlighitngWithS2

@MaximeKjaer
Copy link
Contributor

Good catch. I think the issue is that we use alphaId as the regex for the string interpolation tag, but we should probably use plainid.

A minimized example:

implicit class TestInterpolation(val sc: StringContext) extends AnyVal {
  def `this doesn't work`(args: Any*): String = "no"
  def test(args: Any*): String = "test"
  def test1(args: Any*): String = "test1"
  def test_+(args: Any*): String = "test_+"
}

val name = "world"

`this doesn't work`"hello $name" // this does not compile
test"hello $name"
test1"hello $name"
test_+"hello $name"

@som-snytt
Copy link

plainid in spec includes operators, which are not allowed. alphaid is not "only alphas" but idents starting with an alpha (upper or lower, distinguished for patterns).

TIL it accommodates idrest, the operator tail in test_+. I was recalling that you can't s"$x_+" which interpolates x_ not x_+.

So, you can't *"text" which is too bad because it looks cool.

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

Successfully merging a pull request may close this issue.

3 participants