Visual Studio 2022 Typescript智能感知

lmvvr0a8  于 2023-05-23  发布在  TypeScript
关注(0)|答案(1)|浏览(290)

我有一个中等大小的React应用程序托管在ASP.NET Core WebApi项目中。大约100个ts/tsx,少量的js文件。使用OOB React模板创建。6个月的开发经验是伟大的。智能感知,参考导航,错误解决建议都是近瞬间.上周,我将VS 2022 Pro 2022(64位)修补到V17.5.5。Initellicode 2.2,TypeScript Tools,17.0.20105.2003。现在VS 2022几乎无法使用。显然,语言服务会启动一个单独的Node示例来处理JS/TS工作。Node进程似乎占用了CPU,消耗了约0.7GB的内存。不是在调试时,而是打开解决方案。我创建了一个新的沙盒项目从相同的模板。添加了一些ts文件,没有什么特别的,只是简单的类型定义和我需要的npm包。一样智能感知需要13-15秒悬停在一个类型上才能识别它。编译错误至少需要这么长时间。当“转到定义”时,我会看到一个进度条。所有这些都是在同一台机器上即时完成的,持续了几个月。奇怪的是,运行解决方案的速度和往常一样。只有文字编辑的经验。我尝试过的事情:

  • 多次删除node_modules + package-lock.json,重启
  • 删除隐藏的。vs文件夹,重新启动
  • 新鲜沙盒与相同的模板,所有JS -工作正常。添加TS -问题退货
  • 卸载并重新安装VS 2022,重新启动
  • 已调整VS选项在线发现,禁用linting等
  • 删除本地存储库,从远程重建
  • 更新的类型脚本(NPM)、节点等

我注意到,在tsconfig中,如果我定义了一个空include:[],我得到了返回的性能,但当然它找不到node_modules中的类型,所以这是行不通的。有什么建议吗?

{
      "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"
        ]
      }
    }
b5buobof

b5buobof1#

对于任何人谁可能有这个问题的道路。我不会改变,配置,重新安装将有帮助。相反,我重建了操作系统映像,从头开始安装所有东西。一如既往地有效。所以,没有真实的的解决方案,但有时重新开始会做的伎俩,如果该选项是提供给你。

相关问题