Replies: 4 comments 6 replies
-
Verifique se a configuração "python.languageServer" está definida como "Pylance" no seu arquivo de configuração do VS Code (settings.json). Isso garantirá que o Pylance está sendo usado como o provedor de linguagem Python para o seu código. |
Beta Was this translation helpful? Give feedback.
-
Para encontrar o arquivo pylance.json, basta seguir os seguintes passos: Abra o Visual Studio Code e abra o workspace em que o PyLance foi instalado. No menu lateral esquerdo, clique em "Explorador de Arquivos" (ou pressione Ctrl + Shift + E). Na lista de arquivos e pastas, procure por pylance.json. Ele deve estar na raiz do seu workspace. Por exemplo, para habilitar a análise de tipos no PyLance, você pode adicionar a seguinte configuração no arquivo pylance.json: { desculpas pela demora na resposta. |
Beta Was this translation helpful? Give feedback.
-
It appears that Pylance cannot read docstrings in non-Python code, as it does not execute code, and is instead statically analyzing files. For major projects (eg, pandas), it gets around this by having stub files with the docstrings there, so it seems like it works. Unfortunately, this means docstrings in Rust code show up in Python, but not via Pylance, and docstrings in stub files show up in VS Code, but not in Python. Some way of synchronizing the docstrings in the two seems like it would be the only effective option right now. See microsoft/pylance-release#170, microsoft/pylance-release#2711, or microsoft/pylance-release#49. There appears to be some limited support, but only for actual builtins, and that feature appears to be a closed-source value-added feature for pylance (see microsoft/pyright#4250 (comment)). |
Beta Was this translation helpful? Give feedback.
-
I just created a .pyi file. Sure it's redundant typing information, but it allows you to put in pydocs that will just work with all language servers out of the box. . |
Beta Was this translation helpful? Give feedback.
-
Is anyone else finding that docstrings of your pyo3 project aren't displayed in VS Code/Pylance autocomplete? If I
print(my_function.__doc__)
it prints the documentation fine, but autocomplete will not display this information for me. Does anyone know why this is happening? Is it a PyO3 or a Pylance issue (my suspicions are the latter).Beta Was this translation helpful? Give feedback.
All reactions