Vetur: Linting / error-checking running VERY slowly

Created on 12 Apr 2019  路  28Comments  路  Source: vuejs/vetur

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

Info

  • Platform: Windows 10
  • Vetur version: 0.18.1
  • VS Code version: 1.33.1

I am also writing the code in TypeScript, latest version.

Problem

When writing code in .vue files, the error-checking functionality lags massively. Screenshot -- note how the error doesn't recognise the entire string (it takes many seconds to recognise it all).

In the Vue Language Server panel I get this output:

Loaded bundled [email protected]. Vetur initialized [Error - 09:29:27] Request textDocument/codeAction failed. Message: Request textDocument/codeAction failed with message: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isStringLiteral'. Code: -32603 [Error - 09:29:44] Request textDocument/codeAction failed. Message: Request textDocument/codeAction failed with message: Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isStringLiteral'. Code: -32603

Reproducible Case

Open up a .vue file in VS Code with Vetur installed which has <script lang="ts">...</script> and write some code, anything at all which should have errors. The error-checking / linting displays, such as the red underline and the popup when you hover over the bad code, will take a long time to recognise all of the error.

EDIT: Here is a picture showing how much CPU power and RAM VS Code is taking up when Vetur is in the process of error-checking: https://i.imgur.com/at1ikdf.png

need-more-info

Most helpful comment

I'm using typescript too, my teammate notice me that if a <script lang="ts"> block exists, then computer will keep burning.

All 28 comments

After update to the latest version, I have the same problem too.

Open up a .vue file in VS Code with Vetur installed which has and write some code

Can you try to fork https://github.com/octref/veturpack to get a repro? This doesn't repro for me.

Hi octref. I tried to reproduce the issue but couldn't, leading me to think it is likely something unrelated to Vetur. Thanks for responding to my issue.

@tedjenkins Can you show me code --list-extensions?

Also how large is your project?

Can you show me code --list-extensions?

dbaeumer.vscode-eslint
eg2.tslint
esbenp.prettier-vscode
felixfbecker.php-debug
felixfbecker.php-intellisense
felixfbecker.php-pack
HvyIndustries.crane
monokai.theme-monokai-pro-vscode
mrmlnc.vscode-apache
ms-python.python
octref.vetur
teabyii.ayu

Also how large is your project?

219MB, including node_modules. This is my package.json:

"dependencies": {
    "class-validator": "^0.9.1",
    "date-fns": "^1.30.1",
    "dotenv": "^7.0.0",
    "express": "^4.16.4",
    "mysql": "^2.16.0",
    "reflect-metadata": "^0.1.13",
    "typeorm": "^0.2.16",
    "validator": "^10.11.0",
    "vue": "^2.6.6",
    "vue-class-component": "^6.0.0",
    "vue-property-decorator": "^7.0.0",
    "vue-router": "^3.0.1",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@types/dotenv": "^6.1.1",
    "@types/express": "^4.16.1",
    "@types/jest": "^23.1.4",
    "@types/node": "^11.13.2",
    "@types/validator": "^10.9.0",
    "@vue/cli-plugin-typescript": "^3.5.0",
    "@vue/cli-plugin-unit-jest": "^3.5.0",
    "@vue/cli-service": "^3.5.0",
    "@vue/test-utils": "1.0.0-beta.29",
    "husky": "^1.3.1",
    "node-sass": "^4.9.0",
    "prettier": "1.16.4",
    "sass-loader": "^7.1.0",
    "ts-jest": "^23.0.0",
    "typescript": "^3.2.1",
    "vue-template-compiler": "^2.5.21"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{js,css,json,md}": [
      "prettier --write",
      "git add"
    ]
  }

@tedjenkins I have a feeling the perf issues are caused by your PHP extensions rather than Vetur. Can you run the command "Process Explorer" in VS Code to see which one is causing cpu/memory usage?

@octref Sure thing.

shot

I'm using typescript too, my teammate notice me that if a <script lang="ts"> block exists, then computer will keep burning.

@tedjenkins I have a feeling the perf issues are caused by your PHP extensions rather than Vetur. Can you run the command "Process Explorer" in VS Code to see which one is causing cpu/memory usage?

I do not use PHP extensions but I still get the same problems too.
I am using within <script lang="tsx"> block
ts version: 3.1.6 (using workspace version)
vscode version: 1.33.1
vetur version: 0.18.1

image
The first column is CPU % usage

Is there any more information you need @octref?

@octref
FYI, I v found that once I use 0.18.0 everything goes fine

@octref
FYI, I v found that once I use 0.18.0 everything goes fine

0.18.0 works a a little fast, but still slow, type checking and intellisence still slow.

Happens to me, too. No PHP extensions, using TypeScript and Vetur. Similar CPU stats. I notice it's a heck of a lot better (but still slow) in smaller files, but slows to an unbearable crawl on even _slightly_ bigger SFCs. Been this way for at least a month now, maybe more.

My extensions list:

> code --list-extensions
AlanWalk.markdown-toc
akamud.vscode-theme-onedark
anthonymoi.rivescript
bierner.github-markdown-preview
bierner.markdown-checkbox
bierner.markdown-emoji
bierner.markdown-preview-github-styles
bierner.markdown-yaml-preamble
bung87.rails
bung87.vscode-gemfile
castwide.solargraph
dbaeumer.vscode-eslint
dustinsanders.an-old-hope-theme-vscode
eamodio.gitlens
eg2.tslint
Equinusocio.vsc-material-theme
GrapeCity.gc-excelviewer
HookyQR.beautify
jacobkantzer.case-sensitive-add-next
karunamurti.haml
lkytal.coffeelinter
mkaufman.HTMLHint
ms-python.python
ms-vscode.Theme-MarkdownKit
ms-vscode.Theme-TomorrowKit
naumovs.color-highlight
neilding.language-liquid
octref.vetur
Orta.vscode-jest
PeterJausovec.vscode-docker
rebornix.ruby
robinbentley.sass-indented
sianglim.slim
vortizhe.simple-ruby-erb
wholroyd.jinja
zhuangtongfa.Material-theme

I'm experiencing slowness in latest version. Not sure what's causing it tho.

Also experiencing this. anyone have any leads as to what is causing this?

Received this error when saving a .vue file today.

Error

Please try to generate a profile and attach it to this issue. It'd help me a lot more than screenshots.
Instruction here: https://github.com/vuejs/vetur/blob/master/.github/PERF_ISSUE.md#profiling

There's a lot of file system activity going on. It seems to be caused by TypeScript.

What's your jsconfig/tsconfig, or you don't have one?

I also added some logging for your case. After I publish 0.19.4, can you set "vetur.dev.logLevel": "DEBUG", reload window and let me know what you get on Output -> Vue Language Server?

Debugger listening on ws://127.0.0.1:7000/e448e12c-a55b-4e56-8301-104ae439fad8
For help, see: https://nodejs.org/en/docs/inspector
Loaded bundled [email protected].
[DEBUG] Initializing ServiceHost with 16 files: [(all .ts files in project)]
Vetur initialized
Debugger attached.

And then when I edit files to get errors I receive:

Prettier format failed
[Error - 13:29:19] ';' expected. (5:6)
  3 | import { utils } from '@/utils';
  4 | import { hello } from '@/hello';
> 5 | cons hi
    |      ^
  6 | 
  7 | @Component({})
  8 | export default class SiteDashboard extends Vue {

etc.

My tsconfig.json is as follows:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "resolveJsonModule": true,
    "baseUrl": ".",
    "types": ["webpack-env", "jest", "node"],
    "paths": {
      "@/*": ["src/*"]
    },
    "lib": ["esnext", "dom", "dom.iterable", "scripthost", "es6"]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/unit/**/*.ts",
    "tests/unit/**/*.tsx"
  ],
  "exclude": ["node_modules", "tests/e2e/**/*.ts", "tests/e2e/**/*.tsx"]
}

I think the crux of this problem is that I try to load "all files specified from tsconfig.json", when Vetur only needs the *.vue files to work.

Just to prove my hypothesis, can you try this pattern and verify if Vetur's features work for you?

{
  "include": [
    "src/**/*.vue"
  ],
  "exclude": [
    "node_modules",
    "tests/e2e/**/*.ts",
    "tests/e2e/**/*.tsx"
    "src/**/*.ts",
    "src/**/*.tsx",
    "tests/unit/**/*.ts",
    "tests/unit/**/*.tsx"
  ]
}

@octref I think this may break ts files

@yoyoys I know...Just to see if it breaks Vetur features. If it doesn't I'll need to read the list of files to process in Vetur not from jsconfig/tsconfig.

@octref I get error code TS18003, which says No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["src/**/*.vue"]' and 'exclude' paths were '["node_modules", "tests/e2e/**/*.ts", "tests/e2e/**/*.tsx" "src/**/*.ts", "src/**/*.tsx", "tests/unit/**/*.ts", "tests/unit/**/*.tsx"]'. And then a set of errors all saying that property '$store' does not exist on type 'x', where x is the exported Vue component (e.g. 'App' in App.vue, 'SiteHeader' in SiteHeader.vue, etc).

I think I have found a good fix. Can you try the VSIX linked here? https://github.com/vuejs/vetur/issues/1277#issuecomment-489456369

This should be fixed in 0.20.0.

Was this page helpful?
0 / 5 - 0 ratings