Repository navigation
Conversation
scala-cli supports a bespoke extension to the the build server protocol. This extension allows the support of Scala scripts. Scala scripts are Scala code which is then wrapped at build time by some Scala code to make them valid Scala code. scala-cli-bsp's buildTarget/wrappedSources allows build tools to give the following information: - the scala script file - the generated scala file generated from the script - the string that is added on the top of the file - the string that is added on the bottom of the file This PR adds Virtuslab's scala-cli-bsp library to the bsp worker module, and implements the handler for the buildTarget/wrappedSources call. To make the information available, it changes the return type of `generateScriptSources` in `MillBuildRootModule` to return, together with the `PathRef` of the destination folder, the four elements described above, so it can be used by BSP.
|
That BSP extension looks new to me, which surprises me, since I try to follow the BSP development closely. I think making a bespoken BSP extension without a proper specification the status quo (by supporting it in scala-cli and a major BSP client in the Scala world) is a worst case scenario and will render the whole BSP idea to nonsense. We should strive for getting this extension into the BSP spec. Therefore, please provide a link to the BSP issue, where this extension is discussed. If there is none, we should create one and link all existing implementations and discussions. Further discussion how the extension should behave should continue there (e.g. not in some discord channels). As it looks like, the extension is already developed, so all that is left is to formalize it in the spec and properly support it with a capability flag. |
|
@lefou Sure, I don't have anything against making the extension an official part of BSP. |
|
Yeah, but there is not a single trace in the BSP project, not even a discussion or a wiki. What a waste of developer resources (you never know who else fiddles with this stuff) and also miss of valuable input (Should we put this behind a capability? Yes. Should we define a new supported langauge for that? No.) |
|
Started working on adding the message to the official BSP protocol: build-server-protocol/build-server-protocol#673 |
@lolgab Thank you! β€οΈ |
|
Closing due to inactivity |
|
Sorry @lolgab for me being naive and thinking the BSP project is the way to go. (Meanwhile, I think it's a corporate project serving the interest of some vendor. Decisions seem to happen somewhere else.) I think we might support this feature nonetheless, as it might also fix the issue we have in Mill with our generated script sources. IDEA and probably Metals often jumps to the derived sources instead to the originals. If we can fix that for at least Metals users, this would be great. |
scala-cli supports a bespoke extension to the the build server protocol.
This extension allows the support of Scala scripts. Scala scripts
are Scala code which is then wrapped at build time by some Scala
code to make them valid Scala code.
scala-cli-bsp's buildTarget/wrappedSources allows build tools to
give the following information:
This PR adds Virtuslab's scala-cli-bsp library to the bsp worker module,
and implements the handler for the buildTarget/wrappedSources call.
To make the information available, it changes the return type of
generateScriptSourcesinMillBuildRootModuleto return, togetherwith the
PathRefof the destination folder, the four elementsdescribed above, so it can be used by BSP.