Skip to content

Suggest adding constructor inside class as well, not only when cursor is on class name #48318

@weitzhandler

Description

@weitzhandler

Brief description:

Inheriting from an abstract class that lacks a parameterless constructor results in a compile error, unless a constructor is added.
When hovering over the class name and hitting Ctrl+., the suggestion "Generate constructor " appears.

My suggestion is that this suggestion should also appear in the context menu for a Ctrl+. press anywhere in this class as long as a constructor is absent (same as when cursor is on class name).

Languages applicable:

Reproduced in C#, but might be applicable in VB too.

Code example that the analyzer should report:

image

image

The constructor suggestion should also appear in the following screenshot (initiated anywhere in the class scope:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions