Skip to content

Report *.mill files as "wrapped sources" via BSP - #6874

Merged
alexarchambault merged 5 commits into
com-lihaoyi:mainfrom
alexarchambault:bsp-wrapped-sources
Feb 24, 2026
Merged

alexarchambault merged 5 commits into
com-lihaoyi:mainfrom
alexarchambault:bsp-wrapped-sources

Conversation

@alexarchambault

@alexarchambault alexarchambault commented Feb 23, 2026 •

Copy link
Copy Markdown
Collaborator

This makes Mill report its *.mill files as "wrapped sources" in BSP via the buildTarget/wrappedSources request. This can help BSP clients pass to their presentation compiler the same sources that Mill passes to the compiler. In order to get more accurate infos from it, in particular for the build.* stuff in the build (to refer to things defined in other *.mill files).

Quick tests on a minimal project show that this doesn't break the currently existing features in Metals, while I can make good use of it in my own LSP server.

Pull request: #6874

@alexarchambault
alexarchambault marked this pull request as ready for review February 23, 2026 18:04
@lefou

lefou commented Feb 23, 2026 •

Copy link
Copy Markdown
Member

I can't find the BSP spec of the wrappedSources request, but I could find these pull requests and reported issues:

I still don't get it, why the Scala-CLI developers never tried to upstream the request. This is not at all how Open Sources works. The current state of the BSP project is unmaintained and the repo is kind-of unmaintainable. But I still would prefer to upstream the wrappedSources request into the spec.

Maybe we can just fork the BSP project from its last stable release tag, which should be still on sbt? Or we can just take maintainership, revert the Bazel migration and add the wrappedSources request directly?

 Conflicts:
	runner/meta/src/mill/meta/MillBuildRootModule.scala
@lefou

lefou commented Feb 24, 2026

Copy link
Copy Markdown
Member

This change makes *.mill files more or less "official" source files. Shouldn't we report that to the BSP client somehow? E.g. we could add "Mill" to the supported Languages.

@alexarchambault

Copy link
Copy Markdown
Collaborator Author

This change makes *.mill files more or less "official" source files. Shouldn't we report that to the BSP client somehow? E.g. we could add "Mill" to the supported Languages.

I don't know, editing .mill files in VSCode has been working fine for me, I'm not sure anything needs to be changed here. Don't know about IntelliJ, but I think many people use it fine to work on Mill and on .mill files.

Co-authored-by: Tobias Roeser <le.petit.fou@web.de>
@alexarchambault
alexarchambault merged commit dd50a08 into com-lihaoyi:main Feb 24, 2026
66 of 67 checks passed
@alexarchambault
alexarchambault deleted the bsp-wrapped-sources branch February 24, 2026 12:30
@lefou lefou added this to the 1.1.3 milestone Feb 24, 2026
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.

3 participants