XML highlighting broken with some embedded statements

Hi,

The following valid Scala code is considered broken by the plugin:

import scala.collection.mutable.ListBuffer

object BrokenXml extends Application {
  val xml = <xml>{
    val nodes = new ListBuffer[Node]
    nodes + <element/>
    nodes
  }</xml>


  println(xml)
}


It results in the following highlighting errors:
Picture 2.png
Hovering over the errors displays: "Scala expression expected in injection in xml"

Cheers,
Andrew

0

It has done according scala language spec:
ScalaExpr ::= ‘{’ Expr ‘}’
So if you want for now to hide red code you can wrap it into additional braces (block expression):


object BrokenXml extends Application {
  val xml = <xml>{ {
    val nodes = new ListBuffer[Node]
    nodes + <element/>
    nodes
  } }</xml>


  println(xml)
}




But of course it's not rigth thing for us, I'll ask about it and fix accodrding compiler (not spec).

Best regards,
Alexander Podkhalyuzin.

0

Thanks for the quick response ... and you have my sympathies for mismatches between the spec and compiler.

Cheers,
Andrew

0

Ok, specification was fixed and I added appropriate change. From next release you can use Block(not only Expr) inside Scala injections in xml.

0

请先登录再写评论。