Home > database >  Vs code takes a very long time to save a python file on mac
Vs code takes a very long time to save a python file on mac

Time:08-06

Vs code takes a very long time to save a python file, (see the two images below, it takes around 30 seconds for each in a 60-line python file). It is also laggy when writing code.

Any recommendations on how to avoid this?

My vs code specs:

Version: 1.69.2 (Universal)
Commit: 3b889b090b5ad5793f524b5d1d39fda662b96a2a
Date: 2022-07-18T16:12:57.074Z (2 wks ago)
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Darwin x64 20.4.0

enter image description here

enter image description here

My activity monitor looks like this:

enter image description here

And these are my mac specs:

enter image description here

CodePudding user response:

The reason for this problem is probably because VS code sorts the imported packages and formats the codes first when saving the file.

You should turn off these features, then the time to save the file will be greatly reduced.

Add the following configuration to the settings.json to turn off these two functions:

    "editor.formatOnSave": false,
    "editor.codeActionsOnSave": {
        "source.organizeImports": false
    }
  • Related