Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Diagnostics not being cleared after document change #386

Closed
DonJayamanne opened this issue Nov 12, 2018 · 14 comments
Closed

Diagnostics not being cleared after document change #386

DonJayamanne opened this issue Nov 12, 2018 · 14 comments
Assignees

Comments

@DonJayamanne
Copy link

From @darrickyee on November 9, 2018 15:30

Environment data

  • VS Code version: 1.28.2
  • Extension version (available under the Extensions sidebar): 2018.10.0
  • OS and version: Windows 7
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.0 (base)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A

Actual behavior

While typing a name, the Problems window raises "used before definition" warnings that do not go away when the name is completed.

error

The following actions do NOT fix this:

  • Closing and reopening the file
  • Modifying the name to something else and back again
  • Deleting the name or entire line
  • Deleting all content in the file and re-pasting

The only reliable way I have found so far to fix this is to restart VSCode.

Unlike microsoft/vscode-python#2290, this does NOT happen when jedi is enabled. This also does not appear to be a linter issue, as the (pylint) output does not show any of these warnings:

pylint

Can't seem to reproduce this with a toy example, but it is happening often enough in real projects that it is becoming a major usability issue. The number of "problems" explodes with phantom entries and makes the tool useless.

Expected behavior

Don't show problems in Problems window if they don't exist.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Microsoft Python language server.
Microsoft Python Language Server version 0.1.60.0
Initializing for C:\Python37\python.exe
##########Linting Output - pylint##########
************* Module xml2data.elem.generic
40,4,convention,C0103:Attribute name "c" doesn't conform to snake_case naming style

------------------------------------------------------------------

Your code has been rated at 9.76/10 (previous run: 9.76/10, +0.00)

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

console.log

Copied from original issue: microsoft/vscode-python#3277

@adamrowell
Copy link

My team is seeing this issue on multiple MacOS machines and it's crushing our ability to use VS code for Python.

@jakebailey
Copy link
Member

jakebailey commented Nov 14, 2018

If you want to silence this message (until it's fixed), you can add this to your settings.json file:

"python.analysis.disabled": [
    "use-before-def"
]

@jakebailey jakebailey changed the title Problems window showing "phantom" errors Diagnostics not being cleared after document change Nov 14, 2018
@jakebailey
Copy link
Member

I had a typo in that snippet, should have said "analysis" spelled correctly. Oops.

@jakebailey jakebailey self-assigned this Nov 15, 2018
@jakebailey jakebailey modified the milestones: Nov 2018.2, Dec 2018.1 Nov 15, 2018
@karthiknadig karthiknadig removed this from the Dec 2018.1 milestone Nov 26, 2018
@bpartridge
Copy link

With microsoft/vscode-python#3514 causing Jedi to effectively fork-bomb our systems, and this issue preventing us from turning off Jedi, we're stuck between a rock and a hard place. Is the core team able to reproduce?

@jakebailey
Copy link
Member

I tried for a few weeks to reproduce this and #391, without avail. If you have some reproducing case that's publicly available, I'd love to have it.

Otherwise, you can disable all of the warnings the language server produces in your settings.json:

"python.analysis.disabled": [
	"use-before-def",
	"unresolved-import"
]

And continue to use pylint/flake8/pep8 (which the extension continues to support).

With the ongoing analysis simplification, all of the code which produces these diagnostics will be removed and rewritten completely, so I would expect to see this sort of issue go away as well.

@jakebailey
Copy link
Member

Also be aware of Brett's comment (microsoft/vscode-python#3514 (comment)) which states that the Jedi version may simply be rolled back for the upcoming release, but I'm not personally involved in that sort of thing.

@lachlan-eagling
Copy link

Also having this issue, I was able to reproduce it as per my comment on the original issue microsoft/vscode-python#3277 (comment)

@itsfarseen
Copy link

itsfarseen commented Feb 4, 2019

Also having this issue. It also happens in rust and c++ too.. although infrequently

@itsfarseen
Copy link

Python screenshot:
2019-02-04-185501_1366x768_scrot

@itsfarseen
Copy link

itsfarseen commented Feb 4, 2019

C++ Screenshot:
whatsapp image 2019-02-04 at 7 18 23 pm

PS: I posted the C++ screenshot to suggest that the issue might not be in python language server, but in vscode itself.

@simkimsia
Copy link

The fix helped in #386 (comment)

Thank you 🙏

Do I need to remove the ignore when this issue is fixed be it in the LS or in vscode itself?

@jakebailey
Copy link
Member

Yes, if you'd like to see the message show up. We plan to reimplement this specific message (use-before-def) for the new LS, but other items have taken priority.

@simkimsia
Copy link

Thanks 🙏 No hurry on this. I didn't miss it that much previously.

Since I've now subscribed to the issue, I'll do so when this is solved. Really thank you for closing my original issue with this fix.

@MikhailArkhipov
Copy link

Should be gone in 0.2

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants