Pylance can't discriminate some functions or modules to highlight it .Especially some have connections with cpp.
As you can see in the picture. When I use jedi as my language server, it can discriminate this function. But it can't highlight it.
So I load Pylance But It shows as the folowing picture.
Is this a real bug or just I didn't set the Pylance correctly?
I searched the internet and i found maybe same issue will happen when import Pytorch due to the rely on cpp.But i'm not sure.
Maybe it is another example. The cell can run smoothly but Pylance says it is a mistake.
In order to reproduce the problem, just code as following.
Thank you for the detailed issue. We will look into it
matplotlib started shipping their own stubs in 3.8.0. If you haven't upgraded already, I'd suggest doing that. With 3.8.3 and the following code:
import matplotlib.pyplot as plt
import numpy as np
points = np.arange(-5, 5, 0.01) # 100 equally spaced points
xs, ys = np.meshgrid(points, points)
z = np.sqrt(xs ** 2 + ys ** 2)
plt.imshow(z, cmap=plt.cm.gray, extent=(-5, 5, -5, 5))
plt.colorbar()
plt.title("Image plot of $\sqrt{x^2 + y^2}$ for a grid of values")
I see:
The diagnostic on gray is "gray" is not a known member of module "matplotlib.cm". The colors are installed in some dynamic way that static type checkers like Pylance don't understand.
If you'd like to see improvements to the matplotlib stubs to fix this or other issues, please file issues at https://github.com/matplotlib/matplotlib/issues.