pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

No constructor argument name auto completion for AWS cdk classes

Open fraghag opened this issue 1 year ago • 3 comments

Environment data

  • Pylance version: v2024.8.1
  • OS and version: Windows 11 (tried both in Windows and WSL)
  • Python version: Python 3.12.5

Code Snippet

Install aws-cdk-lib==2.154.1 in a virtual environment and select the environment in VSCode.

from aws_cdk import (
    Stack,
    aws_lambda,
)
from constructs import Construct


class TestStack(Stack):

    def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        aws_lambda.Function(
            self,
            "TestLambda",
            runtime=aws_lambda.Runtime.PYTHON_3_12,
            handler="index.handler",
            code=aws_lambda.Code.from_inline("def handler(_, _):\n  pass\n"),
        )

Expected behavior

With Pycharm or Jedi python language server in VSCode I get autocompletion for Function constructor arguments:

image

Actual behavior

With Pylance in VSCode I don't get suggestions for arguments, only "kwargs":

image

fraghag avatar Aug 26 '24 12:08 fraghag

This might be a dupe of https://github.com/microsoft/pylance-release/issues/6286.

rchiodo avatar Aug 26 '24 16:08 rchiodo

Verified this doesn't repro in 2024.7.1, should be a regression.

StellaHuang95 avatar Aug 26 '24 18:08 StellaHuang95

Similar circumstances to the other issue, but this is with aws_cdk and its type annotations. I'm not sure if they're wrong or not.

But not exactly the same bug as #6286

rchiodo avatar Aug 26 '24 20:08 rchiodo

This was fixed in Pyright 1.1.378 and that fix shipped in Pylance 2024.8.104

debonte avatar May 01 '25 21:05 debonte