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

As of the latest version of Pylance, types are no longer included when autocompleting inherited methods. #6539

Open
brett1479 opened this issue Oct 8, 2024 · 4 comments
Assignees
Labels
needs decision Do we want this enhancement?

Comments

@brett1479
Copy link

Environment data

  • Pylance version: v2024.10.1
  • OS and version: Windows 10 Pro, 22H2
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.12.2

Code Snippet

class A:
    def f(self, a: int, b: str) -> None:
        pass
    
class B(A):
    def f(self, a, b):
        return super().f(a, b)

Repro Steps

  1. When I ask VS Code to autocomplete/generate the code for f in class B (i.e., I type def f and then let it autocomplete) no types are included. (They were included on Pylance 2024.9.2.)

Expected behavior

The following used to be generated (specifically what follows after def f):

class B(A):
    def f(self, a: int, b: str) -> None:
        return super().f(a, b)

Actual behavior

Now this is generated (specifically what follows after def f):

class B(A):
    def f(self, a, b):
        return super().f(a, b)

Logs

Currently omitted due to all the personal path information I don't want to include. Can be included if needed.

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Oct 8, 2024
@StellaHuang95
Copy link
Contributor

StellaHuang95 commented Oct 8, 2024

It’s likely that you're in the treatment group of an experiment we're running, which disables type annotations in completions when type checking mode is set to off. You should be able to see the types if you switch to basic or strict mode by adding the following to your settings.json.

{
    "python.analysis.typeCheckingMode": "basic",
}

Could you share your thoughts on this change? We're gathering user feedback to help us decide on the next steps. Thanks!

@StellaHuang95 StellaHuang95 added waiting for user response Requires more information from user and removed needs repro Issue has not been reproduced yet labels Oct 8, 2024
@brett1479
Copy link
Author

Thank you for the quick reply! Enabling basic did work. In my current workflow I use mypy for all type checking, and like the option of not being forced to use a second type checker.

@github-actions github-actions bot added user responded Was "waiting for user response" and they responded and removed waiting for user response Requires more information from user labels Oct 8, 2024
@heejaechang
Copy link
Contributor

for now, you can explicitly set "python.analysis.completionOverrideExperiment": false to turn off the experiement

@StellaHuang95 StellaHuang95 added needs decision Do we want this enhancement? and removed user responded Was "waiting for user response" and they responded labels Oct 21, 2024
@HosseinMarvi
Copy link

for now, you can explicitly set "python.analysis.completionOverrideExperiment": false to turn off the experiement

This config no longer works with v2025.2.1. Does anyone have any alternatives or suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs decision Do we want this enhancement?
Projects
None yet
Development

No branches or pull requests

4 participants