Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BSP: fix mill-build module interpretation in IntelliJ IDEA #1876

Merged
merged 2 commits into from
May 17, 2022

Conversation

atty303
Copy link
Contributor

@atty303 atty303 commented May 16, 2022

Current behaviour

Snag_d9bcecc

Snag_d9cc8cc

  • sub is interpreted as a package.
  • Source Folders is ..

This creates a problem where IntelliJ may interpret root.Foo class as sub.foo.src.root.Foo class.

Changed behaviour

Snag_d9f2fd9

Snag_da04792

  • sub is interpreted as a directory.
  • Source Folders is .bsp.

Everything works well. build.sc can also be edited correctly.

If IntelliJ supports per-file source configuration, this change would not be necessary.

@@ -335,6 +341,15 @@ class MillBuildServer(
targetIds = sourcesParams.getTargets.asScala.toSeq,
agg = (items: Seq[SourcesItem]) => new SourcesResult(items.asJava)
) {
case (id, _: MillBuildTarget) if clientIsIntelliJ =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change may break Metals, so we are limiting it to IntelliJ.

Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR. Sounds reasonable.

bsp/src/mill/bsp/MillBuildServer.scala Outdated Show resolved Hide resolved
@lefou lefou merged commit 0fd40b0 into com-lihaoyi:main May 17, 2022
@lefou lefou added this to the after 0.10.4 milestone May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants