Setting breakpoint inside decorator expression results in setting breakpoint on all the decorators
On resolution, this would be call to __decorate
This commit is contained in:
parent
c84a9f154b
commit
858a99b4f1
|
@ -16,7 +16,7 @@ namespace ts.BreakpointResolver {
|
|||
|
||||
let tokenAtLocation = getTokenAtPosition(sourceFile, position);
|
||||
let lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line;
|
||||
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) {
|
||||
if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart(sourceFile)).line > lineOfPosition) {
|
||||
// Get previous token if the token is returned starts on new line
|
||||
// eg: let x =10; |--- cursor is here
|
||||
// let y = 10;
|
||||
|
@ -39,16 +39,20 @@ namespace ts.BreakpointResolver {
|
|||
return spanInNode(tokenAtLocation);
|
||||
|
||||
function textSpan(startNode: Node, endNode?: Node) {
|
||||
return createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd());
|
||||
return createTextSpanFromBounds(startNode.getStart(sourceFile), (endNode || startNode).getEnd());
|
||||
}
|
||||
|
||||
function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan {
|
||||
if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) {
|
||||
if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) {
|
||||
return spanInNode(node);
|
||||
}
|
||||
return spanInNode(otherwiseOnNode);
|
||||
}
|
||||
|
||||
function spanInNodeArray<T>(nodeArray: NodeArray<T>) {
|
||||
return createTextSpanFromBounds(skipTrivia(sourceFile.text, nodeArray.pos), nodeArray.end);
|
||||
}
|
||||
|
||||
function spanInPreviousNode(node: Node): TextSpan {
|
||||
return spanInNode(findPrecedingToken(node.pos, sourceFile));
|
||||
}
|
||||
|
@ -65,6 +69,11 @@ namespace ts.BreakpointResolver {
|
|||
return spanInPreviousNode(node);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.Decorator) {
|
||||
// Set breakpoint on the decorator emit
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ForStatement) {
|
||||
// For now lets set the span on this expression, fix it later
|
||||
return textSpan(node);
|
||||
|
@ -207,6 +216,9 @@ namespace ts.BreakpointResolver {
|
|||
// span in statement
|
||||
return spanInNode((<WithStatement>node).statement);
|
||||
|
||||
case SyntaxKind.Decorator:
|
||||
return spanInNodeArray(node.parent.decorators);
|
||||
|
||||
// No breakpoint in interface, type alias
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
--------------------------------
|
||||
8 >@ClassDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~ => Pos: (594 to 610) SpanInfo: {"start":594,"length":952}
|
||||
~ => Pos: (594 to 594) SpanInfo: {"start":594,"length":952}
|
||||
>@ClassDecorator1
|
||||
>@ClassDecorator2(10)
|
||||
>class Greeter {
|
||||
|
@ -78,63 +78,19 @@
|
|||
> }
|
||||
>}
|
||||
>:=> (line 8, col 0) to (line 54, col 1)
|
||||
8 >@ClassDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~ => Pos: (595 to 610) SpanInfo: {"start":595,"length":36}
|
||||
>ClassDecorator1
|
||||
>@ClassDecorator2(10)
|
||||
>:=> (line 8, col 1) to (line 9, col 20)
|
||||
--------------------------------
|
||||
9 >@ClassDecorator2(10)
|
||||
|
||||
~ => Pos: (611 to 611) SpanInfo: {"start":594,"length":952}
|
||||
>@ClassDecorator1
|
||||
~~~~~~~~~~~~~~~~~~~~~ => Pos: (611 to 631) SpanInfo: {"start":595,"length":36}
|
||||
>ClassDecorator1
|
||||
>@ClassDecorator2(10)
|
||||
>class Greeter {
|
||||
> constructor(
|
||||
> @ParameterDecorator1
|
||||
> @ParameterDecorator2(20)
|
||||
> public greeting: string,
|
||||
>
|
||||
> @ParameterDecorator1
|
||||
> @ParameterDecorator2(30)
|
||||
> ...b: string[]) {
|
||||
> }
|
||||
>
|
||||
> @PropertyDecorator1
|
||||
> @PropertyDecorator2(40)
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
>
|
||||
> @PropertyDecorator1
|
||||
> @PropertyDecorator2(50)
|
||||
> private x: string;
|
||||
>
|
||||
> @PropertyDecorator1
|
||||
> @PropertyDecorator2(60)
|
||||
> private static x1: number = 10;
|
||||
>
|
||||
> private fn(
|
||||
> @ParameterDecorator1
|
||||
> @ParameterDecorator2(70)
|
||||
> x: number) {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>
|
||||
> @PropertyDecorator1
|
||||
> @PropertyDecorator2(80)
|
||||
> get greetings() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>
|
||||
> set greetings(
|
||||
> @ParameterDecorator1
|
||||
> @ParameterDecorator2(90)
|
||||
> greetings: string) {
|
||||
> this.greeting = greetings;
|
||||
> }
|
||||
>}
|
||||
>:=> (line 8, col 0) to (line 54, col 1)
|
||||
9 >@ClassDecorator2(10)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (612 to 631) SpanInfo: {"start":612,"length":19}
|
||||
>ClassDecorator2(10)
|
||||
>:=> (line 9, col 1) to (line 9, col 20)
|
||||
>:=> (line 8, col 1) to (line 9, col 20)
|
||||
--------------------------------
|
||||
10 >class Greeter {
|
||||
|
||||
|
@ -196,24 +152,24 @@
|
|||
--------------------------------
|
||||
12 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (665 to 693) SpanInfo: {"start":673,"length":85}
|
||||
~~~~~~~~~ => Pos: (665 to 673) SpanInfo: {"start":673,"length":85}
|
||||
>@ParameterDecorator1
|
||||
> @ParameterDecorator2(20)
|
||||
> public greeting: string
|
||||
>:=> (line 12, col 8) to (line 14, col 31)
|
||||
12 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (674 to 693) SpanInfo: {"start":674,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(20)
|
||||
>:=> (line 12, col 9) to (line 13, col 32)
|
||||
--------------------------------
|
||||
13 > @ParameterDecorator2(20)
|
||||
|
||||
~~~~~~~~~ => Pos: (694 to 702) SpanInfo: {"start":673,"length":85}
|
||||
>@ParameterDecorator1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (694 to 726) SpanInfo: {"start":674,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(20)
|
||||
> public greeting: string
|
||||
>:=> (line 12, col 8) to (line 14, col 31)
|
||||
13 > @ParameterDecorator2(20)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (703 to 726) SpanInfo: {"start":703,"length":23}
|
||||
>ParameterDecorator2(20)
|
||||
>:=> (line 13, col 9) to (line 13, col 32)
|
||||
>:=> (line 12, col 9) to (line 13, col 32)
|
||||
--------------------------------
|
||||
14 > public greeting: string,
|
||||
|
||||
|
@ -229,24 +185,24 @@
|
|||
--------------------------------
|
||||
16 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (761 to 789) SpanInfo: {"start":769,"length":80}
|
||||
~~~~~~~~~ => Pos: (761 to 769) SpanInfo: {"start":769,"length":80}
|
||||
>@ParameterDecorator1
|
||||
> @ParameterDecorator2(30)
|
||||
> ...b: string[]
|
||||
>:=> (line 16, col 8) to (line 18, col 26)
|
||||
16 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (770 to 789) SpanInfo: {"start":770,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(30)
|
||||
>:=> (line 16, col 9) to (line 17, col 32)
|
||||
--------------------------------
|
||||
17 > @ParameterDecorator2(30)
|
||||
|
||||
~~~~~~~~~ => Pos: (790 to 798) SpanInfo: {"start":769,"length":80}
|
||||
>@ParameterDecorator1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (790 to 822) SpanInfo: {"start":770,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(30)
|
||||
> ...b: string[]
|
||||
>:=> (line 16, col 8) to (line 18, col 26)
|
||||
17 > @ParameterDecorator2(30)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (799 to 822) SpanInfo: {"start":799,"length":23}
|
||||
>ParameterDecorator2(30)
|
||||
>:=> (line 17, col 9) to (line 17, col 32)
|
||||
>:=> (line 16, col 9) to (line 17, col 32)
|
||||
--------------------------------
|
||||
18 > ...b: string[]) {
|
||||
|
||||
|
@ -273,28 +229,26 @@
|
|||
--------------------------------
|
||||
21 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (860 to 883) SpanInfo: {"start":864,"length":116}
|
||||
~~~~~ => Pos: (860 to 864) SpanInfo: {"start":864,"length":116}
|
||||
>@PropertyDecorator1
|
||||
> @PropertyDecorator2(40)
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
>:=> (line 21, col 4) to (line 25, col 5)
|
||||
21 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (865 to 883) SpanInfo: {"start":865,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(40)
|
||||
>:=> (line 21, col 5) to (line 22, col 27)
|
||||
--------------------------------
|
||||
22 > @PropertyDecorator2(40)
|
||||
|
||||
~~~~~ => Pos: (884 to 888) SpanInfo: {"start":864,"length":116}
|
||||
>@PropertyDecorator1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (884 to 911) SpanInfo: {"start":865,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(40)
|
||||
> greet() {
|
||||
> return "<h1>" + this.greeting + "</h1>";
|
||||
> }
|
||||
>:=> (line 21, col 4) to (line 25, col 5)
|
||||
22 > @PropertyDecorator2(40)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (889 to 911) SpanInfo: {"start":889,"length":22}
|
||||
>PropertyDecorator2(40)
|
||||
>:=> (line 22, col 5) to (line 22, col 27)
|
||||
>:=> (line 21, col 5) to (line 22, col 27)
|
||||
--------------------------------
|
||||
23 > greet() {
|
||||
|
||||
|
@ -329,16 +283,20 @@
|
|||
--------------------------------
|
||||
27 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (982 to 1005) SpanInfo: undefined
|
||||
~~~~~ => Pos: (982 to 986) SpanInfo: undefined
|
||||
27 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (987 to 1005) SpanInfo: {"start":987,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(50)
|
||||
>:=> (line 27, col 5) to (line 28, col 27)
|
||||
--------------------------------
|
||||
28 > @PropertyDecorator2(50)
|
||||
|
||||
~~~~~ => Pos: (1006 to 1010) SpanInfo: undefined
|
||||
28 > @PropertyDecorator2(50)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1011 to 1033) SpanInfo: {"start":1011,"length":22}
|
||||
>PropertyDecorator2(50)
|
||||
>:=> (line 28, col 5) to (line 28, col 27)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1006 to 1033) SpanInfo: {"start":987,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(50)
|
||||
>:=> (line 27, col 5) to (line 28, col 27)
|
||||
--------------------------------
|
||||
29 > private x: string;
|
||||
|
||||
|
@ -350,24 +308,24 @@
|
|||
--------------------------------
|
||||
31 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1058 to 1081) SpanInfo: {"start":1062,"length":83}
|
||||
~~~~~ => Pos: (1058 to 1062) SpanInfo: {"start":1062,"length":83}
|
||||
>@PropertyDecorator1
|
||||
> @PropertyDecorator2(60)
|
||||
> private static x1: number = 10;
|
||||
>:=> (line 31, col 4) to (line 33, col 35)
|
||||
31 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (1063 to 1081) SpanInfo: {"start":1063,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(60)
|
||||
>:=> (line 31, col 5) to (line 32, col 27)
|
||||
--------------------------------
|
||||
32 > @PropertyDecorator2(60)
|
||||
|
||||
~~~~~ => Pos: (1082 to 1086) SpanInfo: {"start":1062,"length":83}
|
||||
>@PropertyDecorator1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1082 to 1109) SpanInfo: {"start":1063,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(60)
|
||||
> private static x1: number = 10;
|
||||
>:=> (line 31, col 4) to (line 33, col 35)
|
||||
32 > @PropertyDecorator2(60)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1087 to 1109) SpanInfo: {"start":1087,"length":22}
|
||||
>PropertyDecorator2(60)
|
||||
>:=> (line 32, col 5) to (line 32, col 27)
|
||||
>:=> (line 31, col 5) to (line 32, col 27)
|
||||
--------------------------------
|
||||
33 > private static x1: number = 10;
|
||||
|
||||
|
@ -394,20 +352,22 @@
|
|||
--------------------------------
|
||||
36 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1163 to 1191) SpanInfo: {"start":1254,"length":20}
|
||||
~~~~~~~~~ => Pos: (1163 to 1171) SpanInfo: {"start":1254,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 39, col 8) to (line 39, col 28)
|
||||
36 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (1172 to 1191) SpanInfo: {"start":1172,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(70)
|
||||
>:=> (line 36, col 9) to (line 37, col 32)
|
||||
--------------------------------
|
||||
37 > @ParameterDecorator2(70)
|
||||
|
||||
~~~~~~~~~ => Pos: (1192 to 1200) SpanInfo: {"start":1254,"length":20}
|
||||
>return this.greeting
|
||||
>:=> (line 39, col 8) to (line 39, col 28)
|
||||
37 > @ParameterDecorator2(70)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1201 to 1224) SpanInfo: {"start":1201,"length":23}
|
||||
>ParameterDecorator2(70)
|
||||
>:=> (line 37, col 9) to (line 37, col 32)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1192 to 1224) SpanInfo: {"start":1172,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(70)
|
||||
>:=> (line 36, col 9) to (line 37, col 32)
|
||||
--------------------------------
|
||||
38 > x: number) {
|
||||
|
||||
|
@ -433,28 +393,26 @@
|
|||
--------------------------------
|
||||
42 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1283 to 1306) SpanInfo: {"start":1287,"length":105}
|
||||
~~~~~ => Pos: (1283 to 1287) SpanInfo: {"start":1287,"length":105}
|
||||
>@PropertyDecorator1
|
||||
> @PropertyDecorator2(80)
|
||||
> get greetings() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>:=> (line 42, col 4) to (line 46, col 5)
|
||||
42 > @PropertyDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~ => Pos: (1288 to 1306) SpanInfo: {"start":1288,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(80)
|
||||
>:=> (line 42, col 5) to (line 43, col 27)
|
||||
--------------------------------
|
||||
43 > @PropertyDecorator2(80)
|
||||
|
||||
~~~~~ => Pos: (1307 to 1311) SpanInfo: {"start":1287,"length":105}
|
||||
>@PropertyDecorator1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1307 to 1334) SpanInfo: {"start":1288,"length":46}
|
||||
>PropertyDecorator1
|
||||
> @PropertyDecorator2(80)
|
||||
> get greetings() {
|
||||
> return this.greeting;
|
||||
> }
|
||||
>:=> (line 42, col 4) to (line 46, col 5)
|
||||
43 > @PropertyDecorator2(80)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1312 to 1334) SpanInfo: {"start":1312,"length":22}
|
||||
>PropertyDecorator2(80)
|
||||
>:=> (line 43, col 5) to (line 43, col 27)
|
||||
>:=> (line 42, col 5) to (line 43, col 27)
|
||||
--------------------------------
|
||||
44 > get greetings() {
|
||||
|
||||
|
@ -500,20 +458,22 @@
|
|||
--------------------------------
|
||||
49 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1413 to 1441) SpanInfo: {"start":1512,"length":25}
|
||||
~~~~~~~~~ => Pos: (1413 to 1421) SpanInfo: {"start":1512,"length":25}
|
||||
>this.greeting = greetings
|
||||
>:=> (line 52, col 8) to (line 52, col 33)
|
||||
49 > @ParameterDecorator1
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~ => Pos: (1422 to 1441) SpanInfo: {"start":1422,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(90)
|
||||
>:=> (line 49, col 9) to (line 50, col 32)
|
||||
--------------------------------
|
||||
50 > @ParameterDecorator2(90)
|
||||
|
||||
~~~~~~~~~ => Pos: (1442 to 1450) SpanInfo: {"start":1512,"length":25}
|
||||
>this.greeting = greetings
|
||||
>:=> (line 52, col 8) to (line 52, col 33)
|
||||
50 > @ParameterDecorator2(90)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1451 to 1474) SpanInfo: {"start":1451,"length":23}
|
||||
>ParameterDecorator2(90)
|
||||
>:=> (line 50, col 9) to (line 50, col 32)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ => Pos: (1442 to 1474) SpanInfo: {"start":1422,"length":52}
|
||||
>ParameterDecorator1
|
||||
> @ParameterDecorator2(90)
|
||||
>:=> (line 49, col 9) to (line 50, col 32)
|
||||
--------------------------------
|
||||
51 > greetings: string) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue