Issue
[ This was a bug in vscode < v1.71, see my comment with additional screenshots. ]
I've got a weird issue in vscode. For some reason, code completion of c. stops working after the first None in the Python code, as shown in below screenshot.
This is the complete Card class (complete source code, see link below):
from dataclasses import asdict
from dataclasses import dataclass
from dataclasses import field
@dataclass
class Card:
summary: str = None
owner: str = None
state: str = "todo"
id: int = field(default=None, compare=False)
@classmethod
def from_dict(cls, d):
return Card(**d)
def to_dict(self):
return asdict(self)
It is like if c. contains nothing after that. I just get "No suggestions." when using Ctrl+. at c..
If i put None in quotes, like "None", suggestions works for following rows. Until the next None that is.
If I change to False, suggestions works for following rows. It just seems to happen for None!
It is also contained within the function scope too.
Any idea why this is happening?
The code is used in the Pytest book and can be download from Python Testing with pytest, Second Edition.
The file my problem is from is: code/ch2/test_card.py
Reinstalled vscode The problem remains after a complete reinstallation of vscode, including manually deleting the "~/.config/Code/" and "~/.vscode/" folders.
Environment:
- Ubuntu 20.04
- Python 3.10.4 virtual environment using pyenv
- vscode extensions:
- HTML CSS Support
- Python
- That autoinstalled Pylance, Jubyter, Jupyter Keymap and Jupyter Notebook Renderers
- Python Environment Manager
- rust-analyzer
Solution
This was a bug in vscode < v1.71
I was just about to get started thoroughly testing the suggestions @mpette, @JialeDu and @Okken provided in their comments.
However, I was met with that v1.71 had been installed, and now it works with the original code, as shown in the screenshot.
So it seems to me this was indeed a bug in the previous version of vscode, as the Python extensions still needs to be reloaded for their updates to take affect:
After reloading them, suggestions keeps working as they should :)
Thanks everyone who so kindly tried to help me get this fixed.
Answered By - tsvenson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.