Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting / error-checking running VERY slowly #1200

Closed
3 tasks done
geopic opened this issue Apr 12, 2019 · 28 comments
Closed
3 tasks done

Linting / error-checking running VERY slowly #1200

geopic opened this issue Apr 12, 2019 · 28 comments

Comments

@geopic
Copy link

geopic commented Apr 12, 2019

  • I have searched through existing issues
  • I have read through docs
  • 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:

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

@yoyoys
Copy link

yoyoys commented Apr 12, 2019

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

@octref
Copy link
Member

octref commented Apr 12, 2019

Open up a .vue file in VS Code with Vetur installed which has <script lang="ts">...</script> and write some code

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

@geopic
Copy link
Author

geopic commented Apr 12, 2019

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.

@geopic geopic closed this as completed Apr 12, 2019
@octref
Copy link
Member

octref commented Apr 12, 2019

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

Also how large is your project?

@geopic
Copy link
Author

geopic commented Apr 12, 2019

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"
    ]
  }

@octref
Copy link
Member

octref commented Apr 12, 2019

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

@geopic
Copy link
Author

geopic commented Apr 12, 2019

@octref Sure thing.

shot

@geopic geopic reopened this Apr 12, 2019
@yoyoys
Copy link

yoyoys commented Apr 16, 2019

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

@hlhr202
Copy link

hlhr202 commented Apr 16, 2019

@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

@hlhr202
Copy link

hlhr202 commented Apr 16, 2019

image
The first column is CPU % usage

@geopic
Copy link
Author

geopic commented Apr 16, 2019

Is there any more information you need @octref?

@hlhr202
Copy link

hlhr202 commented Apr 16, 2019

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

@yoyoys
Copy link

yoyoys commented Apr 19, 2019

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

@kjleitz
Copy link

kjleitz commented Apr 20, 2019

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.

@kjleitz
Copy link

kjleitz commented Apr 20, 2019

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

@chanlito
Copy link

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

@AtofStryker
Copy link

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

@geopic
Copy link
Author

geopic commented Apr 30, 2019

Received this error when saving a .vue file today.

Error

@octref
Copy link
Member

octref commented Apr 30, 2019

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

@geopic
Copy link
Author

geopic commented May 2, 2019

@octref
cpu-profile-02.zip

@octref
Copy link
Member

octref commented May 2, 2019

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?

@geopic
Copy link
Author

geopic commented May 4, 2019

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 typescript@3.3.4000.
[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"]
}

@octref
Copy link
Member

octref commented May 4, 2019

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"
  ]
}

@yoyoys
Copy link

yoyoys commented May 4, 2019

@octref I think this may break ts files

@octref
Copy link
Member

octref commented May 4, 2019

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

@geopic
Copy link
Author

geopic commented May 4, 2019

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

@octref
Copy link
Member

octref commented May 5, 2019

I think I have found a good fix. Can you try the VSIX linked here? #1277 (comment)

@octref
Copy link
Member

octref commented May 8, 2019

This should be fixed in 0.20.0.

@octref octref closed this as completed May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants