10

There is the same exact question here, but there hasn't been any replies.

Real-time linting of Python with VSCode

I'm using the Python extension right now that is on the VS code marketplace.

After about an hour of research, I found the following option in the linter:

python.linting.lintOnSave

I set it to false, but that just pretty much just disables linting. There has to be a way if auto complete works in real-time.

Is it possible to have linting done in real-time in VS code? As of right now, the linting only works when I save. Am I missing something?

Noctsol
  • 478
  • 1
  • 8
  • 13

2 Answers2

6

Please a have look at this post. There was already a feature called lintOnTextChange, but it is deprecated now. You have to extend your config file with the following lines to get it work on text change:

"python.linting.lintOnSave": true,
"files.autoSave": true

But this is more a workaround, instead of a proper solution for your problem. Also have a look at this.

Habebit
  • 957
  • 6
  • 23
  • 4
    You're the best. I had to edit it a bit. The files.autoSave feature changed a bit. It no longer takes true/false but takes strings to set it to certain modes. Here was the Code: { "python.linting.lintOnSave": true, "files.autoSave": "afterDelay", "files.autoSaveDelay": 500 } – Noctsol Dec 03 '18 at 16:56
1

It depends on what you are after from linting. If you want a specific linter to run constantly then the answer provided by @benni94 is accurate. But if you're simply after things like syntax errors then using the langauge server will provide this (set "python.jediEnabled": false in your settings to turn it on).

Brett Cannon
  • 14,438
  • 3
  • 45
  • 40