mill icon indicating copy to clipboard operation
mill copied to clipboard

IntelliJ BSP does not mark `out/` and `.idea/` folders as excluded

Open lihaoyi opened this issue 1 year ago • 3 comments

This causes search and indexing to often waste large amounts of time digging through generated files in those folders when I really only care about the source code

Somehow .bsp/ is marked as excluded but the other two aren't

lihaoyi avatar Feb 17 '24 03:02 lihaoyi

How have you checked? Isn't it the responsibility of IntelliJ IDEA to ignore folders itself manages like .idea? Mill isn't creating it in BSP mode. Also, it would be in general a good idea to ignore paths that are in .gitignore and likewise repository configuration files.

Is there some way to even tell a BSP client, to ignore some resources? In the end, BSP should be all about what to include in some search, as it explicitly is about sources and resources, and not what to exclude. I'm tempted to say, this isn't an issue in Mill at all. At least, nothing Mill could or should control.

lefou avatar Feb 18 '24 20:02 lefou

It's visible in the file tree. Excluded folders are red, e.g. .bsp/ below:

Screenshot 2024-02-19 at 9 04 25 AM

We used to mark out/ as excluded back in the mill.scalalib.GenIdea days:

https://github.com/com-lihaoyi/mill/blob/4a65cea4dceaddf1db663b77589817e016eb57f3/idea/src/mill/idea/GenIdeaImpl.scala#L715-L717

But I don't see that happening today using mill.scalalib.GenIdea or mill.idea.GenIdea, so we might have dropped it accidentally at some point, or IntelliJ changed their XML config schema and it bitrotted and broke. Formill.idea.GenIdea the relevant code seems to be commented out:

https://github.com/com-lihaoyi/mill/blob/4a65cea4dceaddf1db663b77589817e016eb57f3/idea/src/mill/idea/GenIdeaImpl.scala#L456-L460

The mill.scalalib.GenIdea version still seems to be present:

https://github.com/com-lihaoyi/mill/blob/4a65cea4dceaddf1db663b77589817e016eb57f3/scalalib/src/mill/scalalib/GenIdeaImpl.scala#L427

but in both cases when I run the idea task I don't see the <excludeFolder url="file://$MODULE_DIR$/../../out" /> snippets appearing in .idea/

BSP import marks .bsp/ as excluded, but not out/ or .idea/

I don't know which system is at fault here, and marking it excluded manually is not a huge hardship. But given we used to be able to make this work, and now it doesn't, I think having an issue here is reasonable

lihaoyi avatar Feb 19 '24 01:02 lihaoyi

Looks like there's been prior discussion on this w.r.t. IntelliJ/BSP/SBT, and it should be supported as of about 18 months ago. We might be able to use the same thing for Mill

https://github.com/build-server-protocol/build-server-protocol/issues/205

lihaoyi avatar Feb 19 '24 01:02 lihaoyi

I will try to get it done

pawelsadlo avatar Jul 26 '24 17:07 pawelsadlo

Isn't it a bug that mill build module is showing only build.sc in content? and name is "mill-build_" instead of "mill-build"

image

If I import mill repo, its content root is a directory where mill file is located. image

@lihaoyi @lefou

pawelsadlo avatar Jul 29 '24 15:07 pawelsadlo

@pawelsadlo we just ned to make sure navigation and jump to sources work in both the build files and application code. The exact layout of the intellij module metadata doesn't really matter

lihaoyi avatar Jul 30 '24 11:07 lihaoyi

Yeah, ideally, we would want to use the directory containing the build.sc as source directory, but it's also containing all the sub-modules, which IDEA can't handle. So what you see is lots and lots of workaround found the hard way by try and error to map our project structure into the limited world IntelliJ IDEA understands.

lefou avatar Jul 30 '24 20:07 lefou