Typescript: VSCode and intellisense are broken and unstable

Created on 20 Jun 2019  ·  11Comments  ·  Source: microsoft/TypeScript

  • VSCode Version: 1.35.5
  • OS Version: Linux Elementary OS

Steps to Reproduce:

  1. Open a TS project with VSCode.
  2. Either:
    *Remove the node_modules folder
    *Reinstall/delete/add a new npm package
    *Use npm/yarn link
  3. Intellisense breaks. When removing packages, you will get a bunch of errors, which is normal. But installing back everything doesn't update TS state.
    Somehow VSCode bugs and gets stuck at a previous state. In the case of npm link sometimes it doesn't recognize the package being added.
    When that happens, in most cases, TS server shuts down and any Intellisense feature is infinitely "Loading..." when required.
    Though, sometimes things work out when I trigger autocomplete and everything is back to normal.

I have to restart VSCode or the TS Server all the time to refresh intellisense.
It just seems that VSCode cannot reliably react to any kind of file changes.

It's been like that since forever as far as I recall, however, the last few updates just made things worse I guess. I've never had a 100% reliable TS experience.
With the latest update, syntax highlighting stops working randomly too.

Does this issue occur when all extensions are disabled?: Yes it does.

Bug Fix Available

Most helpful comment

This seems to be Linux and potentially macOs specific issue and result of https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_inodes inode watching. Looking into fix for this issue. Thanks

All 11 comments

This seems to be related to this issue: https://github.com/microsoft/vscode/issues/71751

@sheetalkamat I suspect this is related to the file watcher. Simple repo:

  1. Create a new angular project ng new app
  2. Open in VS Code and open a ts file
  3. Now delete node_modules
  4. Intellisense hangs for ~a minute
  5. Now npm install
  6. Another hang

In the larger VS Code repo, doing these steps can cause the server to get into a state where it never seems to finish loading

Hi, I too seem to have this issue. Open a newly created Angular repo in VS code, don't know if this is related to any extennsion. Intellisense doesn't seem to work at all. All I get is "Loading...". Sometimes is works randomly, other times it doesn't all. This is a productivity killer and it is very annoying.

image

@sheetalkamat If that can help, I found that refreshing the tsconfig.json (ie, deleting a character, undoing and saving the file) makes TS works again like usual.
But it's still annoying to do so every time you yarn add something and TS breaks.

@venky76v When that happens, do you see the "Initializing TS/JS languages features" at the bottom-left in the status bar? If so then that's normal that Intellisense doesn't work right after opening an Angular repo because VSCode needs to initialize the TS features first.

we have this issue as well. changing some types lead to a „stuck“ typescript experience. changing between integrated and workspace version (basically restarting typescript) fixes the issue until it breaks again.

@sheetalkamat If that can help, I found that refreshing the tsconfig.json (ie, deleting a character, undoing and saving the file) makes TS works again like usual.
But it's still annoying to do so every time you yarn add something and TS breaks.

@venky76v When that happens, do you see the "Initializing TS/JS languages features" at the bottom-left in the status bar? If so then that's normal that Intellisense doesn't work right after opening an Angular repo because VSCode needs to initialize the TS features first.

Hi, As soon as I open a Angular repo, I see the initializing JS/TS features on the status bar. After this the message is gone. Now opening a ts file, say app.component.ts file and type this. + control + spacebar, all I see "Loading..." like so below:
image

If I leave the VS window and come back to it after a few minutes, like write this reply and then come back and hit control + space bar, I see the intellisense working. This is a productivity killer and it also kills your flow of throught, as well the behavior being totally inconsistent.

image

Hi, As soon as I open a Angular repo, I see the initializing JS/TS features on the status bar. After this the message is gone. Now opening a ts file, say app.component.ts file and type this. + control + spacebar, all I see "Loading..." like so below:

I see. This is not really the issue I am describing. I suggest you look into others issue. I recall seeing something similar elsewhere. Do you still have that problem with all extensions disabled?
The problem that @OneCyrus and I are facing is that Typescript breaks when a file changes.

Just right now I cloned a git monorepo. Naturally, the packages were not installed, so Typescript was signaling 'modules not found' left and right. Even after I ran yarn and lerna to bootstrap and link all the packages in the repo Typescript was still stuck at its previous state. I once again had to reload the TS server.

Not 100% sure if related - but seems to fit -, but I have been finding that ts server and tsc sometimes will just stop listening for file changes, as in, if you make a change to a file, it doesn't get picked up to trigger a incremental compilation.

This seems to be Linux and potentially macOs specific issue and result of https://nodejs.org/dist/latest-v10.x/docs/api/fs.html#fs_inodes inode watching. Looking into fix for this issue. Thanks

I can confirm I have this issue and I can agree it's related to file watching. I'm using macOS 10.14.6.

https://github.com/microsoft/TypeScript/pull/35615#issuecomment-564263744 is the fix for this. Feel free to try it out and provide feedback. Thanks

Was this page helpful?
0 / 5 - 0 ratings