I have a number of tests in my "src/main/it/scala" folder. "Peek References" does not show any usages of classes or methods in that folder.
Additionally, when I'm editing those files, I am unable to navigate to any methods or classes defined in that directory using "Go to definition".
To Reproduce Steps to reproduce the behavior:
I don't have a minimal working example. My .sbt file does use the following settings (the build has multiple subprojects):
lazy val db = (project in file("db"))
.configs(IntegrationTest)
.settings(
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.9"),
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.2.4"),
Defaults.itSettings
)
Expected behavior
"Peek References" should show all usages across my project.
Installation:
metals.serverVersion): 1.3.1Additional context
I'm glad to help debug.
Hi @m4dc4p thanks for reporting. I've moved the issue to the main Metals repo since this is not specific to the VSCode extension.
This is essentially a duplicate of https://github.com/scalameta/metals/issues/503.
The reason for this behavior is the fact that Bloop does not export the IntegrationTest target by default.
From the Bloop docs:
By default, bloopInstall exports projects for the standard Compile and Test sbt configurations. If your build defines additional configurations in a project, such as IntegrationTest, you might want to export these configurations to Bloop projects too.
You can follow the instructions here https://scalacenter.github.io/bloop/docs/build-tools/sbt#enable-custom-configurations in order to make Bloop export the IntegrationTest target. Note that you will need to add sbt-bloop to your build.
Let me know if it fixes the issue.
Related: @olafurpg / @jvican, this issue came up a few times on GitHub and Gitter, do you think it may be worth it to export IntegrationTest by default (either customizing Bloop from Metals, or exporting it by default in Bloop)?
That worked! I added the sbt-bloop plugin, add the config as suggested, and re-imported. Success.
Thank you!
Related: @olafurpg / @jvican, this issue came up a few times on GitHub and Gitter, do you think it may be worth it to export IntegrationTest by default (either customizing Bloop from Metals, or exporting it by default in Bloop)?
A few weeks ago I managed to put up a prototype to export integration tests by default. That will probably make it to the next release.
I just want to bump this issue, because it was useful for me and my team to get our acceptance tests working with metals
Most helpful comment
A few weeks ago I managed to put up a prototype to export integration tests by default. That will probably make it to the next release.