Replies: 1 comment 3 replies
-
Thanks for starting this discussion @adpi2! I've thought about this a bit in the past as well and more recently seeing how scala-cli does this since they do eliminate the Regarding
|
Beta Was this translation helpful? Give feedback.
-
More often than not Metals users have the
target
, the.bsp
, the.bloop
and the.metals
folders in their working directory. While I understand the purpose of each one of these, I also think there is something wrong in "polluting" the users directory with so much technical folders.As a visual example I created a simple sbt project with only one module and this is what I have in Metals:
I would like to open this discussion to see if we can improve the situation. Maybe a similar discussion already exists somewhere but I was not able to find it. Also this discussion is not specific to Metals but it needs to start somewhere.
Proposal
When starting a project the users choose a build tool and a code editor. So they will not be surprised that there is a
target
folder for the build tool and a.metals
folder for the code editor. However it is harder to understand or justify that there is a.bsp
and a.bloop
folder, since they do not result directly from a conscious choice of the user. The newcomers are confused by them as they don't really know which tool creates them for which reasons. They can try to remove them only to see that are coming back at some point..bsp
and.bloop
are more like implementation details of how Metals or sbt works together. For that reason I would argue that the information contained in those two folders should be distributed in the.metals
and thetarget
directory. Here is a proposal of how it can be done:.bsp
The files in .bsp are written by build tools so that code editors can find them.
On one hand it is very easy for the code editor to find those files because there are all in the same place: the
.bsp
folder. On the other hand it degrades the user experience of many users.I propose we distribute the
.bsp/*
files in the build tools target directory. For instance there would be onebsp.json
file in thetarget
folder of an sbt repository, and similarly onebsp.json
file in theout
folder of a mill repository.The main drawback is that code editors will have to go over all folders to find all the
bsp.json
files, which would rarely be higher than 100 folders. The cost would not be so high and the result would be a better experience for all users, in particular for the newcomers..bloop
In the majority of cases, it is Metals that triggers the generation of the
.bloop
config for its own purpose and no other tool will ever use it. There are some exceptions though that I treat below.So I propose that Metals put the
.bloop
folder inside the.metals
folder. This is somehow similar to whatscala-cli
does: it creates a.bloop
folder inside the.scala
folder and uses Bloop internally to compile.In terms of implementation we can add a configuration key for the output folder (
.metals
instead of.
) in sbt-bloop, maven-bloop and gradle-bloop.To deal with the exceptions, there should be a configuration in Metals so that a user can still have the
.bloop
folder in the root folder. Also Metals should use the existing.bloop
folder if there is one already (as it already does).Beta Was this translation helpful? Give feedback.
All reactions