-
Notifications
You must be signed in to change notification settings - Fork 29.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
Implement Go To Next/Previous Breakpoint editor actions #50285
Implement Go To Next/Previous Breakpoint editor actions #50285
Conversation
|
||
public run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise<void, any> { | ||
const debugService = accessor.get(IDebugService); | ||
const editorService = accessor.get(IEditorService); |
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.
editor Model
can be null
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's not really checked in any other place in the file ;-)
const currentLine = editor.getPosition().lineNumber; | ||
const allEnabledBreakpoints = | ||
debugService.getModel().getBreakpoints() | ||
.filter(bp => bp.enabled) |
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.
Instead of doing a .filter on top, please pass a "enabledOnly: true" to the getBreakpoints
} | ||
|
||
if (moveBreakpoint) { | ||
const selection = new Selection(moveBreakpoint.lineNumber, moveBreakpoint.column || 0, moveBreakpoint.lineNumber, moveBreakpoint.column || 0); |
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.
Use openBreakpointSource
instead
debugService.getModel().getBreakpoints() | ||
.filter(bp => bp.enabled) | ||
.sort((a, b) => { | ||
if (this.isNext) { |
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.
Can we do this in twice as less lines? seems like a lot of code is duplicated in the next 20 lines?
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 sorting is unnecessary in the end since debugModel is responsible for sorting its own breakpoints - https://github.com/Microsoft/vscode/blob/cdd8256102433bf52c2f5b05aea312775a34a669/src/vs/workbench/parts/debug/common/debugModel.ts#L1003-L1015
@Krzysztof-Cieslak thanks a lot for your PR. I have commented directly in the file. |
You seem to have rebased instead of merge. I suggest to create a new branch to cleanup the mess. |
I've figured out my small problems with git, I think it's more or less ready ;-) |
@Krzysztof-Cieslak thanks a lot, this looks great. Merged it in 🍻 |
Fix #31806
CC: @isidorn