-
Notifications
You must be signed in to change notification settings - Fork 108
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
Can this library be used with IntelliJ? #24
Comments
This issue should be reported at https://youtrack.jetbrains.com |
Or you could try Scala IDE for Eclipse, which handles macros. |
I am aware that the problem with highlighting is IntelliJ's but my question was about the possibility of using the library without the macro. Anyway, thank you very much for answering. |
Scala's xml library is pretty weird. I doubt it would be possible to replace the macro by defining an implicit conversion from xml.Element to Binding[ ], but perhaps @Atry has some insight on the matter. |
Binding.scala changes types of XML literals via macros. IntelliJ IDEA seems using its own typer, which does not fully understand macros and other complex Scala syntax, even for those code that does not involve macros. I have many Scala files that do not use macros. They are still red marked by IntelliJ IDEA. |
@joseraya Thought a bit more about it, and you can avoid having to use the Replace xml literals with scalatags's JSDom. For example: import scalatags.JsDom.all._
def clicker(i: Var[Int]) = Binding[Node](
div(
button(onclick := {() => i := i.get + 1})("click me"),
p("num times clicked: " + {i.bind.toString}),
tag("test-tag")("this is a test")
).render
)
def app = Binding[Node]{
val i = Var(0)
div({clicker(i).bind}).render
}
def main(): Unit = {
scalajs.dom.render(document.body, app)
}
The only downside (upside? ;) ) is that you lose xml literals |
The entire |
Yeah, just realized this :( |
XHTML literals in I bet you never want to hard-code the code. |
@deontologic @joseraya the complier won't do the implicit conversion, it knows what happen |
@vodkaka lol, nice |
@vodkaka Could you provide an example of this? I attempted defining it, but I am not familiar enough with Scala and Binding.scala to get it working. EDIT: After some googling I came across this solution from reddit: |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I am using IntelliJ as my IDE and it underlines in red all my @dom functions. I tried to open the sample project at https://github.com/ThoughtWorksInc/todo/ and I have the same problem. Is there a way to get rid of this? I have looked at the docs and could not find it.
As it seems related to the use of the macro, is there an "easy" way to define a binding without the macro?
The text was updated successfully, but these errors were encountered: