-
Notifications
You must be signed in to change notification settings - Fork 347
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
Handle workspaces with multiple build files. #1758
Conversation
63990f9
to
f532f5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some small comments, but I think it's a good direction. Both versions you proposed seem OK to me and if this causes less changes then I don't think we should go the other way.
metals/src/main/scala/scala/meta/internal/metals/MetalsLanguageServer.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/MetalsLanguageServer.scala
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/BloopInstall.scala
Outdated
Show resolved
Hide resolved
Sounds good 👍 I'll keep going this route then. |
Cool improvement! 👍 Can we also have a possibility to see which build system was used for import? A db will not be wiped when I do "Build import", right? It would be good to give user an option to reset chosen build tool, what do you think? |
Ah, I hadn't thought of that, but yea, that's a cool idea. Let me play around with this to make sure there is a good minimal way to display this.
Yea the decisions is persisted, so currently, apart from delete the |
You are probably right, I don't know how it works for other messages 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the great work! I have just two minor comments, but I would like to merge the Ammonite PR first, since it can have conflicts with this one.
metals/src/main/scala/scala/meta/internal/metals/MetalsLanguageServer.scala
Outdated
Show resolved
Hide resolved
No worries! I figured there would be some conflicts. I'll rebase once it's merged. |
Previously this always defaulted to the first found, manytimes leading to an SBT build if a workspace had both a `build.sbt` and a `build.sc` file. Now both are grabbed and the user is prompted to choose whether the space if for build tool A or build tool B. This choice is remembered and they are not asked about this again.
If the user has a workspace where there are multiple build files and they have chosen one, there will be a short message in their Doctor saying 'Your <build tool> build definition was imported'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Let's merge this and I will follow up with the import formatting PR
Previously this always defaulted to the first found, many times leading
to an SBT build if a workspace had both a
build.sbt
and abuild.sc
file. Now both are grabbed and the user is prompted to choose whether
the space if for build tool A or build tool B. This choice is remembered
and they are not asked about this again.
Demo
Chosen Approach
I went back and forth on how the flow should go for this. I really wanted that when it was detected that multiple build definitions were found that it'd prompt like the following:
However, after doing that it was quite messy since you have to carry a list of
BuildTool
round to multiple methods, which all would have to handle if there was one more many. I found it way simpler and less of a change to simply prompt the user right away when multiple were found to get their intention for the workspace. Then all of the rest of the logic can remained unchanged. I'm still open to the alternative way that I outlined I guess, but I really think it will messier and more code without much benefit.All that to say, I wanted to throw this up here to make sure this approach was ok before I started to write tests for this.
Closes #1757