DAP "run | debug" code lens is being showed by default
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
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?
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.
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.
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?