vetur
vetur copied to clipboard
Autocompletion incredible slow for easy tasks since VSC July 2021 update
- [x] I have searched through existing issues
- [x] I have read through docs
- [x] I have read FAQ
- [x] I have tried restarting VS Code or running
Vetur: Restart VLS
Info
- Platform: MacOS and Linux
- Vetur version: 0.34.1
- VS Code version: 1.59.0
Problem
We have a quite large Vue 2 project, most parts in typescript. The code completion on very easy types (e.g. a simple string array) is very slow. A cpu profile is attached. Its quite a mess to view, I can't read a lot from it. In this profile I invoked code completion on an array. It took about 15s to complete. CPU-20210816T144628.cpuprofile.zip
The vue-language-server outputs very often
[Error - 2:41:08 PM] Request textDocument/semanticTokens/range failed.
Message: Request textDocument/semanticTokens/range failed with message: Cannot read property 'flags' of undefined
Code: -32603
Please let me know if you need further information.
Same issue but for a Vue 2 project in JS (not TS). Saving takes up to 8 seconds in a ~300 lines single file component.
Same issue here, sometimes take MINUTES with TS components. (When auto completing file paths for imports)
Vue Language Server output spams Request textDocument/semanticTokens/range failed with message: Cannot read property 'flags' of undefined
More verbose log entries look like:
[2021-12-14 16:00:22.973] [renderer1] [error] Request textDocument/semanticTokens/full failed with message: Cannot read property 'flags' of undefined: Error: Request textDocument/semanticTokens/full failed with message: Cannot read property 'flags' of undefined at c:\Users\Douglas.vscode\extensions\octref.vetur-0.35.0\dist\vueMain.js:1:64858 at c:\Users\Douglas.vscode\extensions\octref.vetur-0.35.0\dist\vueMain.js:1:65153 at Immediate.
(c:\Users\Douglas.vscode\extensions\octref.vetur-0.35.0\dist\vueMain.js:1:65518) at processImmediate (internal/timers.js:461:21)
Perhaps this should be a bug, and not perf @yoyo930021?
I assume the problem is here: https://github.com/vuejs/vetur/blob/5651cd5ff61a81a1f85b557eba052dc84602c8c0/server/src/modes/script/semanticToken.ts#L113-L122
parentSymbol
can be undefined
perhaps? I have literally no idea what should be done in that instance though, or perhaps if the bug is further upstream and parentSymbol
should never be undefined?
Well, if I just return early if !parentSymbol
I actually get auto-completion again, it's just ~10-30+s or so per auto-completion (When auto completing file paths for imports). So that's progress at least...
It's weird, this project used to not have any issues here, now it does. Autocomplete for file paths is snappy in ts or js files, it's just bog slow/useless in vue files.
The TypeScript
output doesn't show any log entries when trying to resolve paths in a vue
file, but it does in a s
file? Is Vetur
doing this in it's own way?
I am now getting the following when trying to autcomplete paths:
[Error - 5:19:15 PM] (node:13768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag
--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 57) [Error - 5:19:21 PM] (node:13768) UnhandledPromiseRejectionWarning: Error: Debug Failure. False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 1, !entry: false at getDocumentRegistryEntry (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:129643:22) at acquireOrUpdateDocument (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:129651:40) at Object.updateDocumentWithKey (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:129639:20) at getOrCreateSourceFileByPath (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:157300:53) at Object.getOrCreateSourceFile [as getSourceFile] (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:157257:24) at findSourceFileWorker (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:113284:29) at findSourceFile (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:113194:26) at C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:113146:85 at getSourceFileFromReferenceWorker (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:113113:34) at processSourceFile (C:\Users\Douglas\Documents\Programming\3rd Party\vetur-master\server\node_modules\typescript\lib\typescript.js:113146:13) [Error - 5:19:21 PM] (node:13768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 58)