microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.21k stars 12.52k forks source link

vscode stuck on Initializing JS/TS language features on Apple Silicon. #51927

Closed kartikbhalla12 closed 10 months ago

kartikbhalla12 commented 1 year ago

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

Steps to Reproduce:

  1. Created a React-Native Project based of typescript, and have path alias added in babel.config.js and tsconfig.json
  2. When project opens, it shows initialising JS/TS features and disappears normally
  3. After some time (around 10 mins while developing in code, this randomly appears and never stops).
  4. This, stops intellisense to work and have to manually restart TS server

I have tried all the possible solutions provided in microsoft/vscode#68896 and none of them seem to work. I have tried clearing cache and re-installing vscode but issue still seems to persist.

After manually restarting ts server, this message doesn't seem to persist and works normally but after sometime again this appears

Attaching TS server logs and babel.config and tsconfig

babel.config.js

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
  plugins: [
    [
      'module-resolver',
      {
        root: ['./src'],
        extensions: ['.ios.js', '.android.js', '.js', '.ts', '.tsx', '.json'],
        alias: {
          '@assets': './src/assets',
          '@api': './src/api',
          '@app': './src/app',
          '@components': './src/components',
          '@config': './src/config',
          '@constants': './src/constants',
          '@content': './src/content',
          '@hooks': './src/hooks',
          '@icons': './src/icons',
          '@interfaces': './src/interfaces',
          '@navigation': './src/navigation',
          '@screens': './src/screens',
          '@services': './src/services',
          '@styles': './src/styles',
          '@types': './src/types',
          '@utils': './src/utils',
        },
      },
    ],
    ['react-native-paper/babel'],
    ['optional-require'],
  ],
};

tsconfig

{
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "@api/*": ["api/*"],
      "@app/*": ["app/*"],
      "@assets/*": ["assets/*"],
      "@components/*": ["components/*"],
      "@config/*": ["config/*"],
      "@constants/*": ["constants/*"],
      "@content/*": ["content/*"],
      "@hooks/*": ["hooks/*"],
      "@icons/*": ["icons/*"],
      "@interfaces/*": ["interfaces/*"],
      "@navigation/*": ["navigation/*"],
      "@screens/*": ["screens/*"],
      "@services/*": ["services/*"],
      "@styles/*": ["styles/*"],
      "@types/*": ["types/*"],
      "@utils/*": ["utils/*"]
    },
    "skipLibCheck": true
  },
  "extends": "@tsconfig/react-native/tsconfig.json"
}

tsserver.log

vscodenpa commented 1 year ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.74.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

mjbvz commented 1 year ago

I think you may have attached the wrong log file. Can you please try uploading it again?

kartikbhalla12 commented 1 year ago

@mjbvz my bad sorry, re-attaching the file on this comment as well with the issue

tsserver.log

mjbvz commented 1 year ago

Thanks. Do completions and other IntelliSense feature work when you see the initializing indicator?

kartikbhalla12 commented 1 year ago

Hey @mjbvz, unfortunately they don't work when this is visible

mjbvz commented 1 year ago

Looks like the last message in the log is:

Info 1029 [11:37:16.996] Reloading configured project /Users/kartik.bhalla/Desktop/Projects/study-abroad-mobile-app/tsconfig.json
Info 1030 [11:37:16.996] event:
    {"seq":0,"type":"event","event":"projectLoadingStart","body":{"projectName":"/Users/kartik.bhalla/Desktop/Projects/study-abroad-mobile-app/tsconfig.json","reason":"Change in config file detected"}}

This suggests that TS may be trying to load the project when it gets stuck but it's hard to tell since nothing else is logged. Any ideas @sheetalkamat?

kartikbhalla12 commented 1 year ago

@sheetalkamat let me know if you need any further logs from my end.

Thanks.

sheetalkamat commented 1 year ago

Are you still able to repro this issue.

In the logs I see that tsserver is getting notifcation that file: /Users/kartik.bhalla/Desktop/Projects/study-abroad-mobile-app/tsconfig.json is changed. There seem to be many notifications oif that which keeps reloading the project. Can you please share the complete project along with the repro tsserver log so i can try to run similar steps to try it out locally to see what could be causing this.

kartikbhalla12 commented 1 year ago

Hi @sheetalkamat

I'm still facing the same issue. I won't be able to share the source code for this project as this is for the company I'm working with (upGrad).

However, I'll create a new project with the same configuration and will share it with you this weekend. Hope that's okay with you.

bennyk8y commented 1 year ago

Our entire development team suffer from this issue as well. Not sure its related to Apple Silicon or not, but our setup is different as its pnpm monorepo (e.g without babel). Iv'e shared our codebase with VSCode team.

Ambroza888 commented 1 year ago

Any solution to the issue? I am having the same issue and it is breaking everything ... It keeps spinning and stopping 'Initializing JS/TS language features'

I reinstalled the Vscode, moved to a different folder repo, used the insider version, and followed the comment in the logs it kept 'detecting change in the tscofing.ts'

It keeps happening ... ;/

Ambroza888 commented 1 year ago

This one will fix your issue. https://www.codejourney.net/how-to-fix-visual-studio-code-intellisense-loading-infinitely/

Also if you open two repos in one folder for example MAIN FOLDER -> FE repo & BE repo make sure you enter inside of the BE or the FE and then follow the steps from the link I sent.

Happy coding.

jakebailey commented 1 year ago

Can someone provide the verbose logs? That's what was requested. A description of them like "keeps detecting changes in tsconfig" is helpful, but not as good as the logs, which is what was requested.

kartikbhalla12 commented 11 months ago

@jakebailey these are the verbose logs only, I was not able to get more detailed logs than these. PS. still facing the issue.

c0nf1gur4t0r commented 10 months ago

Same problem here!

sheetalkamat commented 10 months ago

@kartikbhalla12 to me this looks like it should have fixed with #56403 Can you try typescript nightly and see if this is fixed. Thanks

kartikbhalla12 commented 10 months ago

@sheetalkamat this seems to working fine now. Was waiting for this for a long time. Thanks a lot!

ssadel commented 4 months ago

for me, deleting node_modules + ts compiled dir fixed my issue

sadjow commented 2 days ago

If you encounter this issue, go to the output tab next to the terminal, select the Extension Host option, and you will see which extension is causing the initialization to freeze. You will need to uninstall it until the extension is updated to fix the issue.