Macro Support

I'm using the `@dom` macro in Binding.scala ( https://github.com/ThoughtWorksInc/Binding.scala ), which wraps the body of annotated vals and defs in a Binding or BindingSeq object. 

Consider one of the examples: 

object IntSample extends Sample {

  @dom
  def spinner(i: Var[Int]): Binding[Node] = {
    <div>
      <button onclick={ event: Event => i := i.get - 1 }>-</button>
      { i.bind.toString }
      <button onclick={ event: Event => i := i.get + 1 }>+</button>
    </div>
  }
  
  @dom
  def render = {
    val i = Var(0)
    <div>
      { spinner(i).bind }
      The current value of the spinner is { i.bind.toString }
    </div>
  }
  
}

IDEA expects the return type to be of xml.Elem or NodeBuffer, so all of the xml and calls to Binding's `bind`, `watch()`, and `unwatch()` methods get the red squiggles. 

How would you recommend writing a sbt plugin to fix the highlighting?

I think I can override `SyntheticMembersInjector.injectFunctions` to add Binding's methods, but am unsure of how to fix the return type errors. 

1 comment
Comment actions Permalink

I think you can report an issue in the issue tracker 

https://youtrack.jetbrains.com/issues/IDEA

1

Please sign in to leave a comment.