[英]Why does my python run in vscode terminal but not vscode code
[英]Why does VSCode Python code completion not work for my firestore client variable?
我有以下 python 片段...
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate("./cert.json")
firebase_admin.initialize_app(cred)
client = firestore.client()
client.
当我在最后一行键入点时,没有代码完成选项出现。 在“firestore”变量上,出现了代码完成选项。
我在 VSCode 中安装了 Python 和 Pylance 扩展。 这是配置问题,还是 client() 方法返回的内容无法推断其类型?
事实证明,在 github 存储库上已经有一个未解决的问题,其中还包括一个临时的(糟糕的)解决方法。
from firebase_admin import firestore
from google.cloud.firestore import Client as FirestoreClient # importing the return type of firestore.client()
db: FirestoreClient = firestore.client() # Adding an annotation to my db variable, to enable completion and syntax checking
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.