简体   繁体   English

VSCode intellisense未在“ with…as”语句中显示给Python

[英]VSCode intellisense not showing for Python in 'with … as' statement

I have a function as below to get managed resource: 我具有以下获取托管资源的功能:


    from contextlib import contextmanager

    @contextmanager
    def getMyClass() -> MyClass:
       ...
       obj = ...
       try:
          yield obj
          ...
       except:
          ...
       finally:
          ...

by specifying Type for the getMyClass function, I suppose this got object can be recognized in with...as statement as below: 通过为getMyClass函数指定Type,我想这个对象可以通过... as语句识别,如下所示:


   with getMyClass() as obj:
      obj.fun1()

However, VSCode can't recognize the type of obj and the intellisense pop-up menu is not shown. 但是,VSCode无法识别obj的类型,并且不会显示“智能感知”弹出菜单。 Is it possible to get what I need? 有可能得到我需要的东西吗?

PS: I also check PyCharm, it doesn't show the intellisense pop-up menu either. PS:我还检查了PyCharm,它也不显示智能感知弹出菜单。

This technically depends on which IntelliSense provider you're using (Jedi or the language server). 从技术上讲,这取决于您使用的是哪个IntelliSense提供程序(Jedi或语言服务器)。 In the case of the latter, it has not been implemented yet . 在后者的情况下, 尚未实施

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM