vetur icon indicating copy to clipboard operation
vetur copied to clipboard

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

Open daolanfler opened this issue 3 years ago • 71 comments

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

Info

  • Platform: macOS
  • Vetur version:0.26.1
  • VS Code version: 1.47.3

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

daolanfler avatar Aug 12 '20 02:08 daolanfler

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

shiyu3169 avatar Aug 12 '20 03:08 shiyu3169

I have the same problem, too

AceYangWQ avatar Aug 12 '20 03:08 AceYangWQ

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']

sethidden avatar Aug 14 '20 21:08 sethidden

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

rs3d avatar Aug 15 '20 10:08 rs3d

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.

francoism90 avatar Aug 20 '20 14:08 francoism90

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

octref avatar Aug 26 '20 02:08 octref

@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.

sqal avatar Aug 28 '20 11:08 sqal

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

borie88 avatar Sep 03 '20 14:09 borie88

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.

bbugh avatar Sep 04 '20 20:09 bbugh

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

francoism90 avatar Sep 07 '20 08:09 francoism90

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.

imtiyazs avatar Sep 09 '20 08:09 imtiyazs

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.

Doeke avatar Sep 09 '20 09:09 Doeke

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.

imtiyazs avatar Sep 09 '20 13:09 imtiyazs

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

octref avatar Sep 09 '20 14:09 octref

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

Waiting up..

imtiyazs avatar Sep 09 '20 15:09 imtiyazs

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.

elevatebart avatar Sep 11 '20 16:09 elevatebart

It seems to work and keep both extensions at bay.

elevatebart avatar Sep 11 '20 16:09 elevatebart

Caveat: template autofix will not be proceeded.

elevatebart avatar Sep 11 '20 18:09 elevatebart

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

octref avatar Sep 12 '20 04:09 octref

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

elevatebart avatar Sep 12 '20 04:09 elevatebart

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 avatar Sep 13 '20 06:09 imtiyazs

@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.

francoism90 avatar Sep 13 '20 16:09 francoism90

@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.

imtiyazs avatar Sep 14 '20 05:09 imtiyazs

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

way2ex avatar Sep 16 '20 13:09 way2ex

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 }

imtiyazs avatar Sep 16 '20 13:09 imtiyazs

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 avatar Sep 16 '20 15:09 elevatebart

@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 😂😂

way2ex avatar Sep 16 '20 15:09 way2ex

@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.

imtiyazs avatar Sep 17 '20 09:09 imtiyazs

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.

octref avatar Sep 21 '20 12:09 octref

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?

way2ex avatar Sep 22 '20 02:09 way2ex