diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index a7e5613a477..13c9386353f 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -270,7 +270,7 @@ module ts.BreakpointResolver { : undefined; // Breakpoint is possible in variableDeclaration only if there is initialization - if (variableDeclaration.initializer) { + if (variableDeclaration.initializer || (variableDeclaration.flags & NodeFlags.Export)) { if (declarations && declarations[0] === variableDeclaration) { if (isParentVariableStatement) { // First declaration - include var keyword diff --git a/tests/baselines/reference/bpSpan_variables.baseline b/tests/baselines/reference/bpSpan_variables.baseline index 1dbb80512f5..1904c34b835 100644 --- a/tests/baselines/reference/bpSpan_variables.baseline +++ b/tests/baselines/reference/bpSpan_variables.baseline @@ -16,8 +16,75 @@ >:=> (line 3, col 0) to (line 3, col 10) -------------------------------- 4 >var c2, d2 = 10; + ~~~~~~~ => Pos: (37 to 43) SpanInfo: undefined 4 >var c2, d2 = 10; - ~~~~~~~~~ => Pos: (44 to 52) SpanInfo: {"start":45,"length":7} + + ~~~~~~~~~~ => Pos: (44 to 53) SpanInfo: {"start":45,"length":7} >d2 = 10 - >:=> (line 4, col 8) to (line 4, col 15) \ No newline at end of file + >:=> (line 4, col 8) to (line 4, col 15) +-------------------------------- +5 >module m { + + ~~~~~~~~~~~ => Pos: (54 to 64) SpanInfo: {"start":54,"length":146} + >module m { + > var x1; + > var x2 = 10, x3 = 10; + > var x4, x5; + > export var xx1; + > export var xx2 = 10, xx3 = 10; + > export var xx4, xx5; + >} + >:=> (line 5, col 0) to (line 12, col 1) +-------------------------------- +6 > var x1; + + ~~~~~~~~~~~~ => Pos: (65 to 76) SpanInfo: undefined +-------------------------------- +7 > var x2 = 10, x3 = 10; + + ~~~~~~~~~~~~~~~~ => Pos: (77 to 92) SpanInfo: {"start":81,"length":11} + >var x2 = 10 + >:=> (line 7, col 4) to (line 7, col 15) +7 > var x2 = 10, x3 = 10; + + ~~~~~~~~~~ => Pos: (93 to 102) SpanInfo: {"start":94,"length":7} + >x3 = 10 + >:=> (line 7, col 17) to (line 7, col 24) +-------------------------------- +8 > var x4, x5; + + ~~~~~~~~~~~~~~~~ => Pos: (103 to 118) SpanInfo: undefined +-------------------------------- +9 > export var xx1; + + ~~~~~~~~~~~~~~~~~~~~ => Pos: (119 to 138) SpanInfo: {"start":123,"length":14} + >export var xx1 + >:=> (line 9, col 4) to (line 9, col 18) +-------------------------------- +10 > export var xx2 = 10, xx3 = 10; + + ~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (139 to 162) SpanInfo: {"start":143,"length":19} + >export var xx2 = 10 + >:=> (line 10, col 4) to (line 10, col 23) +10 > export var xx2 = 10, xx3 = 10; + + ~~~~~~~~~~~ => Pos: (163 to 173) SpanInfo: {"start":164,"length":8} + >xx3 = 10 + >:=> (line 10, col 25) to (line 10, col 33) +-------------------------------- +11 > export var xx4, xx5; + + ~~~~~~~~~~~~~~~~~~~ => Pos: (174 to 192) SpanInfo: {"start":178,"length":14} + >export var xx4 + >:=> (line 11, col 4) to (line 11, col 18) +11 > export var xx4, xx5; + + ~~~~~~ => Pos: (193 to 198) SpanInfo: {"start":194,"length":3} + >xx5 + >:=> (line 11, col 20) to (line 11, col 23) +-------------------------------- +12 >} + ~ => Pos: (199 to 199) SpanInfo: {"start":199,"length":1} + >} + >:=> (line 12, col 0) to (line 12, col 1) \ No newline at end of file diff --git a/tests/cases/fourslash/breakpointValidationVariables.ts b/tests/cases/fourslash/breakpointValidationVariables.ts index 3f581ac80f7..054826e7e09 100644 --- a/tests/cases/fourslash/breakpointValidationVariables.ts +++ b/tests/cases/fourslash/breakpointValidationVariables.ts @@ -6,5 +6,13 @@ ////var b; ////var c = 10, d, e; ////var c2, d2 = 10; +////module m { +//// var x1; +//// var x2 = 10, x3 = 10; +//// var x4, x5; +//// export var xx1; +//// export var xx2 = 10, xx3 = 10; +//// export var xx4, xx5; +////} verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file