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

Autocomplete for method overwrites should add default args #869

Closed
cdce8p opened this issue Jan 22, 2021 · 3 comments
Closed

Autocomplete for method overwrites should add default args #869

cdce8p opened this issue Jan 22, 2021 · 3 comments
Assignees
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@cdce8p
Copy link

cdce8p commented Jan 22, 2021

Environment data

  • Language Server version: 2021.1.2
  • OS and version: darwin x64
  • Python version: 3.9.1
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: off

Expected behaviour

When using autocomplete for an overwritten function, pylance should add default values.
Otherwise one might assume this to be the correct function signature which could cause potential issues.

If pylance doesn't know the correct default value, it would already be helpful to only add = ... as in stub files. That way you would notice it directly and know that you still need to change some things.

Actual behaviour

Pylance only adds function parameter and their type hints.

Logs

--

Code Snippet / Additional information

import argparse
from typing import Optional, Text

class CustomFormatter(argparse.HelpFormatter):
    def __init__  # use autocomplete here

## Result
class CustomFormatter(argparse.HelpFormatter):
    def __init__(self, prog: Text, indent_increment: int, max_help_position: int, width: Optional[int]) -> None:
        super().__init__(prog, indent_increment=indent_increment, max_help_position=max_help_position, width=width)

# The default values would be
indent_increment = 2
max_help_position = 24
width = None
@judej judej added the enhancement New feature or request label Jan 25, 2021
@github-actions github-actions bot removed the triage label Jan 25, 2021
@jakebailey jakebailey added bug Something isn't working and removed enhancement New feature or request labels Aug 27, 2021
@jakebailey
Copy link
Member

Also #711 (comment) (didn't realize this issue was open).

@jakebailey jakebailey added the needs investigation Could be an issue - needs investigation label Sep 1, 2021
@jakebailey
Copy link
Member

The next release will generate default values to ensure that the generated signatures aren't invalid (which is the case now).

@jakebailey jakebailey added fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed needs investigation Could be an issue - needs investigation labels Sep 9, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.9.2, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202192-16-september-2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants