diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index a5489b670c1..c5b7dd5a150 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -122,6 +122,9 @@ module ts.BreakpointResolver { case SyntaxKind.ExportAssignment: return spanInExportAssignment(node); + case SyntaxKind.ImportDeclaration: + return spanInImportDeclaration(node); + case SyntaxKind.BinaryExpression: case SyntaxKind.PostfixOperator: case SyntaxKind.PrefixOperator: @@ -358,6 +361,10 @@ module ts.BreakpointResolver { return textSpan(exportAssignment, exportAssignment.exportName); } + function spanInImportDeclaration(importDeclaration: ImportDeclaration): TypeScript.TextSpan { + return textSpan(importDeclaration, importDeclaration.entityName || importDeclaration.externalModuleName); + } + function spanInExpression(expression: Expression): TypeScript.TextSpan { //TODO (pick this up later) for now lets fix do-while baseline if (node.parent.kind === SyntaxKind.DoStatement) { // Set span as if on while keyword diff --git a/tests/baselines/reference/bpSpan_import.baseline b/tests/baselines/reference/bpSpan_import.baseline new file mode 100644 index 00000000000..5548368fa76 --- /dev/null +++ b/tests/baselines/reference/bpSpan_import.baseline @@ -0,0 +1,39 @@ + +1 >module m { + + ~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: undefined +-------------------------------- +2 > class c { + + ~~~~~~~~~~~~~~ => Pos: (11 to 24) SpanInfo: undefined +-------------------------------- +3 > } + + ~~~~~~ => Pos: (25 to 30) SpanInfo: undefined +-------------------------------- +4 >} + + ~~ => Pos: (31 to 32) SpanInfo: undefined +-------------------------------- +5 >import a = m.c; + + ~~~~~~~~~~~~~~~~ => Pos: (33 to 48) SpanInfo: {"start":33,"length":14} + >import a = m.c + >:=> (line 5, col 0) to (line 5, col 14) +-------------------------------- +6 >export import b = m.c; + + ~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (49 to 71) SpanInfo: {"start":49,"length":21} + >export import b = m.c + >:=> (line 6, col 0) to (line 6, col 21) +-------------------------------- +7 >var x = new a(); + + ~~~~~~~~~~~~~~~~~ => Pos: (72 to 88) SpanInfo: {"start":72,"length":15} + >var x = new a() + >:=> (line 7, col 0) to (line 7, col 15) +-------------------------------- +8 >var y = new b(); + ~~~~~~~~~~~~~~~~ => Pos: (89 to 104) SpanInfo: {"start":89,"length":15} + >var y = new b() + >:=> (line 8, col 0) to (line 8, col 15) \ No newline at end of file diff --git a/tests/cases/fourslash_old/breakpointValidationImport.ts b/tests/cases/fourslash/breakpointValidationImport.ts similarity index 100% rename from tests/cases/fourslash_old/breakpointValidationImport.ts rename to tests/cases/fourslash/breakpointValidationImport.ts