Skip to content
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

strictFunctionTypes on a large type with higher-order functions causes tsserver to hang with "Loading..." in VS Code #30449

Closed
jchitel opened this issue Mar 17, 2019 · 5 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Big Unions The root cause is ultimately that big unions interact poorly with complex structures Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@jchitel
Copy link

jchitel commented Mar 17, 2019

TypeScript Version: 3.4.0-dev.20190316

Search Terms: loading, stuck

Code

I tried to create an array which represented the full key type of JSX.IntrinsicElements.

I ended up being able to narrow down the issue to this case. If I simply specify the type alias for the key type, and export an array of that type, then import it in another module, that triggers this issue.

The case that I had was insufficient. I assumed the above was the issue based on looking at my code, but I was able to narrow it down to the below case, only with strictFunctionTypes turned on. I'm working on a styled-components clone, and I've started specifying the base API. I was not able to reproduce this with a case simpler than this. It seems that JSX.IntrinsicElements is a large enough interface that it overloads the tsserver. The resulting Styled type contains higher-order functions that I'm assuming are too complex to analyze with strictFunctionTypes turned on.

These are the things I tried, all of which cause tsserver to behave normally:

  • replace DomKey with string
  • replace JSX.IntrinsicElements with a smaller interface
  • get rid of the createNew function and replace Styled with StyledFactories
  • get rid of the non-type code (the last four statements)
  • replace Interpolation with string.
type DomKey = keyof JSX.IntrinsicElements;

type StyledFactories = {
    [P in DomKey]: StyledConstructor<JSX.IntrinsicElements[P]>
};

type Styled = StyledFactories & {
    createNew: <P>(tag: React.ComponentType<P>) => StyledConstructor<P>
};

type StyledConstructor<P> = (strings: TemplateStringsArray, ...interpolations: Interpolation<P>[]) => React.ComponentType<P>;

type Interpolation<P> = string | ((props: P) => Interpolation<P>);

const domElements: Array<DomKey> = [];

const createNew = <P>(tag: string | React.ComponentType<P>) => {
    return (strings: TemplateStringsArray, ...interpolations: Array<Interpolation<P>>) => {}
};

const styled: Styled = { createNew };

for (const el of domElements) {
    styled[el] = createNew(el);
}

Expected behavior:

I am able to get proper IDE integration: mouse-over info, auto-complete, errors/warnings, etc.

Actual behavior:

Absolutely nothing. When I mouse over something, it shows a box with the text "Loading..." instead of info about the element under the cursor.

I turned on verbose logging and trace. I'll post each of those in a comment.

Playground Link: React is required to reproduce this issue

Related Issues:

@jchitel
Copy link
Author

jchitel commented Mar 17, 2019

Trace output:

[Info  - 12:23:13 AM] Using tsserver from: .../node_modules/typescript/lib
[Info  - 12:23:13 AM] TSServer log file: .../Library/Application Support/Code/logs/20190317T002312/exthost1/vscode.typescript-language-features/tsserver-log-HFH51q/tsserver.log
[Info  - 12:23:13 AM] Forking TSServer
[Info  - 12:23:13 AM] Started TSServer
[Trace  - 12:23:13 AM] Sending request: configure (0). Response expected: no. Current queue length: 0
Arguments: {
    "hostInfo": "vscode",
    "preferences": {
        "providePrefixAndSuffixTextForRename": true,
        "allowRenameOfImportPath": true
    }
}
[Trace  - 12:23:13 AM] Sending request: compilerOptionsForInferredProjects (1). Response expected: no. Current queue length: 0
Arguments: {
    "options": {
        "module": "commonjs",
        "target": "es2016",
        "jsx": "preserve",
        "allowJs": true,
        "allowSyntheticDefaultImports": true,
        "allowNonTsExtensions": true
    }
}
[Trace  - 12:23:13 AM] Sending request: open (2). Response expected: no. Current queue length: 0
Arguments: {
    "file": ".../index.ts",
    "fileContent": "...",
    "scriptKindName": "TS",
    "projectRootPath": "..."
}
[Trace  - 12:23:14 AM] Sending request: getSupportedCodeFixes (3). Response expected: yes. Current queue length: 0
[Trace  - 12:23:14 AM] TypeScript Server: canceled request with sequence number 4
[Trace  - 12:23:14 AM] TypeScript Server: canceled request with sequence number 5
[Trace  - 12:23:15 AM] Event received: projectLoadingStart (0).
Data: {
    "projectName": ".../tsconfig.json",
    "reason": "Creating possible configured project for .../index.ts to open"
}
[Trace  - 12:23:15 AM] Event received: projectLoadingFinish (0).
Data: {
    "projectName": ".../tsconfig.json"
}
[Trace  - 12:23:15 AM] Event received: telemetry (0).
Data: {
    "telemetryEventName": "projectInfo",
    "payload": {
        "projectId": "c423bb1c1d6fe74685f11b3e92e0a5060cd1f854a32b75d5e6286e71214ad077",
        "fileStats": {
            "js": 0,
            "jsSize": 0,
            "jsx": 0,
            "jsxSize": 0,
            "ts": 2,
            "tsSize": 1196,
            "tsx": 1,
            "tsxSize": 148,
            "dts": 103,
            "dtsSize": 3337688,
            "deferred": 0,
            "deferredSize": 0
        },
        "compilerOptions": {
            "target": "es5",
            "module": "commonjs",
            "lib": [
                "dom",
                "esnext"
            ],
            "jsx": "react",
            "sourceMap": true,
            "importHelpers": true,
            "strict": true,
            "noUnusedLocals": true,
            "noUnusedParameters": true,
            "noImplicitReturns": true,
            "esModuleInterop": true
        },
        "typeAcquisition": {
            "enable": false,
            "include": false,
            "exclude": false
        },
        "extends": false,
        "files": false,
        "include": false,
        "exclude": false,
        "compileOnSave": false,
        "configFileName": "tsconfig.json",
        "projectType": "configured",
        "languageServiceEnabled": true,
        "version": "3.4.0-dev.20190316"
    }
}
[Trace  - 12:23:15 AM] Event received: configFileDiag (0).
Data: {
    "triggerFile": ".../index.ts",
    "configFile": ".../tsconfig.json",
    "diagnostics": []
}
[Trace  - 12:23:15 AM] Response received: getSupportedCodeFixes (3). Request took 1371 ms. Success: true 
Result: [
    ...
]
[Trace  - 12:23:15 AM] Sending request: getApplicableRefactors (6). Response expected: yes. Current queue length: 3
Arguments: {
    "file": ".../index.ts",
    "startLine": 21,
    "startOffset": 1,
    "endLine": 23,
    "endOffset": 2
}
[Trace  - 12:23:15 AM] Event received: typingsInstallerPid (0).
Data: {
    "pid": 29033
}
[Trace  - 12:23:15 AM] Event received: projectsUpdatedInBackground (0).
Data: {
    "openFiles": [
        ".../index.ts"
    ]
}
[Trace  - 12:23:15 AM] Response received: getApplicableRefactors (6). Request took 1419 ms. Success: true 
Result: [
    {
        "name": "Extract Symbol",
        "description": "Extract function",
        "actions": [
            {
                "description": "Extract to function in module scope",
                "name": "function_scope_0"
            }
        ]
    }
]
[Trace  - 12:23:15 AM] Sending request: configure (7). Response expected: yes. Current queue length: 2
Arguments: {
    "file": ".../index.ts",
    "formatOptions": {
        "tabSize": 4,
        "indentSize": 4,
        "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,
        "insertSpaceAfterTypeAssertion": false,
        "placeOpenBraceOnNewLineForFunctions": false,
        "placeOpenBraceOnNewLineForControlBlocks": false
    },
    "preferences": {
        "quotePreference": "auto",
        "allowTextChangesInNewFiles": true,
        "providePrefixAndSuffixTextForRename": true,
        "allowRenameOfImportPath": true
    }
}
[Trace  - 12:23:15 AM] Response received: configure (7). Request took 1421 ms. Success: true 
[Trace  - 12:23:15 AM] Sending request: geterr (8). Response expected: yes. Current queue length: 1
Arguments: {
    "delay": 0,
    "files": [
        ".../index.ts"
    ]
}
[Trace  - 12:23:15 AM] Sending request: getOutliningSpans (9). Response expected: yes. Current queue length: 0
Arguments: {
    "file": ".../index.ts"
}
[Trace  - 12:23:15 AM] Response received: getOutliningSpans (9). Request took 1255 ms. Success: true 
Result: [
    ...
]
[Trace  - 12:23:15 AM] Event received: syntaxDiag (0).
Data: {
    "file": ".../index.ts",
    "diagnostics": []
}
[Trace  - 12:23:15 AM] TypeScript Server: trying to cancel ongoing request with sequence number 8
[Trace  - 12:23:15 AM] Sending request: geterr (10). Response expected: yes. Current queue length: 0
Arguments: {
    "delay": 0,
    "files": [
        ".../index.ts"
    ]
}
[Trace  - 12:23:15 AM] Sending request: getOutliningSpans (11). Response expected: yes. Current queue length: 0
Arguments: {
    "file": ".../index.ts"
}

The notable line is toward the bottom:

[Trace  - 12:23:15 AM] TypeScript Server: trying to cancel ongoing request with sequence number 8

@jchitel
Copy link
Author

jchitel commented Mar 17, 2019

Here's the log file output:

Info 0    [0:23:14.165] Starting TS Server
Info 1    [0:23:14.165] Version: 3.4.0-dev.20190316
Info 2    [0:23:14.165] Arguments: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper .../node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /var/folders/fx/p685rpbs6zq_hnmyfh_6fb_m0000gn/T/vscode-typescript/tscancellation-60a497accae5d8213246.tmp* --logVerbosity verbose --logFile .../Library/Application Support/Code/logs/20190317T002312/exthost1/vscode.typescript-language-features/tsserver-log-HFH51q/tsserver.log --locale en --noGetErrOnBackgroundUpdate
Info 3    [0:23:14.165] Platform: darwin NodeVersion: 10 CaseSensitive: false
Info 4    [0:23:14.170] Binding...
Info 5    [0:23:14.175] request:
    {"seq":0,"type":"request","command":"configure","arguments":{"hostInfo":"vscode","preferences":{"providePrefixAndSuffixTextForRename":true,"allowRenameOfImportPath":true}}}
Info 6    [0:23:14.175] Host information vscode
Info 7    [0:23:14.176] response:
    {"seq":0,"type":"response","command":"configure","request_seq":0,"success":true}
Perf 8    [0:23:14.177] 0::configure: async elapsed time (in milliseconds) 1.3726
Info 9    [0:23:14.177] request:
    {"seq":1,"type":"request","command":"compilerOptionsForInferredProjects","arguments":{"options":{"module":"commonjs","target":"es2016","jsx":"preserve","allowJs":true,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true}}}
Info 10   [0:23:14.177] Scheduled: *ensureProjectForOpenFiles*
Perf 11   [0:23:14.178] 1::compilerOptionsForInferredProjects: elapsed time (in milliseconds) 0.8872
Info 12   [0:23:14.178] response:
    {"seq":0,"type":"response","command":"compilerOptionsForInferredProjects","request_seq":1,"success":true,"body":true}
Info 13   [0:23:14.178] request:
    {"seq":2,"type":"request","command":"open","arguments":{"file":".../index.ts","fileContent":"...","scriptKindName":"TS","projectRootPath":"..."}}
Info 14   [0:23:14.179] Search path: ...
Info 15   [0:23:14.179] ConfigFilePresence:: Current Watches: :: File: .../tsconfig.json Currently impacted open files: RootsOfInferredProjects:  OtherOpenFiles: .../index.ts Status: File added to open files impacted by this config file
Info 16   [0:23:14.179] ConfigFilePresence:: Current Watches: :: File: .../jsconfig.json Currently impacted open files: RootsOfInferredProjects:  OtherOpenFiles: .../index.ts Status: File added to open files impacted by this config file
Info 17   [0:23:14.180] ConfigFilePresence:: Current Watches: :: File: .../tsconfig.json Currently impacted open files: RootsOfInferredProjects:  OtherOpenFiles: .../index.ts Status: File added to open files impacted by this config file
Info 18   [0:23:14.180] For info: .../index.ts :: Config file name: .../tsconfig.json
Info 19   [0:23:14.180] Opened configuration file .../tsconfig.json
Info 20   [0:23:14.182] FileWatcher:: Added:: WatchInfo: .../tsconfig.json 2000 Project: .../tsconfig.json WatchType: Config file
Info 21   [0:23:14.182] event:
    {"seq":0,"type":"event","event":"projectLoadingStart","body":{"projectName":".../tsconfig.json","reason":"Creating possible configured project for .../index.ts to open"}}
Info 22   [0:23:14.200] DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Wild card directory
Info 23   [0:23:14.201] Elapsed:: 1ms DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Wild card directory
Info 24   [0:23:14.204] FileWatcher:: Added:: WatchInfo: ... 500 Project:  WatchType: Closed Script info
Info 25   [0:23:14.204] FileWatcher:: Added:: WatchInfo: .../dom-elements.ts 500 Project:  WatchType: Closed Script info
Info 26   [0:23:14.228] Starting updateGraphWorker: Project: .../tsconfig.json
Info 27   [0:23:14.257] DirectoryWatcher:: Added:: WatchInfo: .../node_modules 1 Project:  WatchType: node_modules for closed script infos in them
Info 28   [0:23:14.258] Elapsed:: 1ms DirectoryWatcher:: Added:: WatchInfo: .../node_modules 1 Project:  WatchType: node_modules for closed script infos in them
Info 29   [0:23:14.801] DirectoryWatcher:: Added:: WatchInfo: .../node_modules 1 Project: .../tsconfig.json WatchType: Failed Lookup Locations
Info 30   [0:23:14.801] Elapsed:: 0ms DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Failed Lookup Locations
Info 31   [0:23:15.378] DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Failed Lookup Locations
Info 32   [0:23:15.378] Elapsed:: 0ms DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Failed Lookup Locations
Info 33   [0:23:15.378] DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Failed Lookup Locations
Info 34   [0:23:15.378] Elapsed:: 0ms DirectoryWatcher:: Added:: WatchInfo: ... 1 Project: .../tsconfig.json WatchType: Failed Lookup Locations
Info 35   [0:23:15.392] DirectoryWatcher:: Added:: WatchInfo: .../node_modules/@types 1 Project: .../tsconfig.json WatchType: Type roots
Info 36   [0:23:15.392] Elapsed:: 0ms DirectoryWatcher:: Added:: WatchInfo: .../node_modules/@types 1 Project: .../tsconfig.json WatchType: Type roots
Info 37   [0:23:15.392] Finishing updateGraphWorker: Project: .../tsconfig.json Version: 1 structureChanged: true Elapsed: 1164ms
Info 38   [0:23:15.393] event:
    {"seq":0,"type":"event","event":"projectLoadingFinish","body":{"projectName":".../tsconfig.json"}}
Info 39   [0:23:15.395] event:
    {"seq":0,"type":"event","event":"telemetry","body":{"telemetryEventName":"projectInfo","payload":{"projectId":"c423bb1c1d6fe74685f11b3e92e0a5060cd1f854a32b75d5e6286e71214ad077","fileStats":{"js":0,"jsSize":0,"jsx":0,"jsxSize":0,"ts":2,"tsSize":1196,"tsx":1,"tsxSize":148,"dts":103,"dtsSize":3337688,"deferred":0,"deferredSize":0},"compilerOptions":{"target":"es5","module":"commonjs","lib":["dom","esnext"],"jsx":"react","sourceMap":true,"importHelpers":true,"strict":true,"noUnusedLocals":true,"noUnusedParameters":true,"noImplicitReturns":true,"esModuleInterop":true},"typeAcquisition":{"enable":false,"include":false,"exclude":false},"extends":false,"files":false,"include":false,"exclude":false,"compileOnSave":false,"configFileName":"tsconfig.json","projectType":"configured","languageServiceEnabled":true,"version":"3.4.0-dev.20190316"}}}
Info 40   [0:23:15.398] event:
    {"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":".../index.ts","configFile":".../tsconfig.json","diagnostics":[]}}
Info 41   [0:23:15.399] Project '.../tsconfig.json' (Configured) 0
Info 41   [0:23:15.399] 	Files (106)
	...

Info 41   [0:23:15.399] -----------------------------------------------
Info 41   [0:23:15.399] Open files: 
Info 41   [0:23:15.399] 	FileName: .../index.ts ProjectRootPath: ...
Info 41   [0:23:15.399] 		Projects: .../tsconfig.json
Perf 41   [0:23:15.400] 2::open: async elapsed time (in milliseconds) 1221.8985
Info 42   [0:23:15.400] request:
    {"seq":3,"type":"request","command":"getSupportedCodeFixes","arguments":null}
Perf 43   [0:23:15.400] 3::getSupportedCodeFixes: elapsed time (in milliseconds) 0.1786
Info 44   [0:23:15.400] response:
    {"seq":0,"type":"response","command":"getSupportedCodeFixes","request_seq":3,"success":true,"body":["2352","1329","7051","80004","7034","7005","7006","7019","7033","7010","7032","7008","7046","7043","7044","7047","7048","7050","7049","7045","80002","80006","80001","2713","2420","2720","2304","2552","2663","2662","2503","2686","2693","2551","2724","2339","2741","2739","2740","2348","2307","7016","2515","2653","17009","2377","1219","2689","6133","6196","6138","6192","6198","6199","6205","7027","7028","8020","1308","1103","1002","1003","1005","1006","1009","1010","1011","1012","1013","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","1069","1070","1071","1079","1084","1085","1086","1089","1090","1091","1092","1093","1094","1095","1096","1097","1098","1099","1100","1101","1102","1104","1105","1107","1108","1109","1110","1113","1114","1115","1116","1117","1118","1119","1120","1121","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","1210","1211","1212","1213","1214","1215","1216","1218","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","1255","1256","1257","1300","1312","1313","1314","1315","1316","1317","1318","1319","1320","1321","1322","1323","1324","1325","1326","1327","1328","1330","1331","1332","1333","1334","1335","1336","1337","1338","1339","1340","1342","1343","1344","1345","1346","1347","1348","1349","1351","1352","1353","1354","1355","2300","2301","2302","2303","2305","2306","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","2340","2341","2342","2343","2344","2345","2346","2347","2349","2350","2351","2353","2354","2355","2356","2357","2358","2359","2360","2361","2362","2363","2364","2365","2366","2367","2368","2369","2370","2371","2372","2373","2374","2375","2376","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","2416","2417","2418","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","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","2504","2505","2506","2507","2508","2509","2510","2511","2512","2513","2514","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","2553","2554","2555","2556","2557","2558","2559","2560","2561","2562","2563","2564","2565","2566","2567","2569","2570","2571","2572","2573","2574","2575","2576","2577","2580","2581","2582","2583","2584","2585","2586","2587","2588","2589","2590","2591","2592","2593","2600","2601","2602","2603","2604","2605","2606","2607","2608","2609","2649","2651","2652","2654","2656","2657","2658","2659","2660","2661","2664","2665","2666","2667","2668","2669","2670","2671","2672","2673","2674","2675","2676","2677","2678","2679","2680","2681","2682","2683","2684","2685","2687","2688","2691","2692","2694","2695","2696","2697","2698","2699","2700","2701","2702","2703","2704","2705","2706","2707","2708","2709","2710","2711","2712","2714","2715","2716","2717","2718","2719","2721","2722","2723","2725","2726","2727","2729","2730","2731","2732","2733","2734","2735","2736","2737","2742","2743","2744","2745","2746","2747","2748","2749","2750","2751","2752","2753","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","4090","4091","4092","4094","4095","4096","4097","4098","4099","4100","4101","4102","4103","5001","5009","5010","5012","5014","5023","5024","5033","5042","5047","5051","5052","5053","5054","5055","5056","5057","5058","5059","5060","5061","5062","5063","5064","5065","5066","5067","5068","5069","5070","5071","5072","5073","6044","6045","6046","6048","6049","6050","6051","6053","6054","6059","6064","6082","6103","6114","6131","6137","6140","6142","6188","6189","6200","6202","6304","6305","6306","6307","6308","6309","6369","6370","6377","6379","7009","7011","7013","7014","7015","7017","7018","7020","7022","7023","7024","7025","7026","7029","7030","7031","7035","7036","7039","7040","7041","7042","8000","8001","8002","8003","8004","8005","8006","8007","8008","8009","8010","8011","8012","8013","8015","8016","8017","8018","8021","8022","8023","8024","8025","8026","8027","8028","8029","8030","8031","8032","9002","9003","9004","17000","17001","17002","17003","17004","17005","17006","17007","17008","17010","17011","17012","17013","17014","17015","17016","17017","18000","18001","18002","18003","80005","80003"]}
Info 45   [0:23:15.400] event:
    {"seq":0,"type":"event","event":"typingsInstallerPid","body":{"pid":29033}}
Info 46   [0:23:15.401] Running: *ensureProjectForOpenFiles*
Info 47   [0:23:15.401] Structure before ensureProjectForOpenFiles:
Info 48   [0:23:15.401] Project '.../tsconfig.json' (Configured) 0
Info 48   [0:23:15.401] 	Files (106)
...
Info 48   [0:23:15.401] -----------------------------------------------
Info 48   [0:23:15.401] Open files: 
Info 48   [0:23:15.401] 	FileName: .../index.ts ProjectRootPath: ...
Info 48   [0:23:15.401] 		Projects: .../tsconfig.json
Info 48   [0:23:15.402] Structure after ensureProjectForOpenFiles:
Info 49   [0:23:15.402] Project '.../tsconfig.json' (Configured) 0
Info 49   [0:23:15.402] 	Files (106)
	...

Info 49   [0:23:15.402] -----------------------------------------------
Info 49   [0:23:15.402] Open files: 
Info 49   [0:23:15.402] 	FileName: .../index.ts ProjectRootPath: ...
Info 49   [0:23:15.402] 		Projects: .../tsconfig.json
Info 49   [0:23:15.402] got projects updated in background, updating diagnostics for .../index.ts
Info 50   [0:23:15.402] event:
    {"seq":0,"type":"event","event":"projectsUpdatedInBackground","body":{"openFiles":[".../index.ts"]}}
Info 51   [0:23:15.406] request:
    {"seq":6,"type":"request","command":"getApplicableRefactors","arguments":{"file":".../index.ts","startLine":21,"startOffset":1,"endLine":23,"endOffset":2}}
Perf 52   [0:23:15.445] 6::getApplicableRefactors: elapsed time (in milliseconds) 39.0277
Info 53   [0:23:15.445] response:
    {"seq":0,"type":"response","command":"getApplicableRefactors","request_seq":6,"success":true,"body":[{"name":"Extract Symbol","description":"Extract function","actions":[{"description":"Extract to function in module scope","name":"function_scope_0"}]}]}
Info 54   [0:23:15.457] request:
    {"seq":7,"type":"request","command":"configure","arguments":{"file":".../index.ts","formatOptions":{"tabSize":4,"indentSize":4,"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,"insertSpaceAfterTypeAssertion":false,"placeOpenBraceOnNewLineForFunctions":false,"placeOpenBraceOnNewLineForControlBlocks":false},"preferences":{"quotePreference":"auto","allowTextChangesInNewFiles":true,"providePrefixAndSuffixTextForRename":true,"allowRenameOfImportPath":true}}}
Info 55   [0:23:15.457] Host configuration update for file .../index.ts
Info 56   [0:23:15.457] response:
    {"seq":0,"type":"response","command":"configure","request_seq":7,"success":true}
Perf 57   [0:23:15.457] 7::configure: async elapsed time (in milliseconds) 0.7063
Info 58   [0:23:15.460] request:
    {"seq":8,"type":"request","command":"geterr","arguments":{"delay":0,"files":[".../index.ts"]}}
Perf 59   [0:23:15.461] 8::geterr: async elapsed time (in milliseconds) 1.0138
Info 60   [0:23:15.461] request:
    {"seq":9,"type":"request","command":"getOutliningSpans","arguments":{"file":".../index.ts"}}
Perf 61   [0:23:15.466] 9::getOutliningSpans: elapsed time (in milliseconds) 5.1002
Info 62   [0:23:15.466] response:
    {"seq":0,"type":"response","command":"getOutliningSpans","request_seq":9,"success":true,"body":[{"textSpan":{"start":{"line":1,"offset":1},"end":{"line":2,"offset":54}},"hintSpan":{"start":{"line":1,"offset":1},"end":{"line":2,"offset":54}},"bannerText":"...","autoCollapse":false,"kind":"imports"},{"textSpan":{"start":{"line":13,"offset":63},"end":{"line":17,"offset":2}},"hintSpan":{"start":{"line":13,"offset":19},"end":{"line":17,"offset":2}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":14,"offset":90},"end":{"line":16,"offset":6}},"hintSpan":{"start":{"line":14,"offset":12},"end":{"line":16,"offset":6}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":19,"offset":23},"end":{"line":19,"offset":37}},"hintSpan":{"start":{"line":19,"offset":24},"end":{"line":19,"offset":37}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":21,"offset":30},"end":{"line":23,"offset":2}},"hintSpan":{"start":{"line":21,"offset":1},"end":{"line":23,"offset":2}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":28,"offset":94},"end":{"line":30,"offset":2}},"hintSpan":{"start":{"line":28,"offset":13},"end":{"line":30,"offset":2}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":29,"offset":55},"end":{"line":29,"offset":163}},"hintSpan":{"start":{"line":29,"offset":56},"end":{"line":29,"offset":163}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":29,"offset":123},"end":{"line":29,"offset":157}},"hintSpan":{"start":{"line":29,"offset":124},"end":{"line":29,"offset":157}},"bannerText":"...","autoCollapse":false,"kind":"code"},{"textSpan":{"start":{"line":29,"offset":159},"end":{"line":29,"offset":161}},"hintSpan":{"start":{"line":29,"offset":159},"end":{"line":29,"offset":161}},"bannerText":"...","autoCollapse":false,"kind":"code"}]}
Info 63   [0:23:15.467] event:
    {"seq":0,"type":"event","event":"syntaxDiag","body":{"file":".../index.ts","diagnostics":[]}}

@jchitel jchitel changed the title Simple case causes tsserver to hang with "Loading..." in VS Code strictFunctionTypes on a large type with higher-order functions causes tsserver to hang with "Loading..." in VS Code Mar 18, 2019
@jchitel
Copy link
Author

jchitel commented Mar 18, 2019

I updated the title and description with a more specific issue that I was able to reproduce in a new empty project.

I discovered that the problem is related to the strictFunctionTypes option (I disabled each option in my tsconfig.json until I discovered this was the problem).

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Mar 25, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.5.0 milestone Mar 25, 2019
@weswigham weswigham added the Domain: Big Unions The root cause is ultimately that big unions interact poorly with complex structures label Feb 6, 2020
@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Aug 31, 2020
@RyanCavanaugh RyanCavanaugh removed this from the TypeScript 4.0.1 milestone Aug 31, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.1.0 milestone Aug 31, 2020
@weswigham
Copy link
Member

As of our latest builds, our perf in the given example seems fine. It was probably fixed up by one of our perf adjustments targeted at material-ui perf.

@weswigham
Copy link
Member

weswigham commented Oct 12, 2020

For context: Locally, the longest response time I recorded was 800ms for initial project open, after which subsequent operations were mostly sub-ms, excepting edits which were around 10-20ms, and the quick info at one location, the usage of createNew, which came in at around 200ms (which seems reasonable given all the elision it contains). There's certainly not a systemic slowness on every operation anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Big Unions The root cause is ultimately that big unions interact poorly with complex structures Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

No branches or pull requests

4 participants