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

Add support for "hot-code replace" #686

Open
lervag opened this issue Aug 26, 2024 · 7 comments
Open

Add support for "hot-code replace" #686

lervag opened this issue Aug 26, 2024 · 7 comments

Comments

@lervag
Copy link

lervag commented Aug 26, 2024

Describe the feature

In Metals v1.3.0 there is now support for socalled hot-code replace, see https://scalameta.org/metals/blog/2024/04/15/thalium/#debugger-improvements.

It would be very nice to have this available in Neovim with nvim-metals!

See also: https://discord.com/channels/632642981228314653/632841743435563028/1277531516821311560

Potential ways to implement

No response

@lervag
Copy link
Author

lervag commented Aug 26, 2024

I've reported both @WSA1k and @llowvxe for phishing.

@scalameta scalameta deleted a comment Aug 26, 2024
@scalameta scalameta deleted a comment Aug 26, 2024
@ckipp01
Copy link
Member

ckipp01 commented Sep 16, 2024

So finally getting around to look at this @lervag I'm not actually seeing this as part of the DAP spec. So this may be VS Code specific behavior. I don't see any mention of it in nvim-dap as well.

@lervag
Copy link
Author

lervag commented Sep 17, 2024

Ah, I see. Perhaps we should ask for more information on the Discord channel for metals on this particular feature?

@ckipp01
Copy link
Member

ckipp01 commented Sep 18, 2024

So I'm not sure Metals is actually the correct place for the discussion. I'd do the following:

  1. Double check the DAP spec to see if it's part of it
  2. If it is, then nvim-dap would need to add support for it
  3. If it's not, then nvim-dap would still need to build it from scratch to mimic VS Code

@lervag
Copy link
Author

lervag commented Sep 18, 2024

I'm trying to find a specification for this. It's hard! It seems to be a custom DAP extension, or something like that.

I've found a few relevant references:

Perhaps you are right that this is something that should be added to nvim-dap?

@lervag
Copy link
Author

lervag commented Sep 18, 2024

But it seems like this may be a more relevant reference in case we want to implement this into nvim-metals directly.

@lervag
Copy link
Author

lervag commented Sep 18, 2024

I asked for some more in one of the related issues and got a reply there. For convenience, I'm quoting it:

@levarg Our implementation is the same as https://github.com/microsoft/vscode-java-debug which does not seem to be documented anywhere.

Here is a basic description:

  • recompile the project
  • collect all classes that changed
  • in each thread, if there is a frame in a changed class, unstack it (and all frames on top)
  • ask the JVM to reload the changed classes: the spec of this depend on your JVM, most JVMs don't accept new methods in a class
  • step into once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@lervag @ckipp01 and others