False red squiggles with Akka HTTP dsl routing/parameters

The following code is not interpreted correctly:

val example =
parameters('color, 'backgroundColor ? "white") { (color, backgroundColor) =>
complete(s"The color is '$color' and the background is '$backgroundColor'")
}

Tooltip errors:

parameters: Cannot resolve reference parameters with such signature

'backgroundColor: Too many arguments for method parameters(ParameterDirectives.ParamMagnet)

backgroundColor: Missing parameter type: backgroundColor

 

Compiling the project with IDEA and SBT does not give any errors/warnings and the project just runs fine.

Probably something to do with the following?

https://github.com/akka/akka/blob/master/akka-http/src/main/scala/akka/http/scaladsl/server/directives/ParameterDirectives.scala#L47

I am using:

IntelliJ IDEA (Community Edition) IC-144.4199.23
Build #IC-144.4199, built on February 19, 2016
JRE: 1.8.0_66-b17 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation

Scala Plugin: 2.1.228.15.16

Build.sbt:
Scala 2.11.7
Akka 2.4.2

 

5
11 comments
Avatar
Permanently deleted user
Official comment
Avatar
Permanently deleted user

I have had issues with this as well - what's frustrating is that it used to work just fine.  Its related to some recent change with the editor.

My issue is here: SCL-9877

I'm hoping they can address this soon as its become a show stopper for me.

0
Avatar
Permanently deleted user

I join the choir here - its a really visually distracting bug +100 to get i fixed

0
Avatar
Permanently deleted user

yes please, confirm this is still happening!

0
Avatar
Permanently deleted user

I can confirm that on 22 May 2018 this is still happening

0
Avatar
Permanently deleted user

I can circumvent the issue by toggling the scala version in build.sbt. I toggle between 2.11.6 <-> 2.11.7, each time i toggle the red lines disappears,,, super annoying.

0
Avatar
Permanently deleted user

@Krille0x7c2 Can you give an example of your code? This is quite strange behaviour. Which versions of IDEA and scala plugin do you use?

0
Avatar
Permanently deleted user

//Scala version 2.12.4

//IDEA version 2017.1.6


package rest
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._

import scalaoauth2.provider.{AuthInfo}
import models.Hub._
import dal.{UserDal}
import models._


trait UsersApi extends UserDal
with JsonMappings
with OAuth2RouteProvider[AccountsRow] {
def usersGet = path("users") {
get {
authenticateOAuth2Async[AuthInfo[AccountsRow]]("realm", oauth2Authenticator) {
auth => complete(this.findUser)
}
}
}
}

//the red squiggles occur on the line starting auth =>
//the code compiles and runs every time



0
Avatar
Permanently deleted user

Can you try more recent version of IDEA? There was a number of improvement since 2017.1. Your example is not self-contained, so I cannot check it myself.

0

I can still see this issue with 2020.2

import akka.http.scaladsl.server.Directives._

object Test {

def main(args: Array[String]): Unit = {
val httpRoutes = parameters(
"number".as[Int].optional,
) {
(number) => {
complete("Psst, please use token XYZ!")
}
}
}
}

scalaVersion : 2.13.2
akkaVersion = "2.6.8"
akkaHttpVersion = "10.2.0"
0

Please sign in to leave a comment.