by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Oron Port
    @soronpo
    But it looks like it's better to have a new issue
    Pavel Fatin
    @pavelfatin
    Just a quick reminder: you can follow https://twitter.com/IntelliJScala to get news and updates from the IntelliJScala team :)
    Philip
    @philipschwarz
    a bit off topic, but maybe someone can help
    I am writing some unison code - if I add the .u extension to the Haskell file type the result is quite good
    image.png
    image.png
    image.png
    image.png
    is there a way of stopping simbols like :arrow_right: && ++ () from being shown as if 'selected' (appearing in a box of a different, lighter colour) ?
    Nikolay Tropin
    @niktrop
    @philipschwarz It's probably better to ask author of Haskell plugin you are using.
    Philip
    @philipschwarz
    @niktrop doh, of course, thanks
    Jason Zaugg
    @retronym

    @niktrop I'm currently reimplementing scala-async as a phase of the compiler: scala/scala#8816 . A few details of name mangling are changing and I'm investigating how to adapt intellij-scala to these.

    The refactoring effort is in part to support a user of scala-async that integrates it via a compiler plugin that demarcates async blocks with annotations. The effect is quite similar to Kotlin's suspend functions. So I'd also like to find a way to make support for async in "evaluate expression" work in their environment, too. My idea is to detect replace (or augment) the current InsideAsync static analysis with a dynamic analysis of the enclosing classes in the VM at the breakpoint. If one of these has the 'fingerprint" of an async state machine, we can trigger the strategy of evaluating local variables and methods as selections of fields and methods from the state machine class.

    Does this sound like a reasonable approach? How does Kotlin's compiler/debugger handle things?

    While looking at this, I noticed at least one bug and an inefficient implemetation in some code contributed (as part of JetBrains/intellij-scala#386) to the the debugger. I'm tring to rework this in: https://github.com/retronym/intellij-scala/pull/1/commits/ea56504671599f5f837c21a05f592a154b141d4f

    For both of these changes I'd like to add a test case. I have a manual test in https://github.com/retronym/boxer/blob/topic/xasync/README.md. But rather than trying to introduce another third-party dependency to your build, I was thinking it would be simpler to have a debugger test that has one set of sources that will be loaded in the project when debugging, and a "shadow" set of sources that will be used to create the classfiles. The "shadow" sources can include the expansions that a compiler plugin would have made. If you think this approach makes sense,

    ... could you give a few pointers on how to refactor ScalaDebuggerTestBase to support that?
    If you have any general suggestions about ways that we could compile async state machines with better metadata to support debugging, please let me know.
    OlegYch
    @OlegYch
    is there a way to see what a type alias is actually referring to?
    OlegYch
    @OlegYch
    like alt-enter but on type
    Jason Zaugg
    @retronym

    could you give a few pointers on how to refactor ScalaDebuggerTestBase to support that?

    Here's the approach I'm working on: https://github.com/retronym/intellij-scala/pull/1/files#diff-463548c55f483c8570ee76caeb927a0eR19-R60

    The idea is to initially register the expanded source code (including synthetic wrappers), let the setUp() method compile it, and then temporarily edit the file within the test itself to remove the wrappers from the source code. Execution should use the classifies that include the synthetic wrappers.

    I'm having some problems running the tests today (after rebasing) so I'm not sure if my test implementation is correct. I'm re-running ;createIDEAArtifactXml ;idea-runner/createIDEARunConfiguration to see if that helps.

    Dmitrii Naumenko
    @unkarjedy

    @poslegm @olafurpg
    Sorry for the late reply! I saw your message last week but didn't have time to respond due to pre-release activities.

    scalatest, specs2, utest. What are the selection criteria for this list

    They were and still remain 3 most popular testing libraries at the moment their support was added.

    Regarding MUnit support:
    I will take a look at the state of MUnit later today and will reply what can be done in the ticket you've created: https://youtrack.jetbrains.com/issue/SCL-17360

    Nikolay Tropin
    @niktrop

    @retronym scala-async refactoring sounds very cool!

    My idea is to detect replace (or augment) the current InsideAsync static analysis with a dynamic analysis

    I think it may work even better than the current approach. Probably, the simplest option is to have a reserved word in a class name, so inner classes will contain it automatically.
    I know little about how debugger for kotlin coroutines works. AFAIK they are reworking it right now.

    Nikolay Tropin
    @niktrop

    The idea is to initially register the expanded source code (including synthetic wrappers), let the setUp() method compile it, and then temporarily edit the file within the test itself to remove the wrappers from the source code. Execution should use the classifies that include the synthetic wrappers.

    I'm not sure this approach is feasible because line numbers and other debug information for shadow sources will be completely different. I think it would be better to test the real thing, i.e. to compile a source code with a correct set of compiler options and compiler plugins.

    Nikolay Tropin
    @niktrop
    You'll probably need to provide custom ScalaSdkLoader in libraryLoaders method to use scala compiler with your changes. To change compiler options use
    ScalaCompilerConfiguration.instanceIn(getProject).defaultProfile (see, for example MetaAnnotationTestBase.enableParadisePlugin)
    Jason Zaugg
    @retronym

    I don't think the line numbers need to change. In:

    abstract class GetAllClassesForceTestBase extends PositionManagerTestBase {
      private val synthetic = "//<SYNTHETIC>"
    
      setupFile("Simple.scala",
        s"""
          |object Simple {
          |  def main(args: Array[String]) {
          |    class syntheticClass1 { class syntheticClass2 { $synthetic
          |    $offsetMarker"" $bp
          |    }}                                              $synthetic
          |  }
          |}
        """.stripMargin.trim)
      private def removingSyntheticLineContents(fileName: String)(f: => Unit): Unit ={
        val virtualFile = getVirtualFile(getFileInSrc(fileName))
        val charset = StandardCharsets.UTF_8
        val origiContent = virtualFile.contentsToByteArray()
        val content = new String(origiContent, charset)
        val edited = content.linesIterator.map(line => if (line.contains(synthetic)) "" else line).mkString(System.lineSeparator)
        virtualFile.setBinaryContent(edited.getBytes(charset))
        try f finally {
          virtualFile.setBinaryContent(origiContent)
        }
      }

    The idea is to just replace the wrapper lines with blank lines.

    The debugger session would have class files that include the wrappers but have source files without them.
    Nikolay Tropin
    @niktrop
    Hm, it may work. But still, it looks error prone and hard to maintain. If something changes in implementation, we'll need to rewrite the whole test case instead of updating versions of compiler and plugin.
    Jason Zaugg
    @retronym
    Yeah, that's a fair point. I'm hoping that details won't change again after this refactoring :)
    What am I doing wrong here?
    > runDebuggerTests
    [warn] Plugin [com.intellij.properties] is already included by: [org.intellij.groovy] in project 'android'
    [warn] Plugin [com.intellij.properties] is already included by: [org.intellij.groovy] in project 'gradle'
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-provided/test:testOnly
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-compile/test:testOnly
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-reader/test:testOnly
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-runtime/test:testOnly
    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/Users/jz/.ScalaPluginIU/sdk/201.6668.60/lib/util.jar) to field java.io.DeleteOnExitHook.files
    WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    log4j:WARN No appenders could be found for logger (#com.intellij.testFramework.UsefulTestCase).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/Users/jz/.ScalaPluginIU/sdk/201.6668.60/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/Users/jz/.ScalaPluginIU/sdk/201.6668.60/plugins/maven/lib/maven36-server-impl.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
    ERROR: Cannot add 'scala-library.jar' from 'Scala VERSION' to compiler classpath
    java.lang.Throwable: Cannot add 'scala-library.jar' from 'Scala VERSION' to compiler classpath
        at com.intellij.openapi.diagnostic.Logger.error(Logger.java:146)
        at com.intellij.compiler.server.impl.BuildProcessClasspathManager.computeCompileServerPluginsClasspath(BuildProcessClasspathManager.java:127)
        at com.intellij.compiler.server.impl.BuildProcessClasspathManager.getStaticClasspath(BuildProcessClasspathManager.java:54)
        at com.intellij.compiler.server.impl.BuildProcessClasspathManager.getBuildProcessPluginsClasspath(BuildProcessClasspathManager.java:38)
        at com.intellij.compiler.server.BuildManager.launchBuildProcess(BuildManager.java:1240)
    That's from running sbt in a normal terminal with a fresh checkout of origin/idea201.x
    Jason Zaugg
    @retronym
    Or from the SBT Shell:
    IJ]> runDebuggerTests
    [warn] Plugin [com.intellij.properties] is already included by: [org.intellij.groovy] in project 'android'
    [warn] Plugin [com.intellij.properties] is already included by: [org.intellij.groovy] in project 'gradle'
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-provided/test:testOnly
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-compile/test:testOnly
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-runtime/test:testOnly
    [info] Passed: Total 0, Failed 0, Errors 0, Passed 0
    [info] No tests to run for tasty-reader/test:testOnly
    OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/Users/jz/.ScalaPluginIU/sdk/201.6668.60/lib/util.jar) to field java.io.DeleteOnExitHook.files
    WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    log4j:WARN No appenders could be found for logger (#com.intellij.testFramework.UsefulTestCase).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/Users/jz/.ScalaPluginIU/sdk/201.6668.60/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/Users/jz/.ScalaPluginIU/sdk/201.6668.60/plugins/maven/lib/maven36-server-impl.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
    ERROR: Expected com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@572bd86 instead of com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@5cdbd34d closed=false
    java.lang.IllegalStateException: Expected com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@572bd86 instead of com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@5cdbd34d closed=false
        at com.intellij.debugger.impl.InvokeThread.lambda$run$0(InvokeThread.java:134)
        at com.intellij.openapi.project.DumbService.runWithAlternativeResolveEnabled(DumbService.java:376)
        at com.intellij.debugger.impl.InvokeThread.run(InvokeThread.java:125)
    Or from IntellIJ Junit runner:
    image.png
    Jason Zaugg
    @retronym
    I'd just like one of them to work :)
    Another failure mode I'm seeing:
    [IJ]> runDebuggerTests
    ...
    java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key SBT.system.in.process
        at java.base/java.util.ResourceBundle.getObject(ResourceBundle.java:564)
        at java.base/java.util.ResourceBundle.getString(ResourceBundle.java:521)
        at com.intellij.openapi.util.registry.Registry.getBundleValue(Registry.java:118)
    Nikolay Tropin
    @niktrop
    For running from sbt you need to run packagePlugin before running tests.
    For Intellij runner it looks like some JDK misconfiguration. We now use JDK 11 to compile and run.
    Jason Zaugg
    @retronym

    I notice that you're on an old-ish version of Scala 2.12:

        /** Version used to build this project. Prefer latest_2_12 unless it causes problems. */
        val project = "2.12.7"

    Were there any problems with newer versions? 2.12.11 is about 10-15% faster for compilation : https://scala-ci.typesafe.com/grafana/dashboard/db/scala-benchmark?orgId=1&var-branch=2.12.x&var-source=All&var-bench=HotScalacBenchmark.compile&var-host=scalabench@scalabench@

    Jason Zaugg
    @retronym

    Debugger tests are running now in IntellIJ after updating the IDEA SDK to use openjdk@1.11.0-2 instead of openjdk@1.11.0.

    SBT console still gives me:

    git -P log -1 && git clean -fdx && java -version && sbt 'packagePlugin' 'runDebuggerTests'
    commit 468fc60a3f67f2db22c94c4ad1fcb4b94f6617a5 (HEAD -> topic/clean-slate, retronym/idea201.x, origin/idea201.x, idea201.x)
    Author: Justin Kaeser <justin.kaeser@jetbrains.com>
    Date:   Tue Apr 7 23:01:48 2020 +0200
    
        Revert "Not use blocking call in the attachSbtProjectAndRefresh #SCL-17353"
    ...
    ERROR: Expected com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@b4d63d3 instead of com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@4c69734d closed=false
    java.lang.IllegalStateException: Expected com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@b4d63d3 instead of com.intellij.debugger.impl.InvokeThread$WorkerThreadRequest@4c69734d closed=false
        at com.intellij.debugger.impl.InvokeThread.lambda$run$0(InvokeThread.java:134)
        at com.intellij.openapi.project.DumbService.runWithAlternativeResolveEnabled(DumbService.java:376)
        at com.intellij.debugger.impl.InvokeThread.run(InvokeThread.java:125)

    https://gist.github.com/fb22c2cb56dc6fa5ed29e956dc3800e1

    Anyway, I'm unblocked for now. Thanks for your help.
    Arnaud Esteve
    @aesteve
    Hi everyone, I seem to have troubles with syntactic coloration with the following combination:
    • Scala 3 + significant indent
    • using EAP + nightly Scala plugin
    • Gradianto Deep Ocean theme
    • fresh new project
    1. Is this a known issue, already reported. And I'll follow it, no problem.
    2. Should I report it? Any pointer?
    Nikolay Tropin
    @niktrop
    @aesteve Significant indentation support is a WIP now, so there may be some glitches in highlighting. You may report a problem so we could check your particular case is working.
    Arnaud Esteve
    @aesteve
    ok, will do that. Thanks
    Nikolay Tropin
    @niktrop
    @OlegYch I'm not sure what you mean by Alt + Enter on type. Ctrl + Mouse hover shows a popup with this info. Also you may try Ctrl + Shift + I if you need a keyboard shortcut.
    OlegYch
    @OlegYch
    @niktrop ctrl-hover looks like it, thanks
    what's the action name? ctrl-shift-i seems unbound for me
    Nikolay Tropin
    @niktrop
    @OlegYch Quick Definition
    OlegYch
    @OlegYch
    cheers
    Ólafur Páll Geirsson
    @olafurpg
    @unkarjedy thank you! Any pointers for how to implement MUnit testing support would be helpful.
    João Gabriel Zó
    @joaogabrielzo
    Anyone having trouble after upgrading Intellij?
    I can't use scala collections like List, Arrays, etc. It is telling me to import from Java
    I can't also use extends App, it can't find the App trait
    OlegYch
    @OlegYch
    probably need to reimport the project