@@ -261,9 +261,12 @@ namespace ts.BreakpointResolver {
261
261
}
262
262
263
263
// Set breakpoint on identifier element of destructuring pattern
264
- // a or ...c from
265
- // [a, b, ...c] or { a, b } from destructuring pattern
266
- if ( ( node . kind === SyntaxKind . Identifier || node . kind == SyntaxKind . SpreadElementExpression ) &&
264
+ // a or ...c or d: x from
265
+ // [a, b, ...c] or { a, b } or { d: x } from destructuring pattern
266
+ if ( ( node . kind === SyntaxKind . Identifier ||
267
+ node . kind == SyntaxKind . SpreadElementExpression ||
268
+ node . kind === SyntaxKind . PropertyAssignment ||
269
+ node . kind === SyntaxKind . ShorthandPropertyAssignment ) &&
267
270
isArrayLiteralOrObjectLiteralDestructuringPattern ( node . parent ) ) {
268
271
return textSpan ( node ) ;
269
272
}
@@ -322,12 +325,14 @@ namespace ts.BreakpointResolver {
322
325
break ;
323
326
}
324
327
}
325
-
328
+
326
329
// If this is name of property assignment, set breakpoint in the initializer
327
- if ( node . parent . kind === SyntaxKind . PropertyAssignment && ( < PropertyDeclaration > node . parent ) . name === node ) {
330
+ if ( node . parent . kind === SyntaxKind . PropertyAssignment &&
331
+ ( < PropertyDeclaration > node . parent ) . name === node &&
332
+ ! isArrayLiteralOrObjectLiteralDestructuringPattern ( node . parent . parent ) ) {
328
333
return spanInNode ( ( < PropertyDeclaration > node . parent ) . initializer ) ;
329
334
}
330
-
335
+
331
336
// Breakpoint in type assertion goes to its operand
332
337
if ( node . parent . kind === SyntaxKind . TypeAssertionExpression && ( < TypeAssertion > node . parent ) . type === node ) {
333
338
return spanInNextNode ( ( < TypeAssertion > node . parent ) . type ) ;
@@ -609,6 +614,11 @@ namespace ts.BreakpointResolver {
609
614
610
615
// Default to parent node
611
616
default :
617
+ if ( isArrayLiteralOrObjectLiteralDestructuringPattern ( node . parent ) ) {
618
+ // Breakpoint in last binding element or binding pattern if it contains no elements
619
+ let objectLiteral = < ObjectLiteralExpression > node . parent ;
620
+ return textSpan ( lastOrUndefined ( objectLiteral . properties ) || objectLiteral ) ;
621
+ }
612
622
return spanInNode ( node . parent ) ;
613
623
}
614
624
}
0 commit comments