-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
10011: Add DebugProtocolSource and DebugProtocolBreakpoint #10926
10011: Add DebugProtocolSource and DebugProtocolBreakpoint #10926
Conversation
Note: I wasn't sure how to actually match Breakpoints to DebugProtocolBreakpoint in debug-session.tsx#getBreakpoint(id), as it seems they don't use matching IDs. I've modified the Breakpoint constructor to accept an optional initial ID (that can be copied from the plug-in Breakpoint), but I'm not sure that's the right way to go. I couldn't figure out a better way to match the various breakpoints, though. |
@CamilleLetavernier, are you familiar with any existing plugins that use this API? Your test extension is a good proof of functionality, but to address your question about matching breakpoints, it would be good to be able to see what the API is used for elsewhere. |
@colin-grant-work It looks like the profiling feature of the |
@CamilleLetavernier, @JonasHelming, I'll take a look at this this week, either today or tomorrow. |
@CamilleLetavernier do you mind rebasing? Hopefully CI will kick in again after (currently does not show up on the pull-request). |
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.
I've made some comments on the code. It would be helpful if you could provide more details about how to use the plugin - what command to run to trigger its functionality and what output should be expected under different conditions. The plugin probably shouldn't add new listeners every time its command is run, since that can lead to confusing output if the same information is printed more than once.
Sorry, that was a mis-click. No changes just yet! |
d75ba90
to
2d060fb
Compare
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.
@CamilleLetavernier can you expand on #10926 (review) by updating the pull-request description on on how to properly test the features using the plugin provided, the steps are a bit vague at the moment.
CHANGELOG.md
Outdated
@@ -146,6 +146,7 @@ | |||
- [vsx-registry] updated `requestretry` from `v3.1.0` to `v7.0.0` [#10831](https://github.com/eclipse-theia/theia/pull/10831) | |||
- [workspace] fixed `'save as'` for `untitled` schemes [#10608](https://github.com/eclipse-theia/theia/pull/10608) | |||
- [workspace] fixed the styling of the `path` in the dialog [#10814](https://github.com/eclipse-theia/theia/pull/10814) | |||
- [plugin] added support for `DebugProtocolBreakpoint` and `DebugProtocolSource` [#10011](https://github.com/eclipse-theia/theia/issues/10011) - Contributed on behalf of STMicroelectronics |
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 entry should be moved under 1.26.0
.
|
||
const debug = new DebugExtImpl(mockRPCProtocol); | ||
|
||
it('Should use sourceReference, path and sessionId', () => { |
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.
minor: consistency
it('Should use sourceReference, path and sessionId', () => { | |
it('should use sourceReference, path and sessionId', () => { |
import { DebugSession } from '@theia/plugin'; | ||
import * as chai from 'chai'; | ||
import { ProxyIdentifier, RPCProtocol } from '../../../common/rpc-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.
minor: remove extra newline.
|
||
const expect = chai.expect; | ||
|
||
describe('Debug source URI:', () => { |
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.
minor: in general we have a parent describe
that describes the file, then we have individual tests:
describe('Debug source URI:', () => { | |
describe('Debug API', () => { | |
describe('#asDebugSourceUri', () => { |
static SCHEME = 'debug'; | ||
static SCHEME_PATTERN = /^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/; |
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.
minor: move the static
members to the top of the class.
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.
It also appears that both the scheme and the pattern are already declared in debug-source.ts
as DebugSource.SCHEME
and DebugSource.SCHEME_PATTERN
. Would it be possible to reuse those declarations, perhaps by moving them to the common
area of the debug
package? In fact the SCHEME_PATTERN
should really be somewhere very generally accessible, since it isn't specific to debug at all.
@CamilleLetavernier, please ping me or Vince when this is ready for another review. |
2d060fb
to
56aef99
Compare
Hi @colin-grant-work, @vince-fugnitto, Thank you for your feedback. I've updated the pull request according to your comments. I also edited the PR description to include some testing steps. I've also pushed a new version of the small extension I used to print the breakpoints, to avoid installing the listeners multiple times. Unfortunately, for some reason, I can't get the Java Debugger to work in my local branch anymore; so I can't actually test the behavior of the debug session. I tried with Redhat Java 1.6 and 1.7 (And Java debug 0.40, 0.41), but I'm getting these errors when I start debugging:
|
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.
@CamilleLetavernier, would you mind rebasing. At the moment #11263 is preventing the execution of debug sessions with your code, but #11268 was merged this morning to fix it.
return new TheiaURI().withScheme(DEBUG_SCHEME).withPath(raw.path || '').withQuery(query); | ||
} | ||
if (!raw.path) { | ||
throw new Error('Unrecognized source type: ' + JSON.stringify(raw)); | ||
} | ||
if (raw.path.match(SCHEME_PATTERN)) { | ||
return new TheiaURI(raw.path); | ||
} | ||
return new TheiaURI(URI.file(raw.path)); | ||
} |
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.
Is there a reason to use the Theia URI implementation rather than VSCode-style URI's from the start 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.
I'm not sure. I have to say, I'm a bit confused with all the classes named "URI" delegating to each other, and are sometimes renamed during import :)
ef2ce1e
to
4e66bf9
Compare
The branch has been rebased (I've also squashed all commits, as the last rebase was a bit more complex). I've been able to run the debug plug-in/command with the current version of Theia, so it should all be good now |
@colin-grant-work Are you fine with merging this now? |
@JonasHelming, I'll take a look today |
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 behavior of the example plugin is compatible between Theia and VSCode 👍. Please see the suggestion for removing use of TheiaURI
.
Add "DebugProtocolSource" and "DebugProtocolEndpoint" to the plug-in API, as well as the methods using these interfaces: - DebugSession.getDebugProtocolBreakpoint() - debug.asDebugSourceUri() 10011: Fix asDebugSourceUri - Rename asDebugSourceURI to getDebugSourceUri to avoid name clash - Fix the way the debug source query is built - Add tests 10011: Minor code improvements - Improve test description to be consistent with other tests - Move the SCHEME and SCHEME_PATTERN constants to debug/common for reusability 10011: Rebase on master - Rebase on master and resolve conflicts Contributed on behalf of STMicroelectronics Signed-off-by: Camille Letavernier <[email protected]>
4e66bf9
to
611ab0a
Compare
Signed-off-by: Camille Letavernier [email protected]
What it does
Introduce new APIs for the Theia plug-in API: DebugProtocolBreakpoint, DebugProtocolSource, and related methods:
How to test
I've created a small test extension that just prints breakpoints on the console, after using the new APIs. It can be used to test the changes:
https://github.com/CamilleLetavernier/debug-protocol-extension/releases
To use it:
Test debug protocol
command to start observing breakpoints of the active debug sessionReview checklist
Reminder for reviewers
refs #10011