-
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
Add jump to cursor #14594
base: master
Are you sure you want to change the base?
Add jump to cursor #14594
Conversation
Extend context menu of editor with jump to cursor option. Extend context menu of editor margin with jump to cursor option. The option is visible only during the debugging session and if the debug adapter supports this. Fixes issue eclipse-theia#14500 Signed-off-by: Nandish Mahadevaiah <nandish.mahadevaiah@mvtec.com>
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.
Thank you @mahadevaiahn for this contribution!
This already looks quite good, I just have a few suggestions to improve on this.
export const JUMP_TO_CURSOR = Command.toDefaultLocalizedCommand({ | ||
id: 'editor.debug.action.jumpToCursor', | ||
label: 'Debug: Jump to Cursor' | ||
}); |
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.
Suggestion: We usually split the label from the category. I'm not sure why this isn't done for the SHOW_HOVER
command.
export const JUMP_TO_CURSOR = Command.toDefaultLocalizedCommand({ | |
id: 'editor.debug.action.jumpToCursor', | |
label: 'Debug: Jump to Cursor' | |
}); | |
export const JUMP_TO_CURSOR = Command.toDefaultLocalizedCommand({ | |
id: 'editor.debug.action.jumpToCursor', | |
category: DEBUG_CATEGORY, | |
label: 'Jump to Cursor' | |
}); |
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.
done
const response: DebugProtocol.GotoTargetsResponse = await this.session.sendRequest('gotoTargets', { source, line: position.lineNumber, column: position.column }); | ||
|
||
if (response && response.body.targets.length === 0) { | ||
throw new Error('Unable to perform Jump to Cursor as there were no targets'); |
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.
Suggestion: This error should likely not be thrown, but instead result in undefined and a warning in the notifications service. See the original implementation in vscode.
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.
done
if (response && response.body.targets.length === 0) { | ||
throw new Error('Unable to perform Jump to Cursor as there were no targets'); | ||
} | ||
const targetId = response.body.targets[0].id; |
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.
Suggestion: It would be great if you could implement a "choose the location" quick pick like it's done in vscode in case there are multiple targets.
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.
Hi @msujew , many thanks for your review, I could not find a debugger which supported multiple targets, as I could not test this feature, I decided not to implement the QuickInputService.pick 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.
Formatting: Please remove the added lines here, they will lead to linting errors.
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.
done
…ew changes. Signed-off-by: nandish mahadevaiah <nandish.mahadevaiah@mvtec.com>
Signed-off-by: nandish mahadevaiah <nandish.mahadevaiah@mvtec.com>
What it does
Extend context menu of editor with jump to cursor option. Extend context menu of editor margin with jump to cursor option. The option is visible only during the debugging session and if the debug adapter supports this.
Fixes issue #14500
How to test
a=1
b=2
c=3
d=4
Follow-ups
Breaking changes
Attribution
Contributed by MVTec Software GmbH
Review checklist
Reminder for reviewers