Pyright LSP type completion #5443
MarkBekooy
started this conversation in
General
Replies: 1 comment 1 reply
-
Is the feature available in the Pyright extension? If not you could maybe start pyright as an LSP, use the "create type stub" code action and then merge the generated If it is available you can start Pyright as an LSP and it will send the inlay hints. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
In VS Code, when I enable
python.analysis.inlayHints
(which has multiple options), Pylance seems to use Pyright to provide type annotation completions. This is awesome! Now, I'd like to get this functionality "outside of Vs Code". What I mean with this is basically: I'd like to run Pyright as a tool over a Python file and let it determine the type annotations for certain type annotation slots.When I run the Pyright CLI with the command
pyright --outputjson mark-example.py
with a pyright configuration file in thepyright-test
folder, it generates the following output (which is just one entry of many):This is very useful for the diagnostics messages that VS Code provides via its Pylance LSP, but I'd like something that not only shows the warnings and errors, but also the determined type annotations by Pyright. E.g. know the start and end range of determined type annotations by Pyright.
I know that Pyright has a
languageService
folder, which likely implements"method": "textDocument/completion"
for LSP, but I'm not exactly certain if that could be used for me.My goal is to get the Pyright determined type annotations and to replace those that are "Unknown" with predicted type annotations from a machine learning model. The reason for this post is that I'm currently stuck on how to get the Pyright determined type annotations.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions