neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.06k stars 68 forks source link

`tsserver` crashing for invalid call #418

Closed alecandido closed 1 year ago

alecandido commented 1 year ago

This is the head of the error:

[coc.nvim]: UnhandledRejection: Error: <semantic> TypeScript Server Error ([object Object])
The "interval" argument must be of type number. Received undefined
and here the rest of the stack trace ``` TypeError [ERR_INVALID_ARG_TYPE]: The "interval" argument must be of type number. Received undefined at StatWatcher. (node:internal/fs/watchers:116:3) at Object.watchFile (node:fs:2380:39) at fsWatchFileWorker (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:7321:21) at /home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6897:133 at createSingleWatcherPerName (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6447:26) at pollingWatchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6897:20) at watchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6778:28) at watchMissingFileSystemEntry (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:7006:24) at fsWatchHandlingExistenceOnHost (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6911:17) at /home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6900:168 at createSingleWatcherPerName (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6447:26) at fsWatch (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6900:20) at Object.watchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:6784:28) at Object.watchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-vue/node_modules/@vuedx/typescript-plugin-vue/lib/standalone.cjs:166:16830) at watchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:118337:90) at Object.watchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:118363:34) at /home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:176746:44 at ProjectService.forEachConfigFileLocation (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:17679 6:38) at ProjectService.startWatchingConfigFilesForInferredProjectRoot (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/ lib/tsserver.js:176735:22) at InferredProject.addRoot (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:174926:37) at ProjectService.assignOrphanScriptInfoToInferredProject (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tss erver.js:176476:25) at ProjectService.assignProjectToOpenedScriptInfo (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js :178174:26) at /home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:178448:97 at Object.flatMap (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:524:25) at ProjectService.applyChangesInOpenFiles (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:178448: 41) at Session.handlers.ts.Map.ts.getEntries._a. (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserv er.js:179820:46) at /home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:182013:96 at Session.executeWithRequestId (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:182004:28) at Session.executeCommand (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:182013:41) at Session.onMessage (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:182041:35) at process. (/home/alessandro/.config/coc/extensions/node_modules/coc-tsserver/node_modules/typescript/lib/tsserver.js:186197:31) at process.emit (node:events:513:28) at emit (node:internal/child_process:937:14) at process.processTicksAndRejections (node:internal/process/task_queues:83:21) ```

coc-tsserver v2.1.0

chemzqm commented 1 year ago

at Object.watchFile (/home/alessandro/.config/coc/extensions/node_modules/coc-vue/node_modules/@vuedx/typescript-plugin-vue/lib/standalone.cjs:166:16830)

Seems bad watch arguments from coc-vue.

chemzqm commented 1 year ago

Try different tsserver by use tsserver.tsdk configuration.

alecandido commented 1 year ago

Seems bad watch arguments from coc-vue.

You're right, uninstalling coc-vue removes the issue.

Try different tsserver by use tsserver.tsdk configuration.

Which are the alternatives?

chemzqm commented 1 year ago

https://www.npmjs.com/package/typescript?activeTab=versions

alecandido commented 1 year ago

Ok, sorry. I thought you were referring to different packages, not different package versions.

  • tsserver.tsdk: Specifies the folder path to the tsserver and lib*.d.ts files under a TypeScript install to use for IntelliSense, for example: ./node_modules/typescript/lib. - When specified as a user setting, the TypeScript version from tsserver.tsdk automatically replaces the built-in TypeScript version. - When specified as a workspace setting, the tsserver is used when tsserver.useLocalTsdk is true. Use command :CocCommand tsserver.chooseVersion to choose different typescript version. Default: ""

Should I set just to the version number?

{
  "tsserver.tsdk": "4.9.4"
}

Because it seemed like I should have used chooseVersion for that:

  • tsserver.chooseVersion Choose different typescript version for current project.
chemzqm commented 1 year ago

Specifies the folder path to the tsserver and lib*.d.ts files under a TypeScript install to use for IntelliSense, for example: ./node_modules/typescript/lib.

It should be a file path to the lib folder.