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

IntelliJ BSP does not mark out/ and .idea/ folders as excluded (500USD Bounty) #3015

Closed
lihaoyi opened this issue Feb 17, 2024 · 7 comments · Fixed by #3329
Closed

IntelliJ BSP does not mark out/ and .idea/ folders as excluded (500USD Bounty) #3015

lihaoyi opened this issue Feb 17, 2024 · 7 comments · Fixed by #3329
Labels
Milestone

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Feb 17, 2024


From the maintainer Li Haoyi: I'm putting a 500USD bounty on this issue, payable by bank transfer on a merged PR implementing this.


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

@lefou
Copy link
Member

lefou commented Feb 18, 2024

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.

@lihaoyi
Copy link
Member Author

lihaoyi commented Feb 19, 2024

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:

<excludeFolder url="file://$MODULE_DIR$/../../project" />
<excludeFolder url="file://$MODULE_DIR$/../../target" />
<excludeFolder url="file://$MODULE_DIR$/../../out" />

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:

// Tuple2(
// os.sub / "mill_modules" / "mill-build.iml",
// rootXmlTemplate(allBuildLibraries.flatMap(lib => libraryNames(lib)))
// ),
Tuple2(

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

rootXmlTemplate(allBuildLibraries.flatMap(lib => libraryNames(lib)))

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
Copy link
Member Author

lihaoyi commented Feb 19, 2024

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

build-server-protocol/build-server-protocol#205

@lihaoyi lihaoyi changed the title IntelliJ BSP does not mark out/ and .idea/ folders as excluded IntelliJ BSP does not mark out/ and .idea/ folders as excluded (500USD Bounty) Jul 22, 2024
@pawelsadlo
Copy link
Contributor

I will try to get it done

@pawelsadlo
Copy link
Contributor

pawelsadlo commented Jul 29, 2024

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

@lihaoyi
Copy link
Member Author

lihaoyi commented Jul 30, 2024

@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

@lefou
Copy link
Member

lefou commented Jul 30, 2024

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 lefou added the bounty label Aug 9, 2024
@lefou lefou added this to the 0.12.0 milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants