Skip to content

Commit 71e96be

Browse files
committed
Breakpoint span in the debugger statement
1 parent a047d20 commit 71e96be

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/services/breakpoints.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ module ts.BreakpointResolver {
8080
case SyntaxKind.DoStatement:
8181
return spanInDoStatement(<DoStatement>node);
8282

83+
case SyntaxKind.DebuggerStatement:
84+
return spanInDebuggerStatement(node);
85+
8386
// Tokens:
8487
case SyntaxKind.SemicolonToken:
8588
case SyntaxKind.EndOfFileToken:
@@ -235,6 +238,11 @@ module ts.BreakpointResolver {
235238
return spanInNode(doStatement.statement);
236239
}
237240

241+
function spanInDebuggerStatement(node: Node): TypeScript.TextSpan {
242+
// Set breakpoint on debugger keyword
243+
return textSpan(node.getChildAt(0, sourceFile));
244+
}
245+
238246
// Tokens:
239247
function spanInCommaToken(node: Node): TypeScript.TextSpan {
240248
switch (node.parent.kind) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
1 >debugger;
3+
~~~~~~~~~ => Pos: (0 to 8) SpanInfo: {"start":0,"length":8}
4+
>debugger
5+
>:=> (line 1, col 0) to (line 1, col 8)

tests/cases/fourslash_old/breakpointValidationDebugger.ts renamed to tests/cases/fourslash/breakpointValidationDebugger.ts

File renamed without changes.

0 commit comments

Comments
 (0)