Skip to content

Commit d495200

Browse files
authored
fix(54366): bug: getCodeFixesAtPosition fails when TS2339 diagnostic paired with large pojo; Debug Failure. False expression: Token end is child end (#54432)
1 parent fec0bd3 commit d495200

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed

src/services/codefixes/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export function createSignatureDeclarationFromCallExpression(
481481
isIdentifier(arg) ? arg.text : isPropertyAccessExpression(arg) && isIdentifier(arg.name) ? arg.name.text : undefined);
482482
const instanceTypes = isJs ? [] : map(args, arg => checker.getTypeAtLocation(arg));
483483
const { argumentTypeNodes, argumentTypeParameters } = getArgumentTypesAndTypeParameters(
484-
checker, importAdder, instanceTypes, contextNode, scriptTarget, /*flags*/ undefined, tracker
484+
checker, importAdder, instanceTypes, contextNode, scriptTarget, NodeBuilderFlags.NoTruncation, tracker
485485
);
486486

487487
const modifiers = modifierFlags
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////foo({
4+
//// prop001: '',
5+
//// prop002: '',
6+
//// prop003: '',
7+
//// prop004: '',
8+
//// prop005: '',
9+
//// prop006: '',
10+
//// prop007: '',
11+
//// prop008: '',
12+
//// prop009: '',
13+
//// prop010: '',
14+
//// prop011: '',
15+
//// prop012: '',
16+
//// prop013: '',
17+
//// prop014: '',
18+
//// prop015: '',
19+
//// prop016: '',
20+
//// prop017: '',
21+
//// prop018: '',
22+
//// prop019: '',
23+
//// prop020: '',
24+
////});
25+
26+
verify.codeFix({
27+
description: [ts.Diagnostics.Add_missing_function_declaration_0.message, "foo"],
28+
index: 0,
29+
newFileContent:
30+
`foo({
31+
prop001: '',
32+
prop002: '',
33+
prop003: '',
34+
prop004: '',
35+
prop005: '',
36+
prop006: '',
37+
prop007: '',
38+
prop008: '',
39+
prop009: '',
40+
prop010: '',
41+
prop011: '',
42+
prop012: '',
43+
prop013: '',
44+
prop014: '',
45+
prop015: '',
46+
prop016: '',
47+
prop017: '',
48+
prop018: '',
49+
prop019: '',
50+
prop020: '',
51+
});
52+
53+
function foo(arg0: { prop001: string; prop002: string; prop003: string; prop004: string; prop005: string; prop006: string; prop007: string; prop008: string; prop009: string; prop010: string; prop011: string; prop012: string; prop013: string; prop014: string; prop015: string; prop016: string; prop017: string; prop018: string; prop019: string; prop020: string; }) {
54+
throw new Error("Function not implemented.");
55+
}
56+
`,
57+
});
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
////class C {
4+
//// constructor() {
5+
//// this.foo({
6+
//// 'foo.a': '',
7+
//// 'foo.b': '',
8+
//// 'foo.c': '',
9+
//// 'foo.d': '',
10+
//// 'foo.e': '',
11+
//// 'foo.f': '',
12+
//// 'foo.g': '',
13+
//// 'foo.h': '',
14+
//// 'foo.i': '',
15+
//// 'foo.j': '',
16+
//// 'foo.k': '',
17+
//// 'foo.l': '',
18+
//// 'foo.m': '',
19+
//// 'foo.n': '',
20+
//// 'foo.o': '',
21+
//// 'foo.p': '',
22+
//// 'foo.q': '',
23+
//// 'foo.r': '',
24+
//// 'foo.s': '',
25+
//// 'foo.t': '',
26+
//// 'foo.u': '',
27+
//// 'foo.v': '',
28+
//// 'foo.w': '',
29+
//// 'foo.x': '',
30+
//// 'foo.y': '',
31+
//// 'foo.z': '',
32+
//// });
33+
//// }
34+
////}
35+
36+
verify.codeFix({
37+
description: [ts.Diagnostics.Declare_method_0.message, "foo"],
38+
index: 0,
39+
newFileContent:
40+
`class C {
41+
constructor() {
42+
this.foo({
43+
'foo.a': '',
44+
'foo.b': '',
45+
'foo.c': '',
46+
'foo.d': '',
47+
'foo.e': '',
48+
'foo.f': '',
49+
'foo.g': '',
50+
'foo.h': '',
51+
'foo.i': '',
52+
'foo.j': '',
53+
'foo.k': '',
54+
'foo.l': '',
55+
'foo.m': '',
56+
'foo.n': '',
57+
'foo.o': '',
58+
'foo.p': '',
59+
'foo.q': '',
60+
'foo.r': '',
61+
'foo.s': '',
62+
'foo.t': '',
63+
'foo.u': '',
64+
'foo.v': '',
65+
'foo.w': '',
66+
'foo.x': '',
67+
'foo.y': '',
68+
'foo.z': '',
69+
});
70+
}
71+
foo(arg0: { 'foo.a': string; 'foo.b': string; 'foo.c': string; 'foo.d': string; 'foo.e': string; 'foo.f': string; 'foo.g': string; 'foo.h': string; 'foo.i': string; 'foo.j': string; 'foo.k': string; 'foo.l': string; 'foo.m': string; 'foo.n': string; 'foo.o': string; 'foo.p': string; 'foo.q': string; 'foo.r': string; 'foo.s': string; 'foo.t': string; 'foo.u': string; 'foo.v': string; 'foo.w': string; 'foo.x': string; 'foo.y': string; 'foo.z': string; }) {
72+
throw new Error("Method not implemented.");
73+
}
74+
}`,
75+
});

0 commit comments

Comments
 (0)