scalafix
scalafix copied to clipboard
Better IntelliJ support when working on scalafix
Since the introduction of sbt-project-matrix in https://github.com/scalacenter/scalafix/pull/1528, there are compilation errors in IntelliJ when working on scalafix itself (apparently for both classic & BSP integrations), which prevents running tests from the IDE.
This is also true for projects bootstrapped with https://github.com/scalacenter/scalafix.g8.
A first solution would be to only export some of the modules of the matrix as recommended in https://github.com/sbt/sbt-projectmatrix/issues/25#issuecomment-623850021.
What are the BSP errors that you get? Maybe it's fixable on the Bloop/sbt side?
@tgodzik I didn't get the time to look at it myself.
@rvacaru can you report your problems here?
Just checked and I don't get any errors with Bloop + Metals. Project matrix might be problematic for Intellij as it doesn't like multiple targets with the same directory.
@tgodzik @bjaglin I've just started working on scalafix with both Intellij and VS Code, so far these are my findings when comparing the IDEs:
-
Just looking at
ExplicitResultTypes.scala- Intellij: line 9
import buildinfo.RulesBuildInfois not resolved, even after runningsbt compileon the whole scalafix - VS Code: the import works and ctrl click on
RulesBuildInfonavigates to the scala file
- Intellij: line 9
-
Looking at
ExplicitResultTypesBug.scala(only in the output folder, not the input)- Intellij:
- line 4
import scala.reflect.runtime.universe._says runtime isn't a member of reflect - line 9 type
ClassMirrornot found
- line 4
- VS Code: runtime package is recognized when hoovering on it and ctrl click on
ClassMirrornavigates to it
- Intellij:
-
Looking at
Compat.scalaobjects- Intellij errors
SeqViewexpects only 1 arg, but finds 2 (points to scala-library-2.13.8 jar instead of the 2.11 or 2.12 versions - VS Code works as expected
- Intellij errors
-
Running or debugging
ScalafixImplSuite- Intellij fails building with
Compat is already defined as object Compat - VS Code runs and debugs are working fine
- Intellij fails building with