Visual Studio 2022 - for typescript files Intellisense not working
Asked Answered
T

3

18

I have a problem with the Intellisense on Typescript files in Visual Studio 2022 (on 2019 I didn't have this issue). From time to time the Intellisense stops working and the only solution I have is to exit from Visual Studio and reload the project. Is there any solution to force the the Visual Studio to reindex the files and hopefully the Intellisense will start working or are any other hidden settings that can help me to fix this annoying issue?

Theatricalize answered 26/11, 2021 at 9:17 Comment(3)
Same issue on my side.Its not working on my even after restart.I am using vs2019 with no issuesErlindaerline
Same here: super-annoying, sometimes even the restart doesn't fix it. I suppose it's a memory issue, since it often happens when working with a lot of open TS files: however, I didn't find a way to reset such state.Sn
Similar issue here: #72277144Semiweekly
B
2

please try the latest typescript version with the command:

npm install -g typescript@latest
Beardsley answered 26/4, 2022 at 4:44 Comment(1)
Tried that and it did not help in my case as I was already using the latest version of TypeScript it seems. 4.6.4 at time of writing.Semiweekly
W
2

I had the same problem with a large project that I copied over from an old machine on my new one. After searching around I found the answer. I found that the typescript types were not up to date so I firstly installed typesync by using the following command:

npm install -g typesync

Then in the clientapp folder I ran it (as it looks for the package.json file):

typesync

After restarting the project all was good!

For more info please see - https://github.com/jeffijoe/typesync

Wag answered 17/5, 2022 at 11:42 Comment(3)
Tried that, did not help in my case but still good to know. There is typo in your command line which I can't fix because SO won't let you do edit of a single character.Semiweekly
Thanks for the feedback - corrected the typo! If you manage to find another solution, I would be interest in itWag
For now I'll use Visual Studio Code until they fix it…Semiweekly
D
1

We also faced similar issue when we opened projects in VS 2022. They were working fine previously in 2019. The fix was simple in our case.

Steps:

  1. Added tsconfig.json file (we did not had this file in our project previously)
  2. Then indicate the typeRoots path where you have the typedefinition files

{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "typeRoots": [ "/Scripts/typings" ]
  },
  "exclude": [
    "node_modules",
    "wwwroot"
  ]
}

Now, clean the solution and rebuild. It worked for us. I hope it helps.

If anyone has a better solution, please advise.

Draw answered 9/9, 2022 at 18:38 Comment(3)
I've tried it.... but it still doesn't work. Lately I think is something specific with Visual Studio 2022. I think it has to do with the background tasks.... that are never ending....Theatricalize
@DA what is the version of your VS 2022? If possible try updating to the newer version.Draw
Mine is Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.2.6Theatricalize

© 2022 - 2024 — McMap. All rights reserved.