Skip to content

Commit d235caf

Browse files
committed
Breakpoints in import declaration
1 parent 2905217 commit d235caf

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

src/services/breakpoints.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ module ts.BreakpointResolver {
122122
case SyntaxKind.ExportAssignment:
123123
return spanInExportAssignment(<ExportAssignment>node);
124124

125+
case SyntaxKind.ImportDeclaration:
126+
return spanInImportDeclaration(<ImportDeclaration>node);
127+
125128
case SyntaxKind.BinaryExpression:
126129
case SyntaxKind.PostfixOperator:
127130
case SyntaxKind.PrefixOperator:
@@ -358,6 +361,10 @@ module ts.BreakpointResolver {
358361
return textSpan(exportAssignment, exportAssignment.exportName);
359362
}
360363

364+
function spanInImportDeclaration(importDeclaration: ImportDeclaration): TypeScript.TextSpan {
365+
return textSpan(importDeclaration, importDeclaration.entityName || importDeclaration.externalModuleName);
366+
}
367+
361368
function spanInExpression(expression: Expression): TypeScript.TextSpan {
362369
//TODO (pick this up later) for now lets fix do-while baseline if (node.parent.kind === SyntaxKind.DoStatement) {
363370
// Set span as if on while keyword
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
1 >module m {
3+
4+
~~~~~~~~~~~ => Pos: (0 to 10) SpanInfo: undefined
5+
--------------------------------
6+
2 > class c {
7+
8+
~~~~~~~~~~~~~~ => Pos: (11 to 24) SpanInfo: undefined
9+
--------------------------------
10+
3 > }
11+
12+
~~~~~~ => Pos: (25 to 30) SpanInfo: undefined
13+
--------------------------------
14+
4 >}
15+
16+
~~ => Pos: (31 to 32) SpanInfo: undefined
17+
--------------------------------
18+
5 >import a = m.c;
19+
20+
~~~~~~~~~~~~~~~~ => Pos: (33 to 48) SpanInfo: {"start":33,"length":14}
21+
>import a = m.c
22+
>:=> (line 5, col 0) to (line 5, col 14)
23+
--------------------------------
24+
6 >export import b = m.c;
25+
26+
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (49 to 71) SpanInfo: {"start":49,"length":21}
27+
>export import b = m.c
28+
>:=> (line 6, col 0) to (line 6, col 21)
29+
--------------------------------
30+
7 >var x = new a();
31+
32+
~~~~~~~~~~~~~~~~~ => Pos: (72 to 88) SpanInfo: {"start":72,"length":15}
33+
>var x = new a()
34+
>:=> (line 7, col 0) to (line 7, col 15)
35+
--------------------------------
36+
8 >var y = new b();
37+
~~~~~~~~~~~~~~~~ => Pos: (89 to 104) SpanInfo: {"start":89,"length":15}
38+
>var y = new b()
39+
>:=> (line 8, col 0) to (line 8, col 15)

0 commit comments

Comments
 (0)