Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time-boxed effort to improve VSCode integration #281

Closed
cprice404 opened this issue Feb 23, 2023 · 2 comments · Fixed by #297
Closed

time-boxed effort to improve VSCode integration #281

cprice404 opened this issue Feb 23, 2023 · 2 comments · Fixed by #297
Assignees

Comments

@cprice404
Copy link
Collaborator

cprice404 commented Feb 23, 2023

Several devs left comments during bug bash about VSCode not doing auto-imports, needing to re-load to get the docs to show up, etc. Experiment to see if there are things we need to add, or if there are specific VSCode settings we should recommend that users enable, etc.

@cprice404 cprice404 added this to the datastructures - 1.0 milestone Feb 23, 2023
@malandis
Copy link
Contributor

malandis commented Feb 24, 2023

  1. The language server used by default is pylance. This uses the Microsoft type checker pyright.
  2. In VS Code, pylance by default only indexes top level third-party packages for auto-import, analysis, and autocompletion. This means by default no help from from momento.responses import ... because those are second level names.
  3. Another issue is pyright considers names private by default unless in __all__ or unless using a redundant alias. See here https://github.com/microsoft/pyright/blob/main/docs/typed-libraries.md#library-interface. I will update the APIs to use __all__
  4. The private import rule used by pylance (mentioned in (3)) is the cause of type inference for client object not working with async with - determine root cause #285. Because pylance interpeted SimpleCacheClientAsync as a private name, I did not get type hints in the async with clause. I fixed the private import locally and observed I got the type hints.

@malandis
Copy link
Contributor

Relevant settings in VS Code. Under extensions -> pylance

image
Other settings to adjust:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants