Skip to content
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

Merged
merged 4 commits into from May 28, 2018
Merged

Implement Go To Next/Previous Breakpoint editor actions #50285

merged 4 commits into from May 28, 2018

Conversation

Krzysztof-Cieslak
Copy link
Contributor

Fix #31806

CC: @isidorn

@weinand weinand added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues labels May 22, 2018

public run(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise<void, any> {
const debugService = accessor.get(IDebugService);
const editorService = accessor.get(IEditorService);
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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);
Copy link
Contributor

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

@isidorn
Copy link
Contributor

isidorn commented May 28, 2018

@Krzysztof-Cieslak thanks a lot for your PR. I have commented directly in the file.
Once you address those changes we can merge this in. Thanks!

@isidorn
Copy link
Contributor

isidorn commented May 28, 2018

You seem to have rebased instead of merge. I suggest to create a new branch to cleanup the mess.

@Krzysztof-Cieslak
Copy link
Contributor Author

I've figured out my small problems with git, I think it's more or less ready ;-)

@isidorn isidorn merged commit 9bada78 into microsoft:master May 28, 2018
@isidorn
Copy link
Contributor

isidorn commented May 28, 2018

@Krzysztof-Cieslak thanks a lot, this looks great. Merged it in 🍻

@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Go to next/previous breakpoint
3 participants