-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
launch.json support changes #156
Conversation
…id. added non-compliant key nvimKey for vscode launch.json
Thank you for the PR. Overall I'm not opposed, some more detailed feedback:
If the motivation is to re-use existing vscode specific I'm not sure if I understand the problem correct. Do you have a concrete example?
I wonder if that shouldn't be a property within the
Are there any debug adapters that are vscode-only and reject other clients? It would be possible to use the |
Thanks for the feedback, much appreciated.
The reasoning I had was to create a way that's embedded into the structure instead of letting this become too customizable and dependent on individual user configuration. To be honest IMO this entire thing could also be solved with a bigger refactor where the adapter holds the extensions instead of the configuration key and with some kind of way to decide on the right adapter to launch. As for the example scenario - this is from the launch.json in my test project "configurations": [
{
"name": "netcoredbg test",
"nvimKey": "cs",
"type": "netcoredbg",
"request": "launch",
"cwd": "${workspaceFolder}/testconsole",
"program": "${workspaceFolder}/testconsole/bin/Debug/net6.0/testconsole.dll"
},
Yeah, that's what I initially did but decided against it to not introduce a breaking change.
Yeah, especially microsoft adapters :) I wanted to reverse a DRM mechanism in one of those ( just for fun, microsoft, I swear) and noticed that clientID is verified
Can you elaborate on how you would approach this with defaults? I wanted something simple that would allow me to simply change something in launch.json and try again. Having the ID in the config may also be a good idea to support adapters that act differently based on clientID ( haven't seen that yet ) without changing the adapter setup. |
I'm not sure how to solve this. But the other solutions I can think of are not ideal either:
Can you elaborate how that would work?
I think it would even be possible with a soft deprecation.
It would require setting the value in your vim config. require('dap').settings.fallback.clientId = '...' And you could set it also per adapter type: require('dap').settings.python.clientId = '...' But I'm not sure if this should be configurable at all. |
This is how I was able to load the .vscode/launch.json for cpp, I also needed this PR #217 for the predefined variables. First create an adaptor dap.adapters.cppdbg = dap.adapters.cpp --create an adapter for type cppdbg from an existing one
require('dap.ext.vscode').load_launchjs() --load launch.json configuration Then reassign the -- launch.json is configured with `type = "cppdbg"`, so reassign those configuration `cpp`
dap.configurations.cpp = dap.configurations.cppdbg or add the configurations loaded from launch.json to your existing configuration -- Add to an existing configuration
for _, launchjs_config in pairs(dap.configurations.cppdbg) do
table.insert(dap.configurations.cpp, launchjs_config)
end @mfussenegger I was only trying to solve the type problem like you suggested. It would be helpful if this comes part of the documentation. Also I hope you will merge PR #217. |
6767b43 got merged which may help with this. |
adapterID = 'nvim-dap'; | ||
clientID = config.clientID or 'neovim'; | ||
clientName = config.clientName or 'neovim'; | ||
adapterID = config.type or 'nvim-dap'; |
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.
Could we think about incorporating this line at least? It would make defining the adapter for cppdbg
a lot easier.
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.
Could you explain why this would make defining the cppdbg
adapter easier?
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.
Sure, it removes the necessity for the step
* Copy extension/cppdbg.ad7Engine.json to extension/debugAdapters/bin/nvim-dap.ad7Engine.json
on this page.
This is helpful because you might want to install cppdbg via a system package manager or something, and don't want to be messing around in system directories like this. Especially helpful if you're using the nix package manager too like me
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.
Useful for the cppdbg debug adapter See #156 (comment)
Useful for the cppdbg debug adapter See #156 (comment)
@bbenzikry Is there still anything in this PR that you think would be helpful to get in? |
@mfussenegger I think nothing from the PR itself can help at this point and still maintain a reasonable way for users to configure. I will say that I really like your suggestion of adding a companion file. I think it can allow users to deal with any type of custom configuration ( maybe a file that automatically merges itself a-la Kustomize, with a proper schema ) but that probably requires a separate PR that takes other details / requirements into consideration |
No problem. I take my time to respond on issues too :)
Alright, in this case I'm closing the PR for now. If you have other suggestions on how to make your use-cases easier to accomplish - let me know. |
This is a draft PR as I wanted to get some suggestions as to if this even makes sense @mfussenegger
Add support for a non compliant
nvimKey
in debugger configurations for launch.jsonThe problem that arose for me was that many configurations used by default vscode have a type that is not the file extension expected by nvim-dap to be the key in the
configurations
table.Make sure adapterID is set to the type instead of
nvim-dap
.Some adapters actually check the adapter ID and fail when it's not the correct type.
Allow overriding clientID and clientName for a configuration definition. This allows for interesting scenarios such as simulating vscode-only debuggers