Typescript inspections sometimes unreliable and/or slow

There are times when TS inspections are slow -- meaning when I fix an error, WS can take several seconds or even longer to clear the error.

Other times, it seems like it never wants to clear the error.  I have to delete the code I just typed, type it again, then WS is satisfied.

Still other times, there are false positives -- WS doesn't report a TS error when it should have.

Has anyone else noticed this?  Is this a WS or TS issue?

21
46 comments
Avatar
Permanently deleted user

Hi,

I am facing the same issue(slowness in autocomplete(~10 sec) and in inspection/clearing errors) with version 2018.2.1. I tried the following things but no luck -

  1. Invalidate Cache and restart.
  2. Changed the typescript version to bundled.
  3. Turned off TS language service.

Please help. Other developers in the team are also facing the same issue.

5
Avatar
Permanently deleted user

I am experiencing this also Webstorm 2018.2.5. It is a bit frustrating to know that a quality tool has this kind of shortcoming, especially when there is a free alternative that is lightning fast. Please fix this.

5

 

This is still not resolved in IntelliJ 2018.2.5

The problem exists both for Windows and Ubuntu and it looks like it is a known issue for people who are using TS / Angular so they are just using VS Code instead.

2

Any updates about it? Checking types errors through IDE is still very slow.

2

Still in issue for me. Sometimes the parses messes up in the middle of a variable. So for

```

const someVar = 'blabla';

```

it might give me a warning that the variabl is not used only for  `some` (which is not correct).

 

This issue started to appear since the latest update.

2
Avatar
Permanently deleted user

"My thinking now, considering the comments, is a slowliness introduced on large projects using Angular, especially when using HTML templates inside the .ts files."

It's not just Angular. We have a React project with about 45K LOC and I just measured how quickly the problems reported by Webstorm (2019.1.2) update compared to VS Code (1.34). One change I tested was 3 sec. vs. 1 sec., another one 15 sec. vs. 5 sec. (Admittedly, there's probably something wrong with my OS but it still seems like the percentage-wise performance difference is consistent)

2
Avatar
Permanently deleted user

Thank you, invalidating the caches helped a little bit.  However, inspections, and clearing errors, is still sometimes slow/delayed.  For example, when I make an update to an interface in a types file, then use those definitions in some code, it sometimes takes several seconds (20, 30, more?) to recognize  that the type changed, and for the inspector to be happy again.

I'm on WS 2017.2.5.  I'm using the typescript service with TS 2.6.2.

1

I just updated from 2018.1 --> 2018.1.5 and it seems to be fixed! Thank you so much. This is truly wonderful news!

1
Avatar
Permanently deleted user

Done.

1
Avatar
Permanently deleted user

@Neelabh, Could you provide a link to the reported ticket?

1

That was my original thinking too Nathan. However with for the same project, VSCode (relying on TS Language Service too) is much faster for type updates (display errors, ...) than Webstorm / IntelliJ. So it's the not the Language Service that is slow here. My thinking now, considering the comments, is a slowliness introduced on large projects using Angular, especially when  using HTML templates inside the .ts files.

Though it's hard to find the exact culprit here, so I never took time to open a support ticket. I don't know what to put that could be useful to the devs, expect my "gut feeling".

1

Still unalterable slow on Webstorm 2022.1.3. Not the beefiest machine, and we use some of complex typescript features - but the codebase isn't huge. I appreciate that at some point you just have to throw more power at the problem or refactor the code to easier for the typescript service to analyze, but some diagnostic tips would be great. eg.: if webstorm detects that inspection result from the typesscript service is slow, it could ask to run some diagnostics. *Some* tooling for this surely exist?

https://github.com/microsoft/TypeScript/wiki/Performance

1

I have a problem with variable names not updating quickly when changed.

For example, if you change the name of a variable, or the name used in an import statement, you'll see "Unused import specifier xxx" over and over again with each keystroke.

I tried File -> Invalidates Caches, but that didn't help. This happens almost every time.

Settings -> Languages & Frameworks
TypeScript language service : checked
 - Show project erros : checke
 - Recompile on changes : checked

I am so stressed out.
I'm considering whether I shouldn't use IntelliJ anymore.

1

please try invalidating caches (File | Invalidate caches, Invalidate and restart) - does the issue persist?

Also, do you have typescript service enabled in Settings | Languages & Frameworks | TypeScript? if yes, what Typescript and IDE versions do you use?

0

Try changing Typescript version to the bundled one - does it help? Typescript 2.6 includes breaking API changes that cause problems using TSServer integration; issue is fixed in 2017.3

0
Avatar
Permanently deleted user

I have noticed this issue as well and it's quite a damper on productivity. I recently just updated webstorm to 2017.3.4 and typescript inspection times have gone from 5-10s (which I thought was really slow) to almost 20s. I've tried the following:

  • using the bundled version of typescript (2.6.2) (running on node 8.9)
  • Ensuring 'Show Project Errors' is not enabled. 
  • Invalidated cache and restart as recommended above.

 

Any other ideas?

0

Try disabling typescript language service - does the issue persist?

0
Avatar
Permanently deleted user

The responsiveness of inspections is certainly better without the typescript service enabled. TSC service tends to take around 10s on my machine to report the simplest type error. Without the tsc service it's close to 5s. 

0
Avatar
Permanently deleted user

https://imgur.com/a/Kg7F2 is the tsconfig.

 

How should I provide you cpu snapshots?

0

You can upload them to  ftp://ftp.intellij.net/.uploads/ and let me know the file names

0
Avatar
Permanently deleted user

I uploaded them via the upload service. FTP was giving me some trouble. The zip file is named WS-173.4548.30_ryanquinn_26.02.2018_15.42.42.zip. Thank you!

0

Please can you provide the full tsconfig.json? What does the `'include': []` section look like?

 

0

your package.json, information about the project structure and screenshot of Typescript settings page would be also appreciated

0
Avatar
Permanently deleted user

I've uploaded the contents you've asked for under a zip file named 'webstorm_files_rquinn_2_28.zip'. I very much appreciate your time! Thank you for the help!

0

Please try moving "typescript" from "dependencies" to "devDependencies" in your package.json.

Also I'd suggest trying 2018.1 EAP (https://www.jetbrains.com/webstorm/eap/) - it includes some fixes in this area

0
Avatar
Permanently deleted user

Okay so I think I have a decent reproducible case where Jetbrains has major performance issues with Typescript but VS Code handles the exact same code with absolutely no problem. I'm hoping that this helps track down whatever is causing the significant performance problems with Jetbrains and Typescript.

The repo is https://github.com/kpdonn/kpd-router , it's just a messy personal repo I've been testing out some typescript ideas on so I'll give you exact step by step directions I used to reproduce the performance problem in IntelliJ and then steps to show that the same code has no problems in VSCode.

IntelliJ 2018.1 EAP

  1. From command line run `git clone https://github.com/kpdonn/kpd-router 
  2. `cd kpd-router`
  3. `yarn install`
  4. Start IntelliJ
  5. From IntelliJ launch window I chose "Open", and then navigated to the kpd-router directory
  6. I waited for IntelliJ to finish the initial indexing 
  7. Verified on the "Preferences | Languages & Frameworks | Typescript" settings page that I was using the project's typescript service from `kpd-router/node_modules/typescript`. This is important because the project is using nightly typescript features not in the stable release yet.
  8. Now open the file `kpd-router/typings-tests/no-errors.tsx` for editing in IntelliJ
  9. Go to the last line of the file (line 104)
  10. On line 104 start typing the exact same thing as line 103 and try to autocomplete after typing 3 characters: "nr."
  11. For me it spins indefinitely waiting to autocomplete. I've waited as long as a minute just to see if it ever finishes but so far it never has for me(EDIT: I just let it sit and autocomplete while I was away from the computer for 15 minutes. It did finish at some point during that time which confirms that it is a performance issue and not a bug that causes it to never complete at all). The code that it's trying to autocomplete is dynamically generated and kind of complex, but that is no explanation for the unresponsiveness. VSCode handles the exact same situation instantly.

 

VSCode latest stable version

  1. Install VSCode and make sure JS and typescript extensions are installed(I had to click to install them from welcome page after starting up VSCode first time)
  2. From command line run `git clone https://github.com/kpdonn/kpd-router
  3. `cd kpd-router`
  4. `yarn install`
  5. Start VSCode
  6. From VSCode welcome page I selected "Open Folder" and opened the `kpd-router` folder
  7. Open the file `kpd-router/typings-tests/no-errors.tsx`
  8. In the status bar (bottom right of screen for me) by default it will be using the bundled VSCode stable typescript version 2.7.1. We need to change it to the project's typescript version so click the "2.7.1" and then click "Use Workspace version" in the modal that pops up.
  9. The typescript version in the status bar should now say "2.8.0-dev.20180228"
  10. Go to the last line of the file (line 104)
  11. On line 104 type "nr." just like line 103 above you. Notice how it instantly autocompletes unlike IntelliJ.

My understanding is the Typescript language service has built in functionality for autocomplete (among other things). It seems like that built-in functionality works very well based on how responsive VSCode is. IntelliJ must be trying to do something above and beyond the language service. I would really love it if when we select the "Typescript Language Service" option, IntelliJ delegated everything possible to it and tried to add nothing extra on top.

I'm very happy with IntelliJ when it comes to Java and I really dislike having to use separate IDEs for Java in the backend and Typescript in the frontend, but that's where I'm at right now because of the poor IntelliJ Typescript performance so I'm hoping it will be improved.

0

@kpd, thanks. Logged as https://youtrack.jetbrains.com/issue/WEB-31528, please follow it for updates

0
Avatar
Permanently deleted user

I got a copy of @kpd's message in my email, but it doesn't appear here.  What happened to it?

0

@Grid T it's 'pending approval' and only visible to admins; you'll see it later

0

Please sign in to leave a comment.