Skip to content

Automatically import types when selected on code completion #6947

@stollr

Description

@stollr

Description

Almost every time I am using Netbeans I am missing the automatic import of types when I select them from code completion.

To make it clear I would like to provide some screenshots. The first one shows how Netbeans suggests a class:

grafik

This works great. Now I select the suggested type by hitting enter:

grafik

As you see in the screenshot the full qualified class name is inserted.

But usually I want the class to be added as import and only the class name to be inserted at the caret's position.
So the result should look like this:

grafik

To be considered

Before Netbeans inserts the import, it has to check if the type already is imported or if there is already another type imported with the same name but different namespace. In the latter case it might insert the full qualified class name (like today).

Use case/motivation

The current situation requires some manual work for each code completion, when working with namespace.

Related issues

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

Labels

PHP[ci] enable extra PHP tests (php/php.editor)kind:featureA feature request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions