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?

25 comments

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

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

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

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

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

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

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

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

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

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

Any updates on this? I'm struggling with what seems like the same issue described here.

0

@Dan, if you are talking about https://youtrack.jetbrains.com/issue/WEB-31528, it has been fixed in 2018.1.2.

 

If not, please provide details about your issue, your IDE and TS versions, if TS service is enabled in the settings, if it gets better when it is disabled, etc.

0

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

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.

2

please create a support ticket, providing CPU snapshots taken when the issue occurs (https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems), `package.json` and `tsconfig.*.json` file(s)

0

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

0

Please sign in to leave a comment.