Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Christophe Pache
    @chpache
    Hi there, thanks for the integration of Scala. I saw people running Scala3 methods directly (like def main(args: Array[String]): Unit = ... ) and I can't find a way to build it, event with nightly builds for the scala plugin, do you know if it is possible (I even can't run it if it's not in an abject (like possible now with scala3) ?
    4 replies
    nafg
    @nafg
    What's the current state of Scala 3 support?
    9 replies
    Ben Hutchison
    @benhutchison:matrix.org
    [m]

    I have a question about Intellij/SBT integration.

    By default, SBT allows scala source to be located at src/main/scala or in the root of the project directory. This later option isnt widely known, but it documented at https://www.scala-sbt.org/1.x/docs/Howto-Customizing-Paths.html#Disable+using+the+project%E2%80%99s+base+directory+as+a+source+directory

    As a result, there existing SBT projects where sources are all in the base dir. Ive found that IJ doesnt add the base dir as a Source folder when importing an SBT project, even though SBT by default supports it as a source dir.

    One can add it manually, and then IJ presentation compiler works properly. But it gets wiped out the next time the project imports from SBT, so a poor workaround.

    Is there a way to make IJ/SBT integration respect the sourcesInBase SBT setting?

    2 replies
    Reggie Perry
    @reggieperry
    Hi there. I get the following error doing a build in IntelliJ
    BuildInfo is already defined as case class BuildInfo case object BuildInfo {
    What is the fix for this? Thanks for the help.
    2 replies
    povder
    @povder
    Is anybody else experiencing freezes with the most recent Scala plugin?
    Adam V
    @Adam-Vandervorst
    The Scala plugin doesn't seem to recognize/deal with Scala 3 export statements at all, I assume this is a known issue?
    2 replies
    Adam V
    @Adam-Vandervorst
    image.png
    Some weird syntax errors (Pattern expected) and warnings (Unused expression) emitted on expression matching in macro's
    斯盖丸
    @foreverskyone_twitter
    image.png
    Hi there, when will the intellij Scala plugin support frameless, this snippet works both in Metal or Scastie, but failed with IDEA...it can run normally but reports a compilation error(which is untrue)
    2 replies
    I moved the Foo & Bar case class out of the object main but it failed either...
    斯盖丸
    @foreverskyone_twitter
    image.png
    nafg
    @nafg
    Does Play support still require Ultimate? Because if yes I think at this point it isn't selling licenses, but only hurting Play
    斯盖丸
    @foreverskyone_twitter
    @nafg Yes it is. And I wish they support frameless too...
    斯盖丸
    @foreverskyone_twitter
    Christophe Pache
    @chpache
    Hi there,
    I've just integrated a new scala3 module in a scala2 project (using mill) and I can't figure how to get the scala3 module compile correctly. Do you know if there is documentation on that (mixed scala projects)? Many thanks
    11 replies
    Antoine Levy-Lambert
    @antoinell
    I am a developer working inside a corporation with a firewall and no direct access to public artifact repositories like mavencentral. I raised https://youtrack.jetbrains.com/issue/SCL-19868 to change the Scala plugin to have a way to download scalafmt using our internal infrastructure. If there are other people in a similar situation maybe you can comment on the issue or star it. Also this issue is a trial balloon to raise the broader question of adapting IntelliJ to be used inside organizations with a firewall.
    YulawOne
    @YulawOne
    Hello everyone, is there any way to change BSP on save behaviour to avoid changing cursor focus to build output? It's constantly disturbing development (FYI I'm on Windows 10)
    2 replies
    Justin Kaeser
    @jastice
    @/all Following the Scala community, we're migrating this chat to Discord. Please join here: https://discord.gg/aUKpZzeHCK
    1 reply
    lamazoni
    @lamazoni
    When I open a sbt project straight to a scala worksheet the compiler is lost
    8 replies
    sheeper
    @sheeper:matrix.org
    [m]

    Hello together. Can I change the root directory of the "sbt shell" in IntelliJ?

    I have a project structure like this:

    project
    ├── backend (sbt)
    └── frontend (angular)

    I have the feeling, that if I open the "sbt shell" of IntelliJ Plugin, it will launch in the root directory. Because there is no build.sbt and project directory, it gets created ...

    Would be nice if you can help me here.

    Thanks!

    2 replies
    sheeper
    @sheeper:matrix.org
    [m]
    It does work. I end up with two modules - one of them is a sbt project, the other is an angular one.
    sheeper
    @sheeper:matrix.org
    [m]

    :point_up: Edit: It does work. I end up with two modules - one of them is a sbt project, the other is an angular one.

    But maybe this is the "key" here and you pointed me into the right direction - maybe I should just open two IntelliJ projects separately - one for the angular project and one for the sbt project. In that way, the SBT shell should work as expected.

    Thanks for your reply :-)

    1 reply

    :point_up: Edit: It does work. I end up with two modules - one of them is a sbt project, the other is an angular one.

    But maybe this is the "key" here and you pointed me into the right direction - maybe I should just open two IntelliJ projects separately - one for the angular project and one for the sbt project. In that way, the SBT shell should work as expected.

    The only thing I am not sure about is the VCS integration then - because its a single repo. But I will check this out.

    Thanks for your reply :-)

    lamazoni
    @lamazoni
    The last project of the scala mooc 2 doesn't work - doesn't compile pb with the import and package. idk how to share file here.
    3 replies
    Jason Zaugg
    @retronym

    I've just spottted a concurrent write error logged in the BSP project import. I can't share the logs at the moment as I spotted it on a client's network and I don't have permissions to send data out.

    The racing threads appear to be at:

    https://github.com/JetBrains/intellij-scala/blob/8c8b6c2e3bcf7b1c79e0e0796a3c57fb62c8ac3d/bsp/src/org/jetbrains/bsp/data/BspMetadataService.scala#L42

    https://github.com/JetBrains/intellij-scala/blob/8c8b6c2e3bcf7b1c79e0e0796a3c57fb62c8ac3d/bsp/src/org/jetbrains/bsp/data/BspMetadataService.scala#L58

    The latter calls setLanguageLevel and is guarded by a runWriteAction. The former calls setSdk and is not guarded by a runWriteAction.

    BspMetadataService appears to be analagous to SbtModuleExtService in terms of its write-actions. But that could be buggy as well :)

    Jason Zaugg
    @retronym
    @jastice I've reproduced the BSP import error in a standalone project and submitted a bug report: https://youtrack.jetbrains.com/issue/SCL-20053
    Jason Zaugg
    @retronym
    Allen.Yoon
    @yoonhyeonjoon
    image.png
    Has anyone encountered this problem?
    It occured when I instantiate case class from external dependencies
    image.png
    image.png
    image.png
    the sentence [val test22 = ValNameImpl("hello")] makes error...
    and this is my dependencies for gradle
    image.png
    IceMimosa
    @IceMimosa

    Hello everyone, I am writing a macro extension plug-in based on Scala plug-in.
    How can I make intellij idea prompt with this constructor generated by myself? I used SyntheticMembersInjector and so on, but it didn't meet the expectation.
    By the way, there's nothing wrong with other methods, only the this constructor. I wonder if I missed something important? Is there such an example? (my template is def this(……) =this(...)) Thanks.

    Hello everyone, is there any way to solve this problem? Thank you.

    Jason Zaugg
    @retronym

    I spotted an "Outdated Stub In Index" exception in the Scala Plugin. The call tree included ScalaLineMarker -> SamUtil.SamTypeImplenetation. This called down into our custom extension implementing SyntheticMembersInjector. I just noticed that the injector is poorly implenented, it is matching annotations in a way the triggers stub trees to be forced into full trees; the inefficent getNode.getText rather than findAnnotationNoAliases is what led into the PsiFileImpl.loadTreeElement.

    We are removing the call to getNode.getText here, but I am left wondering whether there is a problem in ScalaLineMarker itself. Does the SAM line marker provider (or one of the utilities that it calls) need to be made DumbService-aware, ie return a default answer during re-indexing?

    nemoo
    @nemoo
    I just updated to IntelliJ 2022.1 with Scala plugin 2022.1.13. And now, all my Scala code is red and nothing can be resolved anymore by Intellij. Anybody having the same problem?
    Oron Port
    @soronpo
    Try invalidating caches and restarting
    nemoo
    @nemoo
    invalidating the caches and restarting unfortunately did not help. Intelij also displays an IDE internal error:
    Cannot process toolwindow sbt
    
    java.lang.AbstractMethodError: Missing implementation of resolved method 'abstract com.intellij.openapi.externalSystem.settings.AbstractExternalSystemSettings getSettings(com.intellij.openapi.project.Project)' of abstract class     com.intellij.openapi.externalSystem.service.task.ui.AbstractExternalSystemToolWindowFactory.
        at com.intellij.openapi.externalSystem.service.task.ui.AbstractExternalSystemToolWindowFactory.shouldBeAvailable(AbstractExternalSystemToolWindowFactory.java:35)
        at com.intellij.toolWindow.ToolWindowSetInitializerKt.beanToTask(ToolWindowSetInitializer.kt:262)
        at com.intellij.toolWindow.ToolWindowSetInitializerKt.beanToTask(ToolWindowSetInitializer.kt:248)
        at com.intellij.toolWindow.ToolWindowSetInitializerKt.access$beanToTask(ToolWindowSetInitializer.kt:1)
        at com.intellij.toolWindow.ToolWindowSetInitializerKt$computeToolWindowBeans$1.accept(ToolWindowSetInitializer.kt:278)
        at com.intellij.toolWindow.ToolWindowSetInitializerKt$computeToolWindowBeans$1.accept(ToolWindowSetInitializer.kt)
        at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processWithPluginDescriptor(ExtensionPointImpl.java:301)
        at com.intellij.toolWindow.ToolWindowSetInitializerKt.computeToolWindowBeans(ToolWindowSetInitializer.kt:274)
        at com.intellij.toolWindow.ToolWindowSetInitializer$1.get(ToolWindowSetInitializer.kt:101)
        at com.intellij.toolWindow.ToolWindowSetInitializer$1.get(ToolWindowSetInitializer.kt:83)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
        at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool.awaitQuiescence(ForkJoinPool.java:2984)
        at com.intellij.idea.StartupUtil.start(StartupUtil.java:270)
        at com.intellij.idea.Main.bootstrap(Main.java:118)
        at com.intellij.idea.Main.main(Main.java:79)
    nemoo
    @nemoo
    Intellij showed the wrong scala plugin verision to be installed, therefore it did not work. opened https://youtrack.jetbrains.com/issue/SCL-20138
    jeremyrsmith
    @jeremyrsmith

    Hi, I have a macro that generates an implicit with a dependent type member. Like this:

    trait RelativeComplement[A, B] {
      type Out
    }
    
    object RelativeComplement {
      type Aux[A, B, Out0] = RelativeComplement[A, B] { type Out = Out0 }
      implicit def materialize[A, B, Out]: Aux[A, B, Out] = macro RelativeComplementMacro.materialize[A, B, Out]
    }

    (this is Scala 2)
    I'd like to make it so IntelliJ knows what Out will be, given A and B, instead of inferring Nothing or something like that. I saw the 2015 blog post about SyntheticMembersInjector, but that doesn't seem to apply to this case (since it only lets you inject members into a trait or class or object definition, as far as I can tell). Is there any way to accomplish what I'm going for? Maybe a different extension point? Or is there just hard-coded support for some core Shapeless macro DepFns and no way to add others?

    Oron Port
    @soronpo
    If you use sbt bsp flow, the presentation compiler infers it and reports to IJ. I'm using Scala 3 with a lot of dependent typing and switching back and forth between Metals and IJ, and both work. It should be the same for Scala 2.
    @jeremyrsmith
    jeremyrsmith
    @jeremyrsmith
    @soronpo thanks for the reply, and I believe that it would work with Metals as a backend. But, it's not for myself that I'm asking – what I want is for people at my company (who 99% use IntelliJ pro edition) to be able to get sane type inference for this typeclass. Which I use as little as possible, because IntelliJ can't infer it – but sometimes it's necessary. And telling everyone to switch to SBT+Bloop is probably not viable here.
    If any API existed to guide inference here, it would be very easy to implement this thing. E.g. RelativeComplement[A with B with C with D, B with D]#Out will be A with C. The macro is just a few lines of code. And it's usually not even necessary – just, when it is necessary, it's necessary. The compiler does fine with it, just IntelliJ always says Nothing.
    Tobias Roeser
    @tobiasroeser:matrix.org
    [m]

    Hi, I've a question regarding the transitive dependency behavior of module dependencies. I'm referring to the "Export" option described in this section of the documentation. https://www.jetbrains.com/help/idea/2022.1/working-with-module-dependencies.html#dependency-scope

    I read it that way that dependencies, which do not have the export option enabled are not propagated to dependent modules. But it looks like that this is not the case. When running the dependent module, all library dependencies of the module dependencies are also present in the downstream classpath. But my expactation was, that only those libraries are propagated downstream, which have the export option enabled, in my case none.