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

DAP "run | debug" code lens is being showed by default #498

Open
atk91 opened this issue Nov 18, 2022 · 4 comments
Open

DAP "run | debug" code lens is being showed by default #498

atk91 opened this issue Nov 18, 2022 · 4 comments

Comments

@atk91
Copy link

atk91 commented Nov 18, 2022

Task

With almost default setup the run | debug is being shown at the end of each object Main extends App line.

It renders just the same font as code, so it does confuse user a little bit, and you cannot simply copy-paste code from terminal since it will include this run | debug.

As @ckipp01 said in Discord:

I need to dig in further and see if at its core this is Neovim sending a request right in the beginning or not

@ckipp01
Copy link
Member

ckipp01 commented Nov 28, 2022

Alright so I had time to dig into this a little bit and I finally see the issue. Metals will provide these if the client is what we call a debuggingProvider. In nvim-metals I determine this based off of whether or not you have nvim-dap installed. So I'm assuming you have that installed. However, what I thought I could change it to is instead to see if require("metals").setup_dap() is called. However, that's a bit problematic to do based on the flow of everything.

However, what I also noticed when testing this more is that if setup_dap() is never called when you trigger the code lens you should see:

The selected configuration references adapter `scala`, but dap.adapters.scala is undefined

If you trigger it do you see them, and do you indeed have nvim-dap installed?

@atk91
Copy link
Author

atk91 commented Jan 30, 2023

If I have nvim-dap not installed - run | debug is not being displayed

If I have it installed - it is being displayed regardless of whether require("metals").setup_dap() is being called or not.

@ckipp01
Copy link
Member

ckipp01 commented Feb 1, 2023

If I have it installed - it is being displayed regardless of whether require("metals").setup_dap() is being called or not.

This is sort of expected. The tricky this is that Metals needs to know at initialize time if the client supports debugging or not, so to cheat this I check to see if nvim-dap is installed and if it is, I then send in that debugging is supported (even though it may not be set up). If I'd wait to detect the setup_dap call it'd delay everything and make the start process quite a bit trickier. That's not a good trade off imo.

@atk91
Copy link
Author

atk91 commented Feb 1, 2023

I agree, however I think it would be nice to add something like "If you do not want to see those run | debug do not install nvim-dap" in the documentation.

or maybe add a configuration option which will override nvim-dap's presence and make nvim-metals act like debugging is not supported?

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

No branches or pull requests

2 participants