pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Pylance can't discriminate some functions or modules to highlight it .Especially some have connections with cpp.

Open ZhuYizhou2333 opened this issue 2 years ago • 3 comments

image

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.

image

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.

ZhuYizhou2333 avatar Jun 19 '23 16:06 ZhuYizhou2333

image

Maybe it is another example. The cell can run smoothly but Pylance says it is a mistake.

ZhuYizhou2333 avatar Jun 19 '23 16:06 ZhuYizhou2333

In order to reproduce the problem, just code as following.

image

ZhuYizhou2333 avatar Jun 19 '23 16:06 ZhuYizhou2333

Thank you for the detailed issue. We will look into it

bschnurr avatar Jul 25 '23 15:07 bschnurr

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: image

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.

debonte avatar Mar 01 '24 23:03 debonte