shadaj/slinky

IntelliJ hightlight error while using functional components

AlexITC opened this issue · 7 comments

It should be simple to reproduce the issue, just open the pwa project from IntelliJ, then, open the Main class, you should see errors on IntelliJ while they aren't:

Screenshot from 2020-10-25 21-06-25

@AlexITC .. What happens if you just use SharedItemApp(apis, appInfo) ?

Apologize, that was my intention, it has the same effect:
image

I am getting the same issue now with non-functional components. Weird.

@AlexITC .. Is it working for you with normal components. And you definitely see Slinky injector in the Scala preferences ?

I have a project using the non-functional components, and everything works as expected.

I know they changed to scala 2.13 in Intellij 2020.3.x so we'll probably need a different build against scala2.13 before upgrading

evbo commented

on intellij 2020.3 (Build #IC-203.5981.155), using Scala 2.13.4 and also and I get same highlighting errors as reported by @AlexITC. Also, here's a new one that took me quite a while to resolve!:

import org.scalajs.dom.{Event, html}
import slinky.core.{SyntheticEvent}
import slinky.web.html.{input, onChange, value}

object TableColumnFilter {

  case class Props(column: ColumnFilter)

  val component = FunctionalComponent[Props] { props =>
    val count = props.column.preFilteredRows.length

    val onChangeValue = (e: SyntheticEvent[html.Input, Event]) => props.column.setFilter(e.target.value)

    // the commented line is what Intellij "wants" me to write, 
    // the uncommented line is correct and what compiles
    input(
      value := props.column.filterValue,
   // onChange := onChangeValue,
      onChange := (onChangeValue(_)),
      placeholder := s"Search ${count} records..."
    )
  }
}
evbo commented

One more, formsubmission callbacks are syntactically correct but also get highlighted red erroneously:
VALD