Visual Studio 2022 Typescript Intellisense

I have a medium size React app hosted inside an ASP.NET Core WebApi project. I have about 100 ts/tsx, and a handful of js files created using the OOB React template. For 6 months, the development experience was great. Intellisense, reference navigation, and error resolution suggestion all near instant. Last week, I patched VS2022 Pro 2022 (64-bit) to V17.5.5. Initellicode 2.2, TypeScript Tools, 17.0.20105.2003. Now VS2022 is almost unusable. Apparently, a language service spins up a separate Node instance to handle JS/TS work. That Node process seems to be pegging the CPU, eating ~0.7GB of memory. Not while debugging but simply having the solution open. I created a new sandbox project from the same template. Added some ts files, nothing exotic, just simple type definitions and the npm packages I need. Same thing. It takes 13-15 seconds to hover over a type for Intellisense to recognize it. Compilation errors take at least that long. I get a progress bar when 'Go to Definition'. All of this was instant on this same machine for months. Oddly, running the solution is the same speed as always. Only the text editing experience. Things I've tried:

  • Deleted node_modules + package-lock.json, multiple times, reboot
  • Deleted hidden .vs folder, reboot
  • Fresh sandbox with the same template, all JS -works fine. Add TS -issue returns
  • Uninstalled and reinstalled VS2022, reboot
  • Tweaked VS options found online, disabled linting, etc
  • Deleted local repo, rebuilt from remote
  • Updated typescript (NPM), Node, etc

One thing I notice, in tsconfig, if I define an empty include: [], I get the performance returned, but of course, it can't find the types in node_modules so that's not going to work. Any suggestions?

{
      "compilerOptions": {
        "target": "es5",
        "lib": [
          "dom",
          "dom.iterable",
          "esnext"
        ],
        "allowJs": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "strict": true,
        "strictPropertyInitialization": false,
        "forceConsistentCasingInFileNames": true,
        "noFallthroughCasesInSwitch": true,
        "module": "esnext",
        "moduleResolution": "node",
        "resolveJsonModule": true,
        "isolatedModules": true,
        "noEmit": true,
        "jsx": "react-jsx"
      },
      "include": [
        "src"  // if I leave this empty, all the performance returns, but no package resoltion
      ],
      "exclude": [
        "node_modules"
      ]
    }

package.json

    {
      "name": "omitted",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "@babel/eslint-parser": "^7.21.8",
        "@reduxjs/toolkit": "^1.9.2",
        "@types/lodash": "^4.14.191",
        "@types/react": "^18.0.27",
        "agentkeepalive": "^4.2.0",
        "antd": "^5.4.6",
        "axios": "^0.26.0",
        "dayjs": "^1.10.7",
        "http-proxy-middleware": "^0.19.1",
        "lodash": "^4.17.21",
        "query-string": "^7.1.1",
        "react": "^18.2.0",
        "react-device-detect": "^2.1.2",
        "react-dom": "^18.2.0",
        "react-input-mask": "^2.0.4",
        "react-quill": "^2.0.0",
        "react-redux": "^8.0.5",
        "react-router-dom": "^6.8.0",
        "react-scripts": "^5.0.1",
        "recharts": "^2.1.14",
        "redux": "^4.2.1",
        "rimraf": "^2.6.2",
        "swagger-ui-react": "^4.15.5",
        "web-vitals": "^0.2.4",
        "workbox-background-sync": "^5.1.3",
        "workbox-broadcast-update": "^5.1.3",
        "workbox-cacheable-response": "^5.1.3",
        "workbox-core": "^5.1.3",
        "workbox-expiration": "^5.1.3",
        "workbox-google-analytics": "^5.1.3",
        "workbox-navigation-preload": "^5.1.3",
        "workbox-precaching": "^5.1.3",
        "workbox-range-requests": "^5.1.3",
        "workbox-routing": "^5.1.3",
        "workbox-strategies": "^5.1.3",
        "workbox-streams": "^5.1.3"
      },
      "devDependencies": {
        "@types/node": "^20.1.7",
        "@types/react-redux": "^7.1.25",
        "@types/react-router-dom": "^5.3.3",
        "ajv": "^6.9.1",
        "cross-env": "^7.0.3",
        "eslint": "^7.25.0",
        "eslint-config-react-app": "^6.0.0",
        "eslint-plugin-flowtype": "^5.7.2",
        "eslint-plugin-import": "^2.22.1",
        "eslint-plugin-jsx-a11y": "^6.4.1",
        "eslint-plugin-react": "^7.23.2",
        "nan": "^2.14.2",
        "typescript": "^5.0.4"
      },
      "scripts": {
        "prestart": "node aspnetcore-https && node aspnetcore-react",
        "start": "rimraf ./build && react-scripts start",
        "build": "react-scripts build",
        "test": "cross-env CI=true react-scripts test --env=jsdom",
        "eject": "react-scripts eject",
        "lint": "eslint ./src/"
      },
      "eslintConfig": {
        "extends": [
          "react-app"
        ]
      },
      "browserslist": {
        "production": [
          ">0.2%",
          "not dead",
          "not op_mini all"
        ],
        "development": [
          "last 1 chrome version",
          "last 1 firefox version",
          "last 1 safari version"
        ]
      }
    }


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation