Skip to content

getEditsForRefactor debug failure in js file #18671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mjbvz opened this issue Sep 21, 2017 · 4 comments
Closed

getEditsForRefactor debug failure in js file #18671

mjbvz opened this issue Sep 21, 2017 · 4 comments
Labels
Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Sep 21, 2017

TypeScript Version: 2.5.3-insiders

Code
While investigating #18328

For the JavaScript file:

class Foo {
  constructor(x) {
    this.x = x;
  }

  z() {
    console.log('1')
  }

}

Try to extract the line console.log('1').

After fixing #18328, we will now try to send the formatting options to TypeScript before requesting the refactoring edits. This change is not checked into VSCode yet because it causes the failure below

Bug

This results in a debug failure. Here's the complete log

[Info  - 3:38:49 PM] Using tsserver from: /Users/matb/projects/vscode/extensions/node_modules/typescript/lib
[Info  - 3:38:49 PM] TSServer log file: /var/folders/_0/611900jn0yb43f1rc47_2wmh0000gp/T/vscode-tsserver-log-LHRW22/tsserver.log
[Info  - 3:38:49 PM] Forking TSServer
PATH: /usr/local/opt/opencv3/bin:/Users/matb/.nvm/versions/node/v7.6.0/bin:/Users/matb/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/dotnet
[Trace  - 3:38:49 PM] Sending request: configure (0). Response expected: yes. Current queue length: 0
Arguments: {
    "hostInfo": "vscode"
}
[Trace  - 3:38:50 PM] Response received: configure (0). Request took 280 ms. Success: true 
[Trace  - 3:38:50 PM] Sending request: compilerOptionsForInferredProjects (1). Response expected: yes. Current queue length: 3
Arguments: {
    "options": {
        "module": "CommonJS",
        "target": "ES6",
        "allowSyntheticDefaultImports": true,
        "allowNonTsExtensions": true,
        "allowJs": true,
        "jsx": "Preserve",
        "checkJs": false
    }
}
[Trace  - 3:38:50 PM] Response received: compilerOptionsForInferredProjects (1). Request took 279 ms. Success: true 
Result: true
[Trace  - 3:38:50 PM] Sending request: open (2). Response expected: no. Current queue length: 2
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "fileContent": "class Foo {\n  constructor(x) {\n    this.x = x;\n  }\n\n  z() {\n    console.log('1')\n  }\n\n}\n\n\nnew Foo(1)",
    "scriptKindName": "JS",
    "projectRootPath": "/Users/matb/projects/san"
}
[Trace  - 3:38:50 PM] Sending request: getSupportedCodeFixes (3). Response expected: yes. Current queue length: 1
[Trace  - 3:38:50 PM] TypeScript Service: canceled request with sequence number 5
[Trace  - 3:38:50 PM] Event received: configFileDiag (0).
Data: {
    "triggerFile": "/Users/matb/projects/san/y.js",
    "diagnostics": []
}
[Trace  - 3:38:50 PM] Response received: getSupportedCodeFixes (3). Request took 694 ms. Success: true 
Result: [
    "1002",
    "1003",
    "1005",
    "1006",
    "1009",
    "1010",
    "1012",
    "1014",
    "1015",
    "1016",
    "1017",
    "1018",
    "1019",
    "1020",
    "1021",
    "1022",
    "1023",
    "1024",
    "1028",
    "1029",
    "1030",
    "1031",
    "1034",
    "1035",
    "1036",
    "1038",
    "1039",
    "1040",
    "1041",
    "1042",
    "1043",
    "1044",
    "1045",
    "1046",
    "1047",
    "1048",
    "1049",
    "1051",
    "1052",
    "1053",
    "1054",
    "1055",
    "1056",
    "1057",
    "1058",
    "1059",
    "1060",
    "1061",
    "1062",
    "1063",
    "1064",
    "1066",
    "1068",
    "1070",
    "1071",
    "1079",
    "1084",
    "1085",
    "1086",
    "1089",
    "1090",
    "1091",
    "1092",
    "1093",
    "1094",
    "1095",
    "1096",
    "1097",
    "1098",
    "1099",
    "1100",
    "1101",
    "1102",
    "1103",
    "1104",
    "1105",
    "1107",
    "1108",
    "1109",
    "1110",
    "1113",
    "1114",
    "1115",
    "1116",
    "1117",
    "1118",
    "1119",
    "1120",
    "1121",
    "1122",
    "1123",
    "1124",
    "1125",
    "1126",
    "1127",
    "1128",
    "1129",
    "1130",
    "1131",
    "1132",
    "1134",
    "1135",
    "1136",
    "1137",
    "1138",
    "1139",
    "1140",
    "1141",
    "1142",
    "1144",
    "1146",
    "1147",
    "1148",
    "1149",
    "1150",
    "1155",
    "1156",
    "1157",
    "1160",
    "1161",
    "1162",
    "1163",
    "1164",
    "1165",
    "1166",
    "1168",
    "1169",
    "1170",
    "1171",
    "1172",
    "1173",
    "1174",
    "1175",
    "1176",
    "1177",
    "1178",
    "1179",
    "1180",
    "1181",
    "1182",
    "1183",
    "1184",
    "1185",
    "1186",
    "1187",
    "1188",
    "1189",
    "1190",
    "1191",
    "1192",
    "1193",
    "1194",
    "1196",
    "1197",
    "1198",
    "1199",
    "1200",
    "1202",
    "1203",
    "1205",
    "1206",
    "1207",
    "1208",
    "1209",
    "1210",
    "1211",
    "1212",
    "1213",
    "1214",
    "1215",
    "1216",
    "1218",
    "1219",
    "1220",
    "1221",
    "1222",
    "1223",
    "1224",
    "1225",
    "1226",
    "1227",
    "1228",
    "1229",
    "1230",
    "1231",
    "1232",
    "1233",
    "1234",
    "1235",
    "1236",
    "1237",
    "1238",
    "1239",
    "1240",
    "1241",
    "1242",
    "1243",
    "1244",
    "1245",
    "1246",
    "1247",
    "1248",
    "1249",
    "1250",
    "1251",
    "1252",
    "1253",
    "1254",
    "1300",
    "1308",
    "1312",
    "1313",
    "1314",
    "1315",
    "1316",
    "1317",
    "1318",
    "1319",
    "1320",
    "1321",
    "1322",
    "1323",
    "1324",
    "1325",
    "1326",
    "1327",
    "1328",
    "2300",
    "2301",
    "2302",
    "2303",
    "2304",
    "2305",
    "2306",
    "2307",
    "2308",
    "2309",
    "2310",
    "2311",
    "2312",
    "2313",
    "2314",
    "2315",
    "2316",
    "2317",
    "2318",
    "2319",
    "2320",
    "2321",
    "2322",
    "2323",
    "2324",
    "2325",
    "2326",
    "2327",
    "2328",
    "2329",
    "2330",
    "2331",
    "2332",
    "2333",
    "2334",
    "2335",
    "2336",
    "2337",
    "2338",
    "2339",
    "2340",
    "2341",
    "2342",
    "2343",
    "2344",
    "2345",
    "2346",
    "2347",
    "2348",
    "2349",
    "2350",
    "2351",
    "2352",
    "2353",
    "2354",
    "2355",
    "2356",
    "2357",
    "2358",
    "2359",
    "2360",
    "2361",
    "2362",
    "2363",
    "2364",
    "2365",
    "2366",
    "2368",
    "2369",
    "2370",
    "2371",
    "2372",
    "2373",
    "2374",
    "2375",
    "2376",
    "2377",
    "2378",
    "2379",
    "2380",
    "2381",
    "2382",
    "2383",
    "2384",
    "2385",
    "2386",
    "2387",
    "2388",
    "2389",
    "2390",
    "2391",
    "2392",
    "2393",
    "2394",
    "2395",
    "2396",
    "2397",
    "2399",
    "2400",
    "2401",
    "2402",
    "2403",
    "2404",
    "2405",
    "2406",
    "2407",
    "2408",
    "2409",
    "2410",
    "2411",
    "2412",
    "2413",
    "2414",
    "2415",
    "2417",
    "2420",
    "2422",
    "2423",
    "2424",
    "2425",
    "2426",
    "2427",
    "2428",
    "2430",
    "2431",
    "2432",
    "2433",
    "2434",
    "2435",
    "2436",
    "2437",
    "2438",
    "2439",
    "2440",
    "2441",
    "2442",
    "2443",
    "2444",
    "2445",
    "2446",
    "2447",
    "2448",
    "2449",
    "2450",
    "2451",
    "2452",
    "2453",
    "2454",
    "2455",
    "2456",
    "2457",
    "2458",
    "2459",
    "2460",
    "2461",
    "2462",
    "2463",
    "2464",
    "2465",
    "2466",
    "2467",
    "2468",
    "2469",
    "2470",
    "2471",
    "2472",
    "2473",
    "2474",
    "2475",
    "2476",
    "2477",
    "2478",
    "2479",
    "2480",
    "2481",
    "2483",
    "2484",
    "2487",
    "2488",
    "2489",
    "2490",
    "2491",
    "2492",
    "2493",
    "2494",
    "2495",
    "2496",
    "2497",
    "2498",
    "2499",
    "2500",
    "2501",
    "2502",
    "2503",
    "2504",
    "2505",
    "2506",
    "2507",
    "2508",
    "2509",
    "2510",
    "2511",
    "2512",
    "2513",
    "2514",
    "2515",
    "2516",
    "2517",
    "2518",
    "2519",
    "2520",
    "2521",
    "2522",
    "2523",
    "2524",
    "2525",
    "2526",
    "2527",
    "2528",
    "2529",
    "2530",
    "2531",
    "2532",
    "2533",
    "2534",
    "2535",
    "2536",
    "2537",
    "2538",
    "2539",
    "2540",
    "2541",
    "2542",
    "2543",
    "2544",
    "2545",
    "2546",
    "2547",
    "2548",
    "2549",
    "2550",
    "2551",
    "2552",
    "2553",
    "2554",
    "2555",
    "2556",
    "2557",
    "2558",
    "2559",
    "2560",
    "2600",
    "2601",
    "2602",
    "2603",
    "2604",
    "2605",
    "2606",
    "2607",
    "2608",
    "2609",
    "2649",
    "2651",
    "2652",
    "2653",
    "2654",
    "2656",
    "2657",
    "2658",
    "2659",
    "2660",
    "2661",
    "2662",
    "2663",
    "2664",
    "2665",
    "2666",
    "2667",
    "2668",
    "2669",
    "2670",
    "2671",
    "2672",
    "2673",
    "2674",
    "2675",
    "2676",
    "2677",
    "2678",
    "2679",
    "2680",
    "2681",
    "2682",
    "2683",
    "2684",
    "2685",
    "2686",
    "2687",
    "2688",
    "2689",
    "2691",
    "2692",
    "2693",
    "2694",
    "2695",
    "2696",
    "2697",
    "2698",
    "2699",
    "2700",
    "2701",
    "2702",
    "2703",
    "2704",
    "2705",
    "2706",
    "2707",
    "2708",
    "2709",
    "2710",
    "2711",
    "2712",
    "2713",
    "4000",
    "4002",
    "4004",
    "4006",
    "4008",
    "4010",
    "4012",
    "4014",
    "4016",
    "4019",
    "4020",
    "4022",
    "4023",
    "4024",
    "4025",
    "4026",
    "4027",
    "4028",
    "4029",
    "4030",
    "4031",
    "4032",
    "4033",
    "4034",
    "4035",
    "4036",
    "4037",
    "4038",
    "4039",
    "4040",
    "4041",
    "4042",
    "4043",
    "4044",
    "4045",
    "4046",
    "4047",
    "4048",
    "4049",
    "4050",
    "4051",
    "4052",
    "4053",
    "4054",
    "4055",
    "4056",
    "4057",
    "4058",
    "4059",
    "4060",
    "4061",
    "4062",
    "4063",
    "4064",
    "4065",
    "4066",
    "4067",
    "4068",
    "4069",
    "4070",
    "4071",
    "4072",
    "4073",
    "4074",
    "4075",
    "4076",
    "4077",
    "4078",
    "4081",
    "4082",
    "4083",
    "4091",
    "4092",
    "4094",
    "5001",
    "5009",
    "5010",
    "5011",
    "5012",
    "5014",
    "5023",
    "5024",
    "5033",
    "5042",
    "5047",
    "5051",
    "5052",
    "5053",
    "5054",
    "5055",
    "5056",
    "5057",
    "5058",
    "5059",
    "5060",
    "5061",
    "5062",
    "5063",
    "5064",
    "5065",
    "5066",
    "5067",
    "6044",
    "6045",
    "6046",
    "6048",
    "6049",
    "6050",
    "6051",
    "6053",
    "6054",
    "6059",
    "6064",
    "6082",
    "6103",
    "6114",
    "6129",
    "6131",
    "6133",
    "6137",
    "6138",
    "6140",
    "6142",
    "6143",
    "7005",
    "7006",
    "7008",
    "7009",
    "7010",
    "7011",
    "7013",
    "7015",
    "7016",
    "7017",
    "7018",
    "7019",
    "7020",
    "7022",
    "7023",
    "7024",
    "7025",
    "7026",
    "7027",
    "7028",
    "7029",
    "7030",
    "7031",
    "7032",
    "7033",
    "7034",
    "7035",
    "7036",
    "8000",
    "8001",
    "8002",
    "8003",
    "8004",
    "8005",
    "8006",
    "8007",
    "8008",
    "8009",
    "8010",
    "8011",
    "8012",
    "8013",
    "8015",
    "8016",
    "8017",
    "8018",
    "8020",
    "9002",
    "9003",
    "9004",
    "17000",
    "17001",
    "17002",
    "17003",
    "17004",
    "17005",
    "17006",
    "17007",
    "17008",
    "17009",
    "17010",
    "17011",
    "17012",
    "17013",
    "18000",
    "18001",
    "18002",
    "18003",
    "90009",
    "90010"
]
[Trace  - 3:38:50 PM] Sending request: getApplicableRefactors (4). Response expected: yes. Current queue length: 2
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "startLine": 7,
    "startOffset": 5,
    "endLine": 7,
    "endOffset": 12
}
[Trace  - 3:38:50 PM] Response received: getApplicableRefactors (4). Request took 706 ms. Success: true 
Result: []
[Trace  - 3:38:50 PM] Sending request: geterr (6). Response expected: no. Current queue length: 1
Arguments: {
    "delay": 0,
    "files": [
        "/Users/matb/projects/san/y.js"
    ]
}
[Trace  - 3:38:50 PM] Sending request: navtree (7). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js"
}
[Trace  - 3:38:50 PM] Response received: navtree (7). Request took 460 ms. Success: true 
Result: {
    "text": "<global>",
    "kind": "script",
    "kindModifiers": "",
    "spans": [
        {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 13,
                "offset": 11
            }
        }
    ],
    "childItems": [
        {
            "text": "Foo",
            "kind": "class",
            "kindModifiers": "",
            "spans": [
                {
                    "start": {
                        "line": 1,
                        "offset": 1
                    },
                    "end": {
                        "line": 10,
                        "offset": 2
                    }
                }
            ],
            "childItems": [
                {
                    "text": "constructor",
                    "kind": "constructor",
                    "kindModifiers": "",
                    "spans": [
                        {
                            "start": {
                                "line": 2,
                                "offset": 3
                            },
                            "end": {
                                "line": 4,
                                "offset": 4
                            }
                        }
                    ]
                },
                {
                    "text": "z",
                    "kind": "method",
                    "kindModifiers": "",
                    "spans": [
                        {
                            "start": {
                                "line": 6,
                                "offset": 3
                            },
                            "end": {
                                "line": 8,
                                "offset": 4
                            }
                        }
                    ]
                }
            ]
        }
    ]
}
[Trace  - 3:38:50 PM] Event received: syntaxDiag (0).
Data: {
    "file": "/Users/matb/projects/san/y.js",
    "diagnostics": []
}
[Trace  - 3:38:50 PM] Event received: semanticDiag (0).
Data: {
    "file": "/Users/matb/projects/san/y.js",
    "diagnostics": []
}
[Trace  - 3:38:50 PM] Event received: requestCompleted (0).
Data: {
    "request_seq": 6
}
[Trace  - 3:38:51 PM] Sending request: references (8). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "line": 1,
    "offset": 7
}
[Trace  - 3:38:51 PM] Response received: references (8). Request took 72 ms. Success: true 
Result: {
    "refs": [
        {
            "file": "/Users/matb/projects/san/y.js",
            "start": {
                "line": 1,
                "offset": 7
            },
            "lineText": "class Foo {",
            "end": {
                "line": 1,
                "offset": 10
            },
            "isWriteAccess": true,
            "isDefinition": true
        },
        {
            "file": "/Users/matb/projects/san/y.js",
            "start": {
                "line": 13,
                "offset": 5
            },
            "lineText": "new Foo(1)",
            "end": {
                "line": 13,
                "offset": 8
            },
            "isWriteAccess": false,
            "isDefinition": false
        }
    ],
    "symbolName": "Foo",
    "symbolStartOffset": 7,
    "symbolDisplayString": "class Foo"
}
[Trace  - 3:38:51 PM] Sending request: references (9). Response expected: yes. Current queue length: 1
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "line": 2,
    "offset": 3
}
[Trace  - 3:38:51 PM] Response received: references (9). Request took 78 ms. Success: true 
Result: {
    "refs": [
        {
            "file": "/Users/matb/projects/san/y.js",
            "start": {
                "line": 2,
                "offset": 3
            },
            "lineText": "  constructor(x) {",
            "end": {
                "line": 2,
                "offset": 14
            },
            "isWriteAccess": false,
            "isDefinition": false
        },
        {
            "file": "/Users/matb/projects/san/y.js",
            "start": {
                "line": 13,
                "offset": 5
            },
            "lineText": "new Foo(1)",
            "end": {
                "line": 13,
                "offset": 8
            },
            "isWriteAccess": false,
            "isDefinition": false
        }
    ],
    "symbolName": "constructor",
    "symbolStartOffset": 3,
    "symbolDisplayString": "constructor Foo(x: any): Foo"
}
[Trace  - 3:38:51 PM] Sending request: references (10). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "line": 6,
    "offset": 3
}
[Trace  - 3:38:51 PM] Response received: references (10). Request took 95 ms. Success: true 
Result: {
    "refs": [
        {
            "file": "/Users/matb/projects/san/y.js",
            "start": {
                "line": 6,
                "offset": 3
            },
            "lineText": "  z() {",
            "end": {
                "line": 6,
                "offset": 4
            },
            "isWriteAccess": true,
            "isDefinition": true
        }
    ],
    "symbolName": "z",
    "symbolStartOffset": 3,
    "symbolDisplayString": "(method) Foo.z(): void"
}
[Trace  - 3:38:52 PM] Sending request: getApplicableRefactors (11). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "startLine": 7,
    "startOffset": 1,
    "endLine": 7,
    "endOffset": 21
}
[Trace  - 3:38:52 PM] Response received: getApplicableRefactors (11). Request took 4 ms. Success: true 
Result: [
    {
        "name": "Extract Method",
        "description": "Extract function",
        "inlineable": true,
        "actions": [
            {
                "description": "Extract function into class 'Foo'",
                "name": "scope_0"
            },
            {
                "description": "Extract function into global scope",
                "name": "scope_1"
            }
        ]
    }
]
[Trace  - 3:38:52 PM] Sending request: getApplicableRefactors (12). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "startLine": 7,
    "startOffset": 1,
    "endLine": 7,
    "endOffset": 21
}
[Trace  - 3:38:52 PM] Response received: getApplicableRefactors (12). Request took 2 ms. Success: true 
Result: [
    {
        "name": "Extract Method",
        "description": "Extract function",
        "inlineable": true,
        "actions": [
            {
                "description": "Extract function into class 'Foo'",
                "name": "scope_0"
            },
            {
                "description": "Extract function into global scope",
                "name": "scope_1"
            }
        ]
    }
]
[Trace  - 3:38:54 PM] Sending request: configure (13). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "formatOptions": {
        "tabSize": 2,
        "indentSize": 2,
        "convertTabsToSpaces": true,
        "newLineCharacter": "\n",
        "insertSpaceAfterCommaDelimiter": true,
        "insertSpaceAfterConstructor": false,
        "insertSpaceAfterSemicolonInForStatements": true,
        "insertSpaceBeforeAndAfterBinaryOperators": true,
        "insertSpaceAfterKeywordsInControlFlowStatements": true,
        "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
        "insertSpaceBeforeFunctionParenthesis": false,
        "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
        "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
        "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
        "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
        "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
        "placeOpenBraceOnNewLineForFunctions": false,
        "placeOpenBraceOnNewLineForControlBlocks": false
    }
}
[Trace  - 3:38:54 PM] Response received: configure (13). Request took 1 ms. Success: true 
[Trace  - 3:38:54 PM] Sending request: getEditsForRefactor (14). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/y.js",
    "startLine": 7,
    "startOffset": 1,
    "endLine": 7,
    "endOffset": 21,
    "refactor": "Extract Method",
    "action": "scope_0"
}
[Trace  - 3:38:54 PM] Response received: getEditsForRefactor (14). Request took 31 ms. Success: false . Message: Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at getPos (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72306:22)
    at assignPositionsToNodeArray (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72745:29)
    at Object.visitEachChild (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:42481:102)
    at assignPositionsToNode (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72733:30)
    at getNonformattedText (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72709:52)
    at ChangeTracker.getFormattedTextOfNode (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72676:40)
    at ChangeTracker.computeNewText (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72670:33)
    at /Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72645:44
    at Map.forEach (native)
    at ChangeTracker.getChanges (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72638:32)
    at extractFunctionInScope (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:75053:43)
    at getExtractionAtIndex (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:74887:24)
    at Object.getEditsForAction (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:74589:24)
    at Object.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72895:41)
    at Object.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:76736:32)
    at IOSession.Session.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82565:59)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:81531:61)
    at /Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82741:88
    at IOSession.Session.executeWithRequestId (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82732:28)
    at IOSession.Session.executeCommand (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82741:33)
    at IOSession.Session.onMessage (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82761:35)
    at Interface.<anonymous> (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:83887:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)
[Error  - 3:38:54 PM] 'getEditsForRefactor' request failed with error.
Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at getPos (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72306:22)
    at assignPositionsToNodeArray (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72745:29)
    at Object.visitEachChild (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:42481:102)
    at assignPositionsToNode (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72733:30)
    at getNonformattedText (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72709:52)
    at ChangeTracker.getFormattedTextOfNode (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72676:40)
    at ChangeTracker.computeNewText (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72670:33)
    at /Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72645:44
    at Map.forEach (native)
    at ChangeTracker.getChanges (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72638:32)
    at extractFunctionInScope (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:75053:43)
    at getExtractionAtIndex (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:74887:24)
    at Object.getEditsForAction (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:74589:24)
    at Object.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:72895:41)
    at Object.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:76736:32)
    at IOSession.Session.getEditsForRefactor (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82565:59)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:81531:61)
    at /Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82741:88
    at IOSession.Session.executeWithRequestId (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82732:28)
    at IOSession.Session.executeCommand (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82741:33)
    at IOSession.Session.onMessage (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:82761:35)
    at Interface.<anonymous> (/Users/matb/projects/vscode/extensions/node_modules/typescript/lib/tsserver.js:83887:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)
@mjbvz mjbvz assigned ghost Sep 21, 2017
@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Sep 21, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Sep 21, 2017

Actually this appears unrelated to the fix for #18328 as I'm able to reproduce the issue in our current insiders build as well. This only reproduces on TS 2.5.3-insiders. In TS 2.5.2, I do not see this issue.

// cc @mhegazy

@mjbvz mjbvz changed the title getEditsForRefactor debug failure getEditsForRefactor debug failure in js file Sep 21, 2017
@mhegazy mhegazy added the Bug A bug in TypeScript label Sep 22, 2017
@ghost
Copy link

ghost commented Sep 22, 2017

You seem to be using an older version of TypeScript; it uses text like Extract function into class 'Foo' while we now use text like Extract to method in class 'Foo'. Can you reproduce this error in typescript@next?
There were some relevant bug fixes in #18284 (ported to #18547), #18484 (ported to #18547), and #18484 (ported to #18486).
I've also tested that this works against a local build of the release-2.5 branch, and in the latest version of code-insiders.

@mhegazy mhegazy added this to the TypeScript 2.6 milestone Sep 22, 2017
@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Sep 22, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Sep 22, 2017

This was tested on 2.5.3-insiders.20170919. It does not repo on typescript@next or on [email protected]

@mjbvz
Copy link
Contributor Author

mjbvz commented Sep 22, 2017

Looks fixed in 2.5.3-insiders.20170922

@mjbvz mjbvz closed this as completed Sep 22, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Needs More Info The issue still hasn't been fully clarified VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

2 participants