These are chat archives for ensime/ensime-atom

23rd
May 2017
Matthew Scharley
@mscharley
May 23 2017 05:20
I'm having issues with Ensime reporting unfound implicits for code like the following:
import io.circe.optics.JsonPath.root
private val extractPr = {
  import io.circe.generic.auto._
  root.pull_request.as[PullRequest]
}

could not find implicit value for parameter decode: io.circe.Decoder[github4s.free.domain.PullRequest]

Though, it can be resolved by the compiler correectly

Rafał Krzewski
@rkrzewski
May 23 2017 06:33
@mscharley You could try adding -Ymcaro-expand:normal to compiler arguments. Presentation Compiler used by Ensime and Scala IDE is using -Ymacro-expand:discard by default as a performance optimization, but it does not work well with libraries using Shapeless Generic macro, including Circe.
Matthew Scharley
@mscharley
May 23 2017 06:35
is that just in scalacOptions in my build.sbt or does Ensime have it's own options key?
Matthew Scharley
@mscharley
May 23 2017 07:06
yay, got it working with ensimeScalacOptions.
cheers @rkrzewski
Rafał Krzewski
@rkrzewski
May 23 2017 07:07
:+1:
How about a PR to Ensime FAQ? I did one for Scala IDE ;)
Ghost
@ghost~540393fe163965c9bc2018ce
May 23 2017 07:13
Strangely, I've found discard works better for a lot of macros. I don't think it does what we think it does.
We use it for correctness, not performance. It's voodoo
But I'd love to see if "normal" improves anything over not adding any flags.
Rafał Krzewski
@rkrzewski
May 23 2017 07:50
It fixes "implicit not found errors" with Doobie and Circe from my first hand experience.
Scalac macros are a hack that caught on, nobody is denying that :)
Ghost
@ghost~540393fe163965c9bc2018ce
May 23 2017 08:09
interesting, I might try it out on one of my projects. Please raise a ticket on ensime-sbt so we don't forget.
so does normal do more than not adding it?
because we used to use the default and it was worse
Rafał Krzewski
@rkrzewski
May 23 2017 08:17
I have no idea what it does really. @dragos suggested it might help, and it did. Magic!
Rafał Krzewski
@rkrzewski
May 23 2017 08:35
If I recall correctly normal is the default mode for batch compiler and discard is the default for PC. Explicitly setting discard when using PC is actually a no-op (I'm not 100% sure). Discarding macro generated terms should not make a difference when bytecode generation is skipped but it seems that shapeless.Generic produces something in those terms that affects types down the road.
If you could try it with the project where setting macro-expand:discard made difference, it would be great
Ghost
@ghost~540393fe163965c9bc2018ce
May 23 2017 09:34
I don't think discard is a no-op, it definitely improved things
Rafał Krzewski
@rkrzewski
May 23 2017 10:01
If discard fixes errors in some projects and causes them in others then something needs fixing in the compiler, probably in places nobody wants to touch ;)
Iulian Dragos
@dragos
May 23 2017 20:36
Discard is probably better for hyperlink and type at point, since the expanded tree may have lost positions (as you're at the merci of macro authors, and it's often the case that they position everything at the callers position). However, for white box macros the resulting tree carries new types and without them the whole thing fails. Maybe something in between is needed :)
Ghost
@ghost~540393fe163965c9bc2018ce
May 23 2017 21:02
Sounds sensible