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

bloop jvm settings #3746

Merged
merged 8 commits into from
Apr 20, 2022
Merged

bloop jvm settings #3746

merged 8 commits into from
Apr 20, 2022

Conversation

zmerr
Copy link
Contributor

@zmerr zmerr commented Mar 22, 2022

It resolves #2697
It is for getting bloop JVM settings from user config and then writing it in the global bloop json file.

@zmerr zmerr marked this pull request as draft March 22, 2022 13:58
@zmerr zmerr requested review from tgodzik and ckipp01 March 22, 2022 13:59
Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting to dig into this @zmerr! Keep in mind that one other thing we'll need to think about is how to handle this when Bloop is already running. We'll probably want to write the new settings, then restart Bloop to ensure it's taken into account.

@zmerr
Copy link
Contributor Author

zmerr commented Mar 23, 2022

@ckipp01 Now everything on the server side is implemented. Can you please take a second look?
The problem with the current implementation I think is that, if both the Bloop version and the Bloop JVM properties get modified, the user receives two dialogues asking them to restart. And if the Jvm properties one is not approved, then the bloop’s global json file would not be overwritten with the newly requested jvm memory settings.
So is there currently a standard way to blend in those dialogues in one, or should I do it my own preferred way?

@zmerr
Copy link
Contributor Author

zmerr commented Mar 23, 2022

ah, one more thing: in the metals standup today, it was agreed upon that I put a checkbox on metals settings asking the user whether they want to manually enter the Jvm properties in the Metal extension’s settings, or they just want the contents of their bloop global json file to be used for that…
So that is yet to be implemented...

@tgodzik
Copy link
Contributor

tgodzik commented Mar 23, 2022

ah, one more thing: in the metals standup today, it was agreed upon that I put a checkbox on metals settings asking the user whether they want to manually enter the Jvm properties in the Metal extension’s settings, or they just want the contents of their bloop global json file to be used for that… So that is yet to be implemented...

I was thinking about something a bit different:

  • if user doesn't have the global bloop json create then we just modify it and add an additional field to notify that it's Metals generated
  • next time user modifies the settings we could check if that field exists, if it does just replace everything, otherwise offer message request with option to override or just opening the file (invoke goto lcoation).

@zmerr
Copy link
Contributor Author

zmerr commented Mar 23, 2022

add an additional field to notify that it's Metals generated

@tgodzik then can’t it potentially cause some kind of error later in Bloop or another tool reading the file, due to an unrecognized key?
Is there a good way of adding it as some kind of comment or somewhere else that wouldn’t cause this?

@tgodzik
Copy link
Contributor

tgodzik commented Mar 23, 2022

add an additional field to notify that it's Metals generated

@tgodzik then can’t it potentially cause some kind of error later in Bloop or another tool reading the file, due to an unrecognized key? Is there a good way of adding it as some kind of comment or somewhere else that wouldn’t cause this?

Ach, you are right, I hoped it would just get ignored. We could add an additional file (kind of a lock file) like .bloop/metals.lock maybe?

@zmerr
Copy link
Contributor Author

zmerr commented Mar 23, 2022

We could add an additional file (kind of a lock file) like .bloop/metals.lock maybe

@tgodzik Ok, then I would go with that approach…

I hope in the updates or reinstallations of Bloop, it won’t get erased…

Also, what if the user later modifies the json file after the metals.lock is created?

I would say, let’s just persist the time at which we are modifying the bloop json file by reading its "last modified time" value after we create or write to it in the metals server internal files, then in the next times, we compare the modification date to our persisted one, to see if it was us who modified it...

@tgodzik
Copy link
Contributor

tgodzik commented Mar 23, 2022

We could add an additional file (kind of a lock file) like .bloop/metals.lock maybe

@tgodzik Ok, then I would go with that approach…

I hope in the updates or reinstallations of Bloop, it won’t get erased…

Also, what if the user later modifies the json file after the metals.lock is created?

I would say, let’s just persist the time at which we are modifying the bloop json file by reading its "last modified time" value after we create or write to it in the metals server internal files, then in the next times, we compare the modification date to our persisted one, to see if it was us who modified it...

We could do that yeah, might be a good approach and otherwise ask the user about it.

@zmerr zmerr requested a review from ckipp01 March 23, 2022 16:04
@zmerr zmerr force-pushed the bloop-memory-settings branch from a039adf to b507d12 Compare March 23, 2022 17:28
@zmerr zmerr marked this pull request as ready for review March 24, 2022 10:31
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! The approach looks solid, I left some overall comments, but nothing major.

Did you manage to make it work with the VS Code extension?

@zmerr zmerr force-pushed the bloop-memory-settings branch from dd3c276 to e70b717 Compare March 25, 2022 13:12
@zmerr zmerr requested a review from tgodzik March 25, 2022 13:52
@zmerr
Copy link
Contributor Author

zmerr commented Mar 26, 2022

@ckipp01 do you think this should be done for other editors as well?

Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this so far @zmerr! I've left a few suggestions, questions, and nits.

@ckipp01 do you think this should be done for other editors as well?

So since this is using existing LSP methods already this should already work as is for other editors. For example in nvim-metals I just needed to add the newly created bloopJvmProperties as a possible configuration value and everything else just worked ™️

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work so far! I left some more ideas, mostly because doing this PR right would help a lot of people.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested it locally and everything looks great!

Could you rebase your PR on the newest changes? We can merge afterwards, thanks!

@zmerr zmerr force-pushed the bloop-memory-settings branch from f39abb3 to ef82ff0 Compare April 19, 2022 17:25
@zmerr zmerr requested a review from tgodzik April 19, 2022 17:27
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this!

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.

Make it easier for users to change build server's memory requirements
3 participants