Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Daniel Hinojosa
    @dhinojosa
    moglideveloper
    @moglideveloper
    it worked :)
    Thanks you so much @dhinojosa for all the help and time
    really appreciate
    Daniel Hinojosa
    @dhinojosa
    Yes, excellent!
    moglideveloper
    @moglideveloper
    I was missing scalaVersion := "2.13.5"
    Daniel Hinojosa
    @dhinojosa
    AHHHH
    Yes
    moglideveloper
    @moglideveloper
    intention was not to ship scala library accidentally in our final build package. That's why we were trying to enable scala in our test scope only
    what I understood so far that combination of
    //this will enable scala in complete project
    scalaVersion := "2.13.5"
    //this will disable scala
    autoScalaLibrary := false
    //and this will enable scala again in test scope
    libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value % "test"
    Daniel Hinojosa
    @dhinojosa
    If you get creative you can create custom tasks that would ensure there is no src/main/scala or src/test/java before you compile
    moglideveloper
    @moglideveloper
    my understanding was, even if scalaVersion is not defined, will be picked based on the sbt.version that is defined in build.properties
    Daniel Hinojosa
    @dhinojosa
    I think maybe IntelliJ requires name, version, scalaVersion at the very least
    moglideveloper
    @moglideveloper
    your solution really helped. but again, this is not clear why directly enabling scala library in test is not sufficient, when scala version is by default pulled from sbt version defined in build.properties
    //this will enable scala in complete project
    scalaVersion := "2.13.5"
    //this will disable scala
    autoScalaLibrary := false
    //and this will enable scala again in test scope
    libraryDependencies += "org.scala-lang" % "scala-library" % scalaVersion.value % "test"
    Daniel Hinojosa
    @dhinojosa
    Probably just how the IntelliJ Scala Plugin recognizes a Scala Project.
    Adding scala-libarary to the test scope only I would assume is very rare
    moglideveloper
    @moglideveloper
    ok. Thanks again @dhinojosa
    Ishan Shah
    @nullptr7
    Intellij attempts to download the scalafmt jars from the public internet and the firewall in our org doesn't allow that. We do have scalafmt within our internal maven repository though. Is there any way we can point the Scala plugin to use a local scalafmt jar, or tell it what maven repo to download it from? Thanks
    Eric Peters
    @er1c
    Is there a way to pass in a sbt arg like "testPreRelease" configuration into the ScalaTest intellij run config?
    image.png
    2 replies
    Eric Peters
    @er1c
    I also noticed that when running through sbt it runs each test suite one at a time, which also triggers code formatting checks we have and does recompiling each time (which seems odd) - e.g. [IJ]{file:/Users/eric/dd/bigdata-master/web_api/}web_api/ testOnly feature_factory_interfaces.output.SmallFeatureDescriptorSetSerializerTest how can I use the ScalaTest and just have it run the single testPreRelease
    4 replies
    bbhoss
    @bbhoss
    I'm just trying to open a project with the Scala plugin that uses sbt. No matter what I try I can't seem to get it to recognize that it's an actual sbt project. I "Opened as Project" to no avail. The scala plugin is installed and it's able to highlight code, but the sbt window doesn't appear. Any ideas?
    bbhoss
    @bbhoss
    blowing away .idea seems to fix :frowning:
    Dario Abdulrehman
    @dabd
    does anyone know how to add support for scalafix-organize-imports in IntelliJ?
    Dermot Haughey
    @hderms
    Is there any plan to make Intellij work with SBT under wsl2? I know they got it working with maven and gradle
    2 replies
    wangzaixiang
    @wangzaixiang
    the plugin can't support debug breakpoints on top-level method.
    2 replies
    Loup
    @loup-fox
    I have issues with the auto import feature since I started working with Scala3 both on Metal with VSCode and with Intellij. Does someone know why?
    Brian P. Holt
    @bpholt
    Is it possible to debug ScalaJS code running in NodeJS inside IntelliJ? I’m not sure how one would set up the run configuration for that.
    Nicholas Molenaar
    @nmolenaar_gitlab
    @loup-fox same, eventually deleting the .bloop / .bsp / .idea folder and make sure to be on the stable branch of the scala plugin made it work again (changed also back to SBT project instead of BSP)
    moglideveloper
    @moglideveloper

    There is a sample intellij plugin that depends on org.intellij.scala plugin also.
    Now, this sample intellij plugin has a functionality to fetch json over http and then parse it.

    For parsing json in scala, there are multiple libraries, and we decided to use spray json library.


    Reason for choosing spray json :-

    spray json library is present in library dependency graph of org.intellij.scala, and sample intellij plugin directly depends on org.intellij.scala plugin.

    So to keep sample intellij plugin library size minimum, we thought of using json parser library that is used by org.intellij.scala plugin.

    But, we are getting PluginClassLoader exception :-

    java.lang.LinkageError: loader constraint violation: when resolving method 'spray.json.RootJsonFormat spray.json.DefaultJsonProtocol$.jsonFormat1(scala.Function1, spray.json.JsonFormat, scala.reflect.ClassTag)' the class loader com.intellij.ide.plugins.cl.PluginClassLoader @2a4b0539 of the current class, com/sample/plugin/FetchDomainObjectsFromWire, and the class loader com.intellij.ide.plugins.cl.PluginClassLoader @573b8e9c for the method's defining class, spray/json/DefaultJsonProtocol$, have different Class objects for the type scala/Function1 used in the signature (com.sample.plugin.FetchDomainObjectsFromWire is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @2a4b0539, parent loader 'bootstrap'; spray.json.DefaultJsonProtocol$ is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @573b8e9c, parent loader 'bootstrap')

    Our understanding so far for this exception :-

    As org.intellij.scala and sample intellij are loaded in different classloaders, so sample intellij plugin can't use any class loaded by PluginClassLoader of org.intellij.scala.
    To use spray json classes in sample intellij plugin, spray json should be explicitly added to libraryDependencies in sample intellij plugin.

    Adding spray json to libraryDependencies in sample intellij plugin will solve the class-loader issue,

    but increase the packaged plugin binary size, as spray json library is also packaged in sample intellij plugin.

    plugin.xml

        <id>com.logicovercode</id>
        <name>IjPlugin</name>
        <vendor email="moglideveloper@gmail.com" url="https://github.com/JetBrains/sbt-idea-plugin/discussions/107">Linkage Error</vendor>
        <version>2021.1.18</version>
        <depends>org.intellij.scala</depends>
        <idea-version since-build="211.5538" until-build="211.*"/>

    build.sbt :

    scalaVersion := "2.13.2"
    
    intellijPlugins += "org.intellij.scala:2021.1.18".toPlugin
    intellijDownloadSources := true
    ThisBuild / bundleScalaLibrary  := false

    plugins.sbt

    addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "3.12.2")


    Final Note: if spray-json is not present in SamplePlugin/target/plugin/logicIj/lib, then plugin is giving LinkageError, when run from intellij-run configuration or by loading sample plugin izip in fresh intellij instance.

    Kindly confirm, if our understanding is correct and please suggest recommended approach/ best practices for this scenario.

    For reference purpose, this question can also be found here :
    https://github.com/JetBrains/sbt-idea-plugin/discussions/107

    Thanks.

    1 reply
    Oron Port
    @soronpo
    If you want to find Scala 3 issues, just try using the Scala 3 compiler with IntelliJ. Sadly it's currently completely broken.
    It looks like IJ thinks this project is a Scala 2 project.
    Kai
    @neko-kai
    @soronpo I found that when using bsp import Intellij classifies the project correctly and it's usable
    Naftoli Gugenheim
    @nafg
    Hi, what's the current state of these setups?
    • Scala 3 support -- when is that expected to be fully usable?
    • Mill projects
    • Import via BSP
    Swoorup Joshi
    @Swoorup
    image.png
    Union types not working, this is a dealbreaker for me
    Arsene
    @Tochemey
    Hey good people. Can we use scala 3 smoothly with IntelliJ or we will have to wait for a while.
    11 replies
    Aaron Radzinski
    @aradzinski
    Would really be nice to get some attention to https://youtrack.jetbrains.com/issue/SCL-19068 - without it Scala3 is unusable for maven-based projects
    Michael Pilquist
    @mpilquist
    Anyone having any luck using Intellij with Scala 3 final? Go-to-definition is broken for external libraries and when I expand individual external libraries in the project pane, they don't have any classes in them.
    2 replies
    Jim Newton
    @jimka2001
    when thee test case source code is displayed in IntelliJ there is a little green run-triangle beside the test. I can press the mouse button. on that little triangle to launch the particular test. Doing so launches a particular java executable. /Applications/IntelliJ IDEA CE.app/Contents/jbr/Contents/Home/bin/java, in my case. What controls which java executable path is used here? It is different on my 2 laptops, and I cannot figure out why.
    13 replies
    Screenshot 2021-05-27 at 14.34.59.png
    Screenshot 2021-05-27 at 14.21.29.png
    1 reply
    I've tried changing the JDK selection in the Preferences, but that seems to have no effect.
    Jim Newton
    @jimka2001
    Screenshot 2021-05-27 at 19.46.33.png
    aerua
    @aerua:matrix.org
    [m]

    Hi, I’m trying out Scala 3 and it when I import a project, I don’t get any autocompletion for new keywords (though highlighting works) and indentation also doesn’t seem to work if I got bracketless.

    I understood that Scala 3 was already supported in the latest version of the IntelliJ scala plugin. But what is the extent of that support? I tried looking up online if there is a list of known current issues but I didn’t find anything so far. Are the issues mentioned above expected?

    James Yoo
    @jyoo980
    An answer to @aerua:matrix.org 's question might be useful, I'm sitting on some weird behaviour that I might report as a bug if it's not already documented as such
    Nikolay Tropin
    @niktrop
    @aerua:matrix.org , @jyoo980 What version of Scala plugin do you use? You may use IDEA 2021.2 EAP to try latest updates, they are not yet backported to the stable versions. We are trying to make optional braces as convenient as possible. If problems are still there please report a new issue
    https://youtrack.jetbrains.com/newIssue?project=SCL
    3 replies
    Igal Tabachnik
    @hmemcpy
    image.png
    3 replies