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

Find the possible Breakpoints for a source line #72

Closed
weinand opened this issue Aug 15, 2019 · 5 comments
Closed

Find the possible Breakpoints for a source line #72

weinand opened this issue Aug 15, 2019 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality verified Verification succeeded

Comments

@weinand
Copy link
Contributor

weinand commented Aug 15, 2019

In order to provide visual hints for all possible breakpoint locations in a source line, a new request getPossibleBreakpoints is needed.

@weinand weinand added the feature-request Request for new features or functionality label Aug 15, 2019
@weinand weinand added this to the On Deck milestone Aug 15, 2019
@weinand weinand self-assigned this Aug 15, 2019
@dgozman
Copy link

dgozman commented Aug 29, 2019

I'd suggest to use a range (startLine, startColumn, endLine, endColumn) instead of just a line number:

  • allows some limited scope for long minified lines, otherwise it takes ages to compute all possible breakpoints
  • allows client to be smarter, e.g. show possible breakpoints for a function, or some code block.

@weinand
Copy link
Contributor Author

weinand commented Sep 11, 2019

A proposal:

A new BreakpointLocationsRequest request:

/** BreakpointLocations request; value of command field is 'breakpointLocations'.
	The 'breakpointLocations' request returns all possible locations for source breakpoints in a given range.
*/
export interface BreakpointLocationsRequest extends Request {
	// command: 'breakpointLocations';
	arguments?: BreakpointLocationsArguments;
}

/** Arguments for 'breakpointLocations' request. */
export interface BreakpointLocationsArguments {
	/** The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. */
	source: Source;
	/** Start line of range to search possible breakpoint locations in. If only the line is specified, the request returns all possible locations in that line. */
	line: number;
	/** Optional start column of range to search possible breakpoint locations in. If no start column is given, the first column in the start line is assumed. */
	column?: number;
	/** Optional end line of range to search possible breakpoint locations in. If no end line is given, then the end line is assumed to be the start line. */
	endLine?: number;
	/** Optional end column of range to search possible breakpoint locations in. If no end column is given, then it is assumed to be in the last column of the end line. */
	endColumn?: number;
}

/** Response to 'breakpointLocations' request.
	Contains possible locations for source breakpoints.
*/
export interface BreakpointLocationsResponse extends Response {
	body: {
		/** Sorted set of possible breakpoint locations. */
		breakpoints: BreakpointLocation[];
	};
}

Returns an array of BreakpointLocations:

/** Properties of a breakpoint location returned from the 'breakpointLocations' request. */
export interface BreakpointLocation {
	/** Start line of breakpoint location. */
	line: number;
	/** Optional start column of breakpoint location. */
	column?: number;
	/** Optional end line of breakpoint location if the location covers a range. */
	endLine?: number;
	/** Optional end column of breakpoint location if the location covers a range. */
	endColumn?: number;
}

And the corresponding capability:

/** Information about the capabilities of a debug adapter. */
export interface Capabilities {

	// ...

	/** The debug adapter supports the 'breakpointLocations' request. */
	supportsBreakpointLocationsRequest?: boolean;
}

/cc @dgozman @andrewcrawley @gregg-miskelly @int19h please let us know what you think.

@weinand weinand modified the milestones: On Deck, September 2019 Sep 11, 2019
@gregg-miskelly
Copy link
Member

The one weird part about adding this is that, since it is a debug protocol request, anything you do with it will only be available while debugging and not at design time. So it might make more sense as a language service feature. But aside from that, this looks good to me.

@weinand
Copy link
Contributor Author

weinand commented Sep 12, 2019

Yes, the scope of DAP is runtime not design time.

But at least for JS/Node runtimes column breakpoint information would not be available through a language service either since it depends on transpilation and runtime versions.

@gregg-miskelly
Copy link
Member

Makes sense. I would suspect for most languages this would not be the case. But I can see how JavaScript would be different.

@weinand weinand closed this as completed Sep 19, 2019
@isidorn isidorn added the verified Verification succeeded label Oct 2, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants