Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python in VS Code: Auto-completion (IntelliSense) not working for object instances in the editor tab

I'm new to Python and I'm trying to use VS Code as IDE, and it's IntelliSense (auto-completion) to improve the development.

But I find that the IntelliSense is not working for object instances in the Editor Tab.

I have the example on the figure below, where I created a figure and tried to access its properties via IntelliSense on the editor tab: the properties are not available, only variables.

What is curious is that: on the Python Interactive Tab, the IntelliSense (autocomplete) works fine, for the same object. This example is in the same figure below.

I've tried to disable the Jedi IntelliSense, but it didn't change anything.

enter image description here

The code used in the image is as follows

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0,10,1000)
y = np.cos(x)

fig,ax = plt.subplots()
ax.plot(x,y)
like image 617
Diogo Avatar asked Jan 27 '26 11:01

Diogo


1 Answers

The reason it works in the interactive window is it is working against live data, and so Python itself can say what things should be. But in the editor windows it's all inferred via IntelliSense which is much harder to get right. If you tried both Jedi and MPLS as IntelliSense engines and neither work then I'm afraid there isn't much to do until one of them improves enough to work in that specific situation.

like image 93
Brett Cannon Avatar answered Jan 29 '26 02:01

Brett Cannon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!