Skip to content

Settable completer type hint squiggles #1630

@ShiftPoster

Description

@ShiftPoster

Description

Hello!

I've been using the Settable class with the path completer, and Pylance shows an argument type error (reportArgumentType). When I change the code to get rid of the error and run it, I get a TypeError.

Please let me know if I am using the argument incorrectly, if this an issue with Pylance, or if I'm just being a doofus.

Thank you

Environment

  • Python 3.12.2
  • Visual Studio Code 1.115.0
    • Python ms-python.python 2026.4.0
    • Pylance ms-python.vscode-pylance 2026.2.1

Steps to Reproduce

Source
from cmd2 import Cmd, Settable


class App(Cmd):
    def __init__(self):
        super().__init__()
        self.no_error = None
        self.type_error = None
        self.add_settable(
            Settable(
                "no_error",
                str,
                "completer=self.path_complete",
                self,
                completer=self.path_complete,
            )
        )
        self.add_settable(
            Settable(
                "type_error",
                str,
                "completer=Cmd.path_complete",
                self,
                completer=Cmd.path_complete,
            )
        )


if __name__ == "__main__":
    App().cmdloop()

The squiggle:

Image

What Pylance says:

Image

When running:

Image

The type_error attribute is correctly reporting available directories when I hit tab, while the no_error attribute gives the TypeError for a parameter mismatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions