Support Markdown for docstrings #4078
Replies: 8 comments 1 reply
-
I'm assuming the library is written in Python? If so, then Pylance will pick up its definitions automatically. Descriptions can be done with doc style comments: def foo():
'''
This is a function
''' Either in the source or in type stubs. For more information see the documentation here: https://microsoft.github.io/pyright/#/typed-libraries?id=docstrings |
Beta Was this translation helpful? Give feedback.
-
If the library is not written in python but has a python interface (like a pyd file), then you can still generate type stubs for the library. Pylance would then pick up the type stubs. See this documentation on how to create type stubs: |
Beta Was this translation helpful? Give feedback.
-
HI, Yes. Functions are in Python .py files , but descriptions of each functions are in a Mark Down file, separate from the definition. Basically we want to know how the reference is made between both in Pylance to retrieve it. We are receiving the following message when Hover over our custom functions "[FunctionName]" is not defined Pylance(ReportUndefinedVariable) Rolando |
Beta Was this translation helpful? Give feedback.
-
Yes, doc strings are how documentation are added to python files. Either directly in the python file itself or through type stubs. You'd use type stubs if you didn't want to put any other type information directly into the py files. I believe doc strings were finalized in this pep: |
Beta Was this translation helpful? Give feedback.
-
There is no facility to have the doc strings in a separate file, other than a type stub. |
Beta Was this translation helpful? Give feedback.
-
Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
For this item:
"[FunctionName]" is not defined Pylance(ReportUndefinedVariable) That may be for a number of reasons. It means that pylance doesn't understand the type that is calling that function (or it's not finding the module for a global function) We'd need to see an example to really understand why this might be happening. |
Beta Was this translation helpful? Give feedback.
-
similar one - #4402 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
We are looking to import a custom Library with its Definitions and Descriptions into Pylance.
What are the steps to follow to include the Library and that the new functions with descriptions are available with Pylance? Description of the functions of the library are in a Mark Down File.
regards,
Rolando
Beta Was this translation helpful? Give feedback.
All reactions