Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Andriy Plokhotnyuk
    @plokhotnyuk
    :+1:
    Alex
    @unthingable
    Has anyone run into a case where Intellij insists on building an sbt subproject as scala3 even though the subproject itself is explicitly set to scalaVersion := "2.13.6", and know of a fix? Sbt itself is not confused.
    Andriy Plokhotnyuk
    @plokhotnyuk
    @unthingable Have you tried if the latest IntelliJ IDEA -> BSP -> sbt 1.6.0-M1 works for you?
    6 replies
    Igal Tabachnik
    @hmemcpy

    I gave my plugin a shot at building with the newly released 2021.3 EAP (and scala-plugin 2021.3.4) - I'm getting this error on my CI now:

    my_test failed: com.intellij.testFramework.TestLogger$TestLoggerAssertionError: jarFiles is not set for PluginDescriptor(name=IDE Features Trainer, id=training, descriptorPath=plugin.xml, path=~/.zio-intellijPluginIC/sdk/213/plugins/featuresTrainer/lib/featuresTrainer.jar, version=213.3714.440, package=training, isBundled=true), took 0.001 sec

    Anyone know what this might be?

    11 replies
    My test fixtures is mostly a copy-paste from the scala-plugin's ScalaInspectionTestBase and the related rabbit hole of files
    1 reply
    Oron Port
    @soronpo

    For several version now (not sure how it started) I'm unable to compile with IJ, just with SBT. I get this error:

    java.lang.NoSuchMethodError: 'java.lang.String dotty.tools.xsbt.DelegatingReporter.messageAndPos(dotty.tools.dotc.reporting.Message, dotty.tools.dotc.util.SourcePosition, java.lang.String, dotty.tools.dotc.core.Contexts$Context)'
        at dotty.tools.xsbt.DelegatingReporter.doReport(DelegatingReporter.java:37)
        at dotty.tools.dotc.reporting.Reporter.go$3$$anonfun$2(Reporter.scala:162)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.Option.foreach(Option.scala:437)
        at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:174)
        at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:193)
        at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:196)
        at dotty.tools.dotc.report$.issueWarning(report.scala:24)
        at dotty.tools.dotc.report$.warning(report.scala:59)
        at dotty.tools.dotc.config.CliCommand.checkUsage$$anonfun$1(CliCommand.scala:168)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at dotty.tools.dotc.config.CliCommand.checkUsage(CliCommand.scala:168)
        at dotty.tools.dotc.config.CliCommand.checkUsage$(CliCommand.scala:13)
        at dotty.tools.dotc.config.CompilerCommand.checkUsage(CompilerCommand.scala:12)
        at dotty.tools.dotc.Driver.setup(Driver.scala:87)
        at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:63)
        at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
        at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:57)
        at org.jetbrains.jps.incremental.scala.local.LocalServer.doCompile(LocalServer.scala:52)
        at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:30)
        at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:207)
        at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:190)
        at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:180)
        at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:187)
        at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:163)
        at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:103)
        at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)

    Is this something known?

    scalac: Cannot connect to compile server at localhost/127.0.0.1:3,200 (Connection refused: connect)
    Oron Port
    @soronpo
    It seems to be related to the Scala version from 3.1.x onward
    Andriy Plokhotnyuk
    @plokhotnyuk
    Please add support of CrossType.Full by the presentation compiler. Currently all types that are defined in platform directories (not shared) are not recognized when used.
    image.png
    image.png
    Alex
    @unthingable
    Unrelated to Scala but I'm failing at googling: IDEA indicates lines changed since last git commit in the gutter, is there a way to also indicate lines that changed in the last commit from previous?
    Nikolay Tropin
    @niktrop
    Not on exactly on the gutter, but if you turn on git annotations, lines changed in the last commit are highlighted:
    1 reply
    image.png
    Guido Contreras Woda
    @guiwoda
    Hi everyone! We're starting to use Lagom in our company and I can't seem to configure how to let SBT know that our project uses java 11. Every time I run sbt sync from IDEA, the project settings roll back to java 8.
    We currently have configured the build as so: Compile / javacOptions ++= Seq("-source", "11", "-target", "11")
    Guido Contreras Woda
    @guiwoda
    Nevermind... figured it out:
    [info] my-project / Compile / javacOptions
    [info]     List(-g, -encoding, UTF-8, -source, 1.8, -target, 1.8, -parameters, -Xlint:unchecked, -Xlint:deprecation, -source, 11, -target, 11, -Xlint:unchecked, -Xlint:deprecation)
    2 replies
    Ben Plommer
    @bplommer
    Hi - is it possible to set IntilliJ to use sbt shell for reloads/builds by default?
    1 reply
    Yann Moisan
    @YannMoisan

    hello. I have a message "Cannot perform operation, Too Complex, sorry" when I'm trying to modify build.sbt. Any idea ?

    IntelliJ IDEA 2021.2.2 (Community Edition)
    Build #IC-212.5284.40, built on September 14, 2021
    Runtime version: 11.0.12+7-b1504.28 x86_64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
    macOS 10.15.7
    GC: G1 Young Generation, G1 Old Generation
    Memory: 2048M
    Cores: 16
    Registry: scala.erase.compiler.process.jdk.once=false
    Non-Bundled Plugins: PythonCore (212.5284.44), org.intellij.scala (2021.2.22)
    Kotlin: 212-1.5.10-release-IJ5284.40

    2 replies
    Vladimir Morozov
    @greenhost87

    Hi All, I have big problem with Scala 3 plugin, my project very often use constructions like:

    object Reproduce {
      case class User(id: UUID)
    
      sealed trait TestBase
      case class Test01(data: String, id: Int) extends TestBase
    
      def render: PartialFunction[(TestBase, User), String] = { case (base: Test01, user) =>
      }
    }

    My expectations variable base have type Test01 and code completion + code navigation + refactoring + etc. works, but latest Scala plugin, sadly yet, think that base have type Any in result code editing is very painful, refactoring not work and many other problem.
    IDE: Idea Ultimate 2021.2.3 RC, Scala plugin 2021.2.449

    2 replies
    Ben Plommer
    @bplommer
    Hi, I'm getting this error [error] (ThisBuild / updateIntellij) java.io.FileNotFoundException: https://d2s4y8xcwt8bet.cloudfront.net/com/jetbrains/intellij/idea/ideaIC/203.7148.15-EAP-SNAPSHOT/ideaIC-203.7148.15-EAP-SNAPSHOT.zip when trying to load the sbt-idea-example (https://github.com/JetBrains/sbt-idea-example) project - any ideas?
    1 reply
    Igal Tabachnik
    @hmemcpy
    Something is missing in the New (experimental) project wizard ;)
    5 replies
    image.png
    Joseph Hajduk
    @josephhajduk
    are type hints working for scala3 or should everything just show as Any?
    1 reply
    Screen Shot 2021-10-09 at 5.24.20 PM.png
    Allen.Yoon
    @ironmaskara
    is there any one who know the difference between "this.type" and "this"?
    as far as i understood.. it's no difference when it use for return like this..

    abstract class Abstract0 {
    def setOption(j: Int): Any
    }

    class Concrete0 extends Abstract0 {
    var i: Int = 0
    def setOption(j: Int): this.type = {i = j; this}
    }

    class Concrete1 extends Abstract0 {
    var i: Int = 0
    def setOption(j: Int):Unit = {i = j;}
    }

    class Concrete2 extends Abstract0 {
    var i: Int = 0
    def setOption(j: Int) = {i = j; this}
    }

    object testfor2 extends App{

    val xx = (new Concrete0).setOption(1)
    val xxx = (new Concrete0).setOption(1).setOption(1)
    val xxxx = (new Concrete1).setOption(1)
    val xxxxx = (new Concrete2).setOption(1)

    }

    Tobias Roeser
    @lefou
    this.type is the type whereas this is the instance.
    In case of inheritance, this.type is the type of the implementing class, not the trait / abstract class.
    Allen.Yoon
    @ironmaskara
    hmm.. I can't catch a meaning of type and instance to this case.
    if I get returns [using "this.type" and set this value in "val x"] and [using "this" and set this value in "val xx"], then.. I guess these are no difference.

    aha... wait..
    I think... you said... if we use "this.type" for return value in abstract class.. and concrete class extends this one.. and return "this" and.. abstract class's return type this.type will point out to implementing class not the trait/abstract class

    am i right?

    image.png
    Tobias Roeser
    @lefou
    correct
    Allen.Yoon
    @ironmaskara
    thanks bro.
    Tobias Roeser
    @lefou
    next time, please format your code snippets to ease reading
    Allen.Yoon
    @ironmaskara
    Oh I see.
    Leszek GruchaƂa
    @leszekgruchala
    Screen Shot 2021-10-13 at 20.51.45.png
    4 replies
    Hey, I am using Scala nigthly 2021.2.449 and scalafmt 3.0.6. It seems to me (but I am no 100% sure) that since this nightly plugin build IDEA forces import optimize on save, even though it is disabled. Is it related to optimise import on the fly?
    How to disable optimizing imports on save?
    Tobias Roeser
    @lefou
    Where should I start to debug failing BSP imports? I currently working on the mill BSP support. My local imports reasonable well with Metals/vscode. But i IJ 2021.2.3 I only see the error message: import failed
    27 replies
    Tobias Roeser
    @lefou
    Looks like it isn't even starting the server
    Guido Contreras Woda
    @guiwoda
    Hey, I'm using sbt in a Lagom multi-project monorepo (java) and I can't seem to make Intellij understand that I want to compile with JDK 11. I've tried to add / override javacOptions on each independent project with both -source, 11, -target, 11 or -release, 11 and every time I sync back with sbt, the plugin changes both the build in preferences > build... > compiler to 1.8 and the project structure > modules > JDK to 8.
    Any ideas?
    5 replies
    Kelly MacNeill
    @Pyromuffin
    Hello, quick question: does the scala 3 plugin support method return type inference? I remember seeing it on scala 2 projects, but it seems to have gone away.
    2 replies
    Igal Tabachnik
    @hmemcpy
    Good morning. I have a bunch of highlighting tests (using the $START and $END markers) using a common snippet of code. In one of the tests I'm passing a string literal to a function. In my inspection, I'm extracting this argument and checking it with org.jetbrains.plugins.scala.codeInspection.collections#isString (which checks that the resolved type is java.lang.String). However, in the tests, the expression type is resolved as just String, so the assertion fails. Is there a way to "teach" the fixture that the text contains types from the scala.Predef? Or otherwise solve the problem? :)
    10 replies
    Igal Tabachnik
    @hmemcpy
    @SrTobi FYI, Scala 2.13.7 was just released, fixing import x.{*} with -Xsource:3 https://github.com/scala/scala/releases/tag/v2.13.7
    5 replies
    Igal Tabachnik
    @hmemcpy
    General question: in a project cross built for scala2 and scala3 - is there a way to "switch" the currently loaded project to the Scala 3 view? Or, is there a way to load it as Scala 3 instead?
    20 replies
    Igal Tabachnik
    @hmemcpy
    image.png
    Hey sbt experts. I was trying to import the ZIO codebase as bsp and it threw me into an endless loop. I was trying to investigate why, so I loaded it as sbt normally, but then I got a popup, saying that one module had both output paths (regular and test) pointing to the same dir. Just one module - benchmarks. I have no idea why this is happening, but I suspect this is what causing the bsp issue.
    Do you have an idea why intellij thinks both output directories point to the same place? All other modules are fine (i.e. classes and test-classes)
    Here's the definition for benchmarks in the sbt. I don't see anything weird with it... https://github.com/zio/zio/blob/master/build.sbt#L495
    Dmitrii Naumenko
    @unkarjedy

    Looks like JmhPlugin causing the issue.
    More specifically, this part breaks it:
    https://github.com/sbt/sbt-jmh/blob/main/plugin/src/main/scala/pl/project13/scala/sbt/JmhPlugin.scala#L58

    val Jmh = config("jmh") extend Test
    ...
    classDirectory := (classDirectory in Compile).value

    Closes YT ticket I found: https://youtrack.jetbrains.com/issue/SCL-13127
    If it's not critical, try commenting out .enablePlugins(JmhPlugin) or the entire benchmark module

    Igal Tabachnik
    @hmemcpy
    Cool, thank you!