sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.26k stars 202 forks source link

VS Code extension causing JS/TS language service crashes last couple of days #2489

Open ahkelly opened 2 months ago

ahkelly commented 2 months ago

Describe the bug

type intellisense is perpetually in "loading state" and the VS code typescript plugin is repeatedly crashing returning ultimately the following notice.

"The JS/TS language service crashed 5 times in the last 5 Minutes. This may be caused by a plugin contributed by one of these extensions: svelte.svelte-vscode Please try disabling these extensions before filing an issue against VS Code."

image

image

Reproduction

Install vs code in wsl ubuntu and a normal svelte install with default options (svelte 4) using javascript with JSDoc checking.

jsconfig.json

{
    "extends": "./.svelte-kit/tsconfig.json",
    "compilerOptions": {
        "allowJs": true,
        "checkJs": true,
        "esModuleInterop": true,
        "forceConsistentCasingInFileNames": true,
        "resolveJsonModule": true,
        "skipLibCheck": true,
        "sourceMap": true,
        "strict": true,
        "moduleResolution": "bundler"
    }
    // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
    // except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
    //
    // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
    // from the referenced tsconfig.json - TypeScript does not merge them in
}

Expected behaviour

Normal behaviour is the language server not crashing in vs code.

System Info

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

jasonlyu123 commented 2 months ago

I can't reproduce this can you follow this instruction to get the log of TSServer and see if there is any error in it? https://github.com/microsoft/TypeScript/wiki/Getting-logs-from-TS-Server-in-VS-Code

ahkelly commented 2 months ago

Hallelujah! I believe I have found the culprit. I took a look at any major changes I may have made in last few days that could have also contributed to it and I remembered I started integrating google cloud apis into our application which I disabled because at build time I was getting the ugly circular reference node error as mentioned and unresolved here

https://github.com/googleapis/google-auth-library-nodejs/issues/1539

I reverted my code but left the packages installed so I could get back to this once finding a resolution. These packages (all from google) were

I removed them today completely and restarted vs code and presto problem solved so they were clashing with this extension (not sure which one or all of them)

jasonlyu123 commented 2 months ago

I still can't reproduce the problem with all three libraries installed. But seems like you have solved your issue so I'll close this in a few days if there is no further info we can investigate.

ahkelly commented 2 months ago

OK, So the issue does still pop-up from time to time but not always like it was before I uninstalled the aforementioned packages. The only somewhat consistent thing I can see that "may" be the cause is that whenever I have some invalid JavaScript code (invalid expression or function for example) this seems to trigger the freak out if I leave the code uncorrected for an extended period of time.

Info 1319 [15:38:25.490] Starting updateGraphWorker: Project: /home/andrewk/sites/cj-app-sveltekit/jsconfig.json
Err 1320  [15:38:25.490] Exception on executing command {
  "seq": 119,
  "type": "request",
  "command": "quickinfo",
  "arguments": {
    "file": "/home/andrewk/sites/cj-app-sveltekit/src/routes/app/api/report/purchase_order/+server.js",
    "line": 21,
    "offset": 28
  }
}:

    Debug Failure. False expression.

Sounds like it may be something unique to my installation so probably not worth looking any further until I can reliably find more reproduction steps and I am not going to spam you with the tons of log data that has been generated as most of it is INFO lines and I don't see much in there that stands out.