-
Notifications
You must be signed in to change notification settings - Fork 863
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
Extending lsp.client with support for DAP #8098
base: master
Are you sure you want to change the base?
Conversation
Debugging Python inside NetBeansRun the Python file like this:
It should now wait for connections from the IDE. In the IDE, select In the dialog, fill in:
Confirm the dialog - the IDE should now debug the Python code. |
The debugging works with GraalVM based languages as well. Just download GraalVM for JDK 17 and Graal.js 17 and debug sieve.js with following command debugger connects and one can step over the code. |
All the CI checks are green. Is there anything else to do before merging this functionality in? |
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.
Interesting addition! I left a few inline comments from experiences with LSP/CDT.
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/DAPActionsProvider.java
Outdated
Show resolved
Hide resolved
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/DAPActionsProvider.java
Outdated
Show resolved
Hide resolved
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/DAPDebugger.java
Outdated
Show resolved
Hide resolved
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/Utils.java
Outdated
Show resolved
Hide resolved
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/Utils.java
Outdated
Show resolved
Hide resolved
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.
So am I understanding this right, that the java lsp server invented its own DAP protocol?
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.
Sorry, not sure what you mean here?
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.
The java lsp server has provided its own DAP protocol implementation since ages to allow JVM debugging in the VSCode. However that's the other side of the DAP protocol - VSCode was DAP client and NetBeans was DAP server.
The changes in lsp.client
aim towards NetBeans being DAP client and the server can be anything.
...t/src/org/netbeans/modules/lsp/client/debugger/breakpoints/BreakpointAnnotationProvider.java
Outdated
Show resolved
Hide resolved
....client/src/org/netbeans/modules/lsp/client/debugger/breakpoints/DAPBreakpointConvertor.java
Outdated
Show resolved
Hide resolved
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/spi/BreakpointConvertor.java
Outdated
Show resolved
Hide resolved
ide/lsp.client/src/org/netbeans/modules/lsp/client/debugger/LineBreakpointData.java
Outdated
Show resolved
Hide resolved
… matthiasblaesing: - cleaning up use of String urls, using URIs internally - cleaning up the breakpoint to not hold paths, but rather only hold FileObjects - cleaning up the BreakpointAnnotationProvider to not use a weak listener, and holder for the listeners. Using ordinary listeners, which will be held as long as the DataObject exists, and should be automatically GCed when the DO is removed, which is presumably the intent - renaming (DAP)Utils to DAPStackTraceAnnotationHolder
FWIW, based on @matthiasblaesing's comments, I tried to do some more cleanup: notably:
I believe the only two unhandled comments are:
|
… matthiasblaesing
For the URI discussion: I did not mean, that usage should switch over to URI. That maybe a valid target, but it highly depends on the actual protocol promises. I see the type I looked a bit further and this is I think the relevant part: https://microsoft.github.io/debug-adapter-protocol/overview#initialization
The default according to https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize default is So we need to decide: How to handle this wildcard. I bet there will be DAPs, that only support Each has drawbacks:
It would be interesting to get samples of both and see how they react if they detected, that they can't comply with the request of the IDE. I.e. will the adapters correctly fail initialization if a source path type is requested, that it can't provide or will it pretend to work and just silently send invalid data. |
I guess I don't quite see the huge problem. The protocol by default uses path, and this code apparently does not change the default, i.e. what goes over the wire is a path. (And to make things work, both client and server must see the same file using the same path.) What The main point of the |
all tests green, removing the label again (only added it to check it at least once) |
The review has revealed bugs in treating the two kinds of strings. By using
I like the separation.
For now, let's make the interface package private in 8049bec650 |
I'd like NetBeans to have a support for DAP. To debug GraalVM based languages as well as Python, for example.