Vetur: Getting code actions from ''Vetur', 'Eslint'' takes too long!

Created on 12 Aug 2020  路  60Comments  路  Source: vuejs/vetur

  • [x] I have searched through existing issues
  • [x] I have read through docs
  • [x] I have read FAQ

Info

Problem



Since I upgraded Vetur from 0.25.0 to 0.26.1, after I edit and save .vue files, vscode get stuck with this promote:
image
even though the change is very mirror. I have to downgrade to 0.25.0 to avoid this !

local eslint version is [email protected]
here is my vsocde setting:

{
    "vetur.format.defaultFormatterOptions": {
        "prettier": {
            "semi": false,
            "singleQuote": true,
            "tabWidth": 4
        }
    },
    "vetur.validation.template": true,
    "vetur.format.options.tabSize": 4,
    "vetur.format.defaultFormatter.js": "prettier-eslint",
    "[vue]": {
        "editor.defaultFormatter": "octref.vetur"
    },
    "vetur.format.defaultFormatter.html": "prettier",
    "eslint.alwaysShowStatus": true,
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "vue",
        "typescript",
        "typescriptreact"
    ],
    "eslint.options": {
        "extensions": [
            ".html",
            ".js",
            ".vue",
            ".jsx"
        ]
    }
}

Reproducible Case

bug perf

Most helpful comment

I meet the same issue on Win as well. Downgrading to 0.25.0 temporarily solve problem

All 60 comments

I meet the same issue on Win as well. Downgrading to 0.25.0 temporarily solve problem

I have the same problem, too

Not sure if this is not another extension I have but just throwing it out there - does anybody's code sometimes get mangled (eg. one line gets duplicated) after Vetur + Eslint code actions finish after a long time?
eg.
before code actions start to run: props: ['foo']
after code action finish: props:['foo']ops['foo']

@3nuc This happens for me sometimes, when I cancel the long running action. Maybe eslint/prettier related?

I'm having the same issue, any solutions/workarounds? :)

Edit: The only thing that works is exiting VSCode and reopen the project. How to provide debug info?

Edit 2: This is on Linux using the latest VSCode.

  • Does this reproduce when you only have Vetur extension enabled? (Especailly with ESLint disabled)
  • Does setting "eslint.codeActionsOnSave.mode": "problems" help?

@octref

Does this reproduce when you only have Vetur extension enabled? (Especailly with ESLint disabled)

For me, yes. When I have both vetur and eslint enabled I am getting the same message as @daolanfler

Saving 'Test.vue': Getting code actions from ''Vetur', 'ESLint'' (configure)

and it hangs for 5 to 7 seconds. Disabling eslint doesn't fix it, Also, one important thing I have to add here is that the mentioned message is shown only once when I try to save .vue file with lint problems. After the message disappears, saving the same file or any other .vue file with lint problems is immediate.

Does setting "eslint.codeActionsOnSave.mode": "problems" help?

Nope.

I've had this issue for quite a long time. I'm using TS in a Quasar project and after a fresh open of VS Code and starting the dev server it works fine for a while. After about a half hour of use, it starts taking a very long time to finish linting lines before save. When saving, if the before-save linting didn't quite finish, I get the code actions pop up for up to half a minute. On a pretty powerful computer, so that shouldn't be the issue

I'm not sure, but it seems to be related to this issue https://github.com/microsoft/vscode/issues/101555. My hunch is that incomplete save participants are hanging around in a process which ends up slowing everything down. I don't have any way to prove or reproduce, but they both seem to happen around the same time.

@octref Just to confirm here the setting doesn't fix the 'Getting code actions from..' hang.

Another observation I found that the issue occurs if try to format or save in a specific workspace. The extensions works perfect if I change the project workspace.

Temporary fix I use: > Developer: Restart extension host. After that linting/saving is fast but it slows down again over time. Must be something is causing the work for the linting process to pile up every time it runs? Based on how the highlighted errors change throughout the process, it's as if it's trying to lint every previously linted version of the file. Issue also seems way more pronounced on my linux laptop than on my powerful windows desktop. I hope this gets fixed soon, it's been bugging me for too long.

Temporary fix I use: > Developer: Restart extension host. After that linting/saving is fast but it slows down again over time. Must be something is causing the work for the linting process to pile up every time it runs? Based on how the highlighted errors change throughout the process, it's as if it's trying to lint every previously linted version of the file. Issue also seems way more pronounced on my linux laptop than on my powerful windows desktop. I hope this gets fixed soon, it's been bugging me for too long.

This doesn't work for me on mac :/

Edit: Instead vscode is taking 100% CPU after restarting extension host.

I'll make a setting that disables codeActions in Vetur. Try it and let me know if the situation improves.

I'll make a setting that disables codeActions in Vetur. Try it and let me know if the situation improves.

Waiting up..

How about disabling eslint code action from eslint in Vue files? Keeping only vetur actions.

{
"editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "[vue]": {
    "editor.codeActionsOnSave": {
      "source.fixAll.eslint": false
    }
  },
}

Would that help? I tried on my local, will report soon.

It seems to work and keep both extensions at bay.

Caveat: template autofix will not be proceeded.

@elevatebart So in your case it's ESLint hanging up, not Vetur, is that correct?

It's the two waiting for each other I believe.

May be this isn't the expected solution but I managed to fix it by resetting all the stuff.

  1. Take backup of your settings.json
  2. Remove all extensions and restart vscode (In my case, I removed Vetur, EsLint, Go, Beautify, TODO)
  3. Install all the extensions again
  4. Open User Settings -> Search for Formatters
    Screenshot 2020-09-13 at 12 12 47 PM

  5. Select Vetur -> Format -> Default Formatter (HTML)===> Change default to prettier
    Screenshot 2020-09-13 at 12 13 18 PM

  6. Go to Prettier config and Make sure no boxes are checked
    Screenshot 2020-09-13 at 12 14 25 PM

and done !

Above steps fixed Vue Formatting for me,. (It does not get stuck on loading now)..

@imtiyazs This doesn't fix the issue, I have reinstalled and cleaned my settings a few times already. The issues can be triggered when dealing with multiple formatting issues. Downgrading does make it trigger less, but still it seems to happen because some extensions seem to waiting for each other.

@imtiyazs This doesn't fix the issue, I have reinstalled and cleaned my settings a few times already. The issues can be triggered when dealing with multiple formatting issues. Downgrading does make it trigger less, but still it seems to happen because some extensions seem to waiting for each other.

Um.. Pretty hard to find exact scenario. I faced this issue in one of the repo. After switching the repo, the extensions worked perfectly (Without any change in settings). Later, I followed above steps for the same problematic repo and extensions started working perfectly like before..

One important thing, I changed default formatters of Vetur that made it work perfectly. You can check above images 4,5 and 6.

Is there any resolution ? It's seems that my vscode is awayls being blocked by this.

Is there any resolution ? It's seems that my vscode is awayls being blocked by this.

Can you try these settings?

{ "eslint.alwaysShowStatus": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "html.format.contentUnformatted": "", "javascript.format.enable": false, "eslint.options": { "extensions": [".html", ".js", ".vue", ".jsx"] }, "editor.codeActionsOnSave": { "source.fixAll.eslint": true }, "editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace", "editor.fontLigatures": true, "editor.fontSize": 14, "window.zoomLevel": 0, "vetur.format.defaultFormatter.js": "vscode-typescript", "vetur.format.defaultFormatter.html": "prettier", "javascript.format.insertSpaceBeforeFunctionParenthesis": true, "explorer.confirmDelete": false, "git.autofetch": true, "editor.formatOnSave": true }

with formatting ;):

{
  "eslint.alwaysShowStatus": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "html.format.contentUnformatted": "",
  "javascript.format.enable": false,
  "eslint.options": { "extensions": [".html", ".js", ".vue", ".jsx"] },
  "editor.codeActionsOnSave": { "source.fixAll.eslint": true },
  "editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
  "editor.fontLigatures": true,
  "editor.fontSize": 14,
  "window.zoomLevel": 0,
  "vetur.format.defaultFormatter.js": "vscode-typescript",
  "vetur.format.defaultFormatter.html": "prettier",
  "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
  "explorer.confirmDelete": false,
  "git.autofetch": true,
  "editor.formatOnSave": true
}

@elevatebart @imtiyazs thanks! I restart my mac and it's ok. Next time i will try the setting. 馃馃
But the strange thing is that i have more than one vscode running, but only one has problem and they use the same setting 馃槀馃槀

@elevatebart @imtiyazs thanks! I restart my mac and it's ok. Next time i will try the setting. 馃馃
But the strange thing is that i have more than one vscode running, but only one has problem and they use the same setting 馃槀馃槀

Yea, that's what I mentioned few comments above.. The behaviour depends on your workspace or project folder too..

Someone gave me a hint about auto closing tags. That few auto closing tags might create issue for linters. However, didn't get any chance to test that.

I added vetur.languageFeatures.codeActions. Try turning it off in the new version to see the issue still happens. If this is the cause I'll investigate further.

I added vetur.languageFeatures.codeActions. Try turning it off in the new version to see the issue still happens. If this is the cause I'll investigate further.

hi,octref, thank you very much for your work. But i can't find the version of 0.28.0 in my vscode, is it published?

I added vetur.languageFeatures.codeActions. Try turning it off in the new version to see the issue still happens. If this is the cause I'll investigate further.

hi,octref, thank you very much for your work. But i can't find the version of 0.28.0 in my vscode, is it published?

Same

@octref Thanks, how does this work? :)
Just vetur.languageFeatures.codeActions: false or some other value?

vetur.languageFeatures.codeActions: false unfortunately doesn't work for me, nothing has changed

vetur.languageFeatures.codeActions: false unfortunately doesn't work for me, nothing has changed

If you upgrade to v0.28.0 and restart vscode?

Yes, I am using 0.28.0 and I restarted vscode before checking this setting. Are there any other steps/ settings I can enable to debug this issue? I tried to reproduce this issue in a newly created project but failed so far. I will keep trying.

vetur.languageFeatures.codeActions

Thanks!
It working good for me now.

  1. I set "vetur.languageFeatures.codeActions": false
  2. Changed default formatter to prettier-eslint
  3. IT DIDNT WORK. GOT THE SAME ERROR.
  4. I set "vetur.languageFeatures.codeActions": true and again to false
  5. THEN IT STARTED WORKING PERFECT and now I am unable to reproduce it !

Lol. What's happening?

The new version and disabling codeActions worked great for me. I now get instant intellisence and instant saving. Fantatistic!

I get this issue right when Vetur is initializing in a large Project (eg. opening a .vue file), independent of Lint/codeAction Settings.
VueServerMain gets stuck at 99% CPU usage and the Vue Language Server does not shut down, when VSCode is terminated.

This issue started for me when updating from 0.25.0 to 0.26.0

A Workaround for me is:

  1. Start VSCode on small Project Folder with a Single Vue File and let Vetur Initialize. (Top position in workspace list)
  2. Add "Folder to Workspace" containing the Large Project

I usually cd into project directory and boot up vscode via "code ." in the project folder,
somehow vetur/vueServerMain seems to get overloaded this way.

In my case, the repo is also a pretty big mono repo. In smaller projects, it works fine.

The new version and disabling codeActions worked great!

PS: Restart VS CODE after disabling.

Vetur version 0.28.0

2374 might have fixed this. Please try the new version 0.29.0 when it's out. If it's not fixed, feel free to open a new issue.

@octref I haven't got the Eslint loading dialog in a while, seems to be fixed. :)

The new version and disabling codeActions worked great for me. I now get instant intellisence and instant saving. Fantatistic!

I know that I said this worked for me, but I stopped doing front end work for a while and focused on backend work. When I came back to the front end stuff this week, all Vue file editing was horrendous again. I am seeing a "saving" dialog on every save and the file is getting mangled as I edit. I have given up on intellisense and just typed away. When the system finally catches up, it has gone in and deleted chunks of the file and put in a bunch of semi colons etc.

I am on 0.28.0 and I am using vetur.languageFeatures.codeActions: false.

I will see if 0.29.0 fixes it.

The v0.29.0 is released.
You can try it.

It seems to be saving without the warning coming up and it doesn't seem to be corrupting the file. So it looks like it is fixed. I will keep an eye out over the next few days. Thank you very much for your work on Vetur!

0.29.0 nothing has changed for me :(

0.29.0 does not help with the VueServerMain getting stuck at 99% CPU, as soon as vetur activates.
Im Still Stuck using the older versions.
:/

@hendrikbunnick may I ask which version works best for you?

@sqal im using 0.25.0.

0.29.0 does not help with the VueServerMain getting stuck at 99% CPU, as soon as vetur activates.
Im Still Stuck using the older versions.
:/

If you can provide a repro case, we can debug it.
Please read https://github.com/vuejs/vetur/blob/master/.github/NO_REPRO_CASE.md and open a new issue.

If you don't want to make it public, you can email me directly.

0.29.0 doesn't fix it for me as well

0.30.0 seems to be working for me.

0.30.2 is not working for me, still the same issues as after 0.25.0

0.30.2 is not working for me, still the same issues as after 0.25.0

https://github.com/vuejs/vetur/issues/2150#issuecomment-721039861

I don't think it's a problem with Vetur but with VS Code. Getting the same popup every time I save and it's just a simple TypeScript & ESLint project.

@MarvinRudolph there's this issue which has been open for a while as well:
https://github.com/microsoft/vscode-eslint/issues/1055

ESlint fixes were instantaneous on every files except .vue ones. Solved it with this setting: "vetur.validation.script": false,

Been working to fix this for 5 days now. Saving.. Getting code actions from "Vetur", "Eslint" on my monrepo takes alot of time.

[Trace - 13:38:41] Received response 'textDocument/codeAction - (7)' in 276674ms.
[Trace - 13:38:42] Sending request 'textDocument/formatting - (16)'.

[Trace - 13:39:50] Received response 'textDocument/hover - (8)' in 340344ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (9)' in 340145ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (10)' in 337802ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (11)' in 337293ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (12)' in 335211ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (13)' in 332737ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (14)' in 328641ms.
[Trace - 13:39:50] Received response 'textDocument/documentSymbol - (15)' in 118920ms.
[Trace - 13:39:52] Received response 'textDocument/formatting - (16)' in 70220ms.
[Trace - 13:39:52] Sending notification 'textDocument/didSave'.

Been working to fix this for 5 days now. Saving.. Getting code actions from "Vetur", "Eslint" on my monrepo takes alot of time.

[Trace - 13:38:41] Received response 'textDocument/codeAction - (7)' in 276674ms.
[Trace - 13:38:42] Sending request 'textDocument/formatting - (16)'.

[Trace - 13:39:50] Received response 'textDocument/hover - (8)' in 340344ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (9)' in 340145ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (10)' in 337802ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (11)' in 337293ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (12)' in 335211ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (13)' in 332737ms.
[Trace - 13:39:50] Received response 'textDocument/hover - (14)' in 328641ms.
[Trace - 13:39:50] Received response 'textDocument/documentSymbol - (15)' in 118920ms.
[Trace - 13:39:52] Received response 'textDocument/formatting - (16)' in 70220ms.
[Trace - 13:39:52] Sending notification 'textDocument/didSave'.

Wow, is it a big project?
What size is your project?

Was this page helpful?
0 / 5 - 0 ratings