Skip to content

Commit bc4057a

Browse files
committed
breakpoint support for new import/export syntax
1 parent 951f7cf commit bc4057a

5 files changed

Lines changed: 82 additions & 1 deletion

File tree

src/services/breakpoints.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,15 @@ module ts.BreakpointResolver {
178178

179179
case SyntaxKind.ImportEqualsDeclaration:
180180
// import statement without including semicolon
181-
return textSpan(node,(<ImportEqualsDeclaration>node).moduleReference);
181+
return textSpan(node, (<ImportEqualsDeclaration>node).moduleReference);
182+
183+
case SyntaxKind.ImportDeclaration:
184+
// import statement without including semicolon
185+
return textSpan(node, (<ImportDeclaration>node).moduleSpecifier);
186+
187+
case SyntaxKind.ExportDeclaration:
188+
// import statement without including semicolon
189+
return textSpan(node, (<ExportDeclaration>node).moduleSpecifier);
182190

183191
case SyntaxKind.ModuleDeclaration:
184192
// span on complete module if it is instantiated
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
1 >export * from "a";
3+
4+
~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 18) SpanInfo: {"start":0,"length":17}
5+
>export * from "a"
6+
>:=> (line 1, col 0) to (line 1, col 17)
7+
--------------------------------
8+
2 >export {a as A} from "a";
9+
10+
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (19 to 44) SpanInfo: {"start":19,"length":24}
11+
>export {a as A} from "a"
12+
>:=> (line 2, col 0) to (line 2, col 24)
13+
--------------------------------
14+
3 >export import e = require("a");
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (45 to 75) SpanInfo: {"start":45,"length":30}
16+
>export import e = require("a")
17+
>:=> (line 3, col 0) to (line 3, col 30)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
1 >import * as NS from "a";
3+
4+
~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (0 to 24) SpanInfo: {"start":0,"length":23}
5+
>import * as NS from "a"
6+
>:=> (line 1, col 0) to (line 1, col 23)
7+
--------------------------------
8+
2 >import {a as A} from "a";
9+
10+
~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (25 to 50) SpanInfo: {"start":25,"length":24}
11+
>import {a as A} from "a"
12+
>:=> (line 2, col 0) to (line 2, col 24)
13+
--------------------------------
14+
3 > import d from "a";
15+
16+
~~~~~~~~~~~~~~~~~~~~ => Pos: (51 to 70) SpanInfo: {"start":52,"length":17}
17+
>import d from "a"
18+
>:=> (line 3, col 1) to (line 3, col 18)
19+
--------------------------------
20+
4 >import d2, {c, d as D} from "a";
21+
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (71 to 103) SpanInfo: {"start":71,"length":31}
23+
>import d2, {c, d as D} from "a"
24+
>:=> (line 4, col 0) to (line 4, col 31)
25+
--------------------------------
26+
5 >import "a";
27+
28+
~~~~~~~~~~~~ => Pos: (104 to 115) SpanInfo: {"start":104,"length":10}
29+
>import "a"
30+
>:=> (line 5, col 0) to (line 5, col 10)
31+
--------------------------------
32+
6 >import e = require("a");
33+
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (116 to 139) SpanInfo: {"start":116,"length":23}
34+
>import e = require("a")
35+
>:=> (line 6, col 0) to (line 6, col 23)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @BaselineFile: bpSpan_exports.baseline
4+
// @Filename: bpSpan_exports.ts
5+
////export * from "a";
6+
////export {a as A} from "a";
7+
////export import e = require("a");
8+
9+
verify.baselineCurrentFileBreakpointLocations();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @BaselineFile: bpSpan_imports.baseline
4+
// @Filename: bpSpan_imports.ts
5+
////import * as NS from "a";
6+
////import {a as A} from "a";
7+
//// import d from "a";
8+
////import d2, {c, d as D} from "a";
9+
////import "a";
10+
////import e = require("a");
11+
12+
verify.baselineCurrentFileBreakpointLocations();

0 commit comments

Comments
 (0)