-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Slow Typescript problem reporting and intellisense #56142
Comments
Perhaps you can try updating your TypeScript version to the latest release? |
Switching to [email protected] seems to be solving the issue. But I need to use 5.2.2. Switching to TS 4.9.5
When I switched back to TS 5.2.2
|
This is how I am surviving right now, Installed [email protected]
Added this in settings.json{
...
// "typescript.tsdk": "~/.volta/tools/shared/typescript/lib" // I am using volta on mac
"typescript.tsdk": "<npm_root>/typescript/lib" // Place your `npm root -g` here
} |
@sagarpanchal Please try to share an example project which demonstrates the issue so we can investigate |
@mjbvz Since, I created this issue,
I had a loop like this, that was taking around 3000-4000 ms, when I did import TsMorph, { ts } from "ts-morph"
for (const syntaxKind of [
ts.SyntaxKind.PropertyAssignment,
ts.SyntaxKind.ShorthandPropertyAssignment,
ts.SyntaxKind.VariableDeclaration,
ts.SyntaxKind.FunctionDeclaration,
]) {
// ... code
} I have changed it to this const array, and is not taking much time anymore import TsMorph, { ts } from "ts-morph"
for (const syntaxKind of [
ts.SyntaxKind.PropertyAssignment,
ts.SyntaxKind.ShorthandPropertyAssignment,
ts.SyntaxKind.VariableDeclaration,
ts.SyntaxKind.FunctionDeclaration,
] as const) { // <-- "as const" because SyntaxKind is a large enum
// ... code
} I am still not sure if it was the issue with vscode or the packages that I was using or the changes I have done after tsconfig.json {
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"allowUnreachableCode": true,
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"isolatedModules": true,
"lib": ["ESNext"],
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "dist",
"resolveJsonModule": true,
"rootDir": ".",
"skipLibCheck": true,
"strict": true,
"target": "ES2019",
"useDefineForClassFields": true
},
"include": ["scripts/**/*", "src/**/*"]
} package.json dependencies {
"dependencies": {
"@dagrejs/graphlib": "^2.1.13",
"@total-typescript/ts-reset": "^0.5.1",
"eslint-plugin-jest": "^27.4.2",
"fs-extra": "^11.1.1",
"ignore": "^5.2.4",
"jest": "^29.7.0",
"jsonc-parser": "^3.2.0",
"minimatch": "^9.0.3",
"serve": "^14.2.1",
"ts-jest": "^29.1.1",
"ts-morph": "^20.0.0",
"tslib": "^2.6.2",
"zod": "^3.22.4"
},
"devDependencies": {
"@types/fs-extra": "^11.0.2",
"@types/jest": "^29.5.5",
"@types/node": "^20.8.4",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prettier": "^5.0.1",
"execa": "npm:@esm2cjs/execa@^6.1.1-cjs.1",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"shx": "^0.3.4",
"ts-node": "^10.9.1",
"type-fest": "^4.4.0",
"typescript": "~5.2.2"
},
} |
@mjbvz I think the issue was the way I was using the SyntaxKind enum from typescript in array |
I'm also running into this after moving from v4 to v5, annoyingly I need v5 for a particular library that saves a ton of time for me so I'm still weighing up the tradeoff between having essentially zero intellisense or using ts-pattern. Fortunately, my codebase is open source so hopefully it's useful in debugging this issue: https://github.com/Southclaws/storyden I'm not sure what I can do in the meantime though, but I used to write C so the pain is familiar at least 😅 |
Type: Performance Issue
After some time typescript features slows down
VS Code version: Code 1.81.1 (Universal) (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:20:33.924Z)
OS version: Darwin arm64 22.5.0
Modes:
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Process Info
Workspace Info
Extensions (63)
The text was updated successfully, but these errors were encountered: