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

Add the Auto Import feature for Code Completion #7027

Merged
merged 2 commits into from
Feb 11, 2024

Conversation

junichi11
Copy link
Member

@junichi11 junichi11 commented Feb 5, 2024

  • Automatically import types when selected on code completion #6947
  • Add Auto Import as an option for code completion
  • Add Prefer Import and Don't Import options for global namespace items(Don't Import is enabled by default)
  • Add File Scope(unchecked by default) and Namespace Scope(checked by default) options
    • File Scope means a php file without a namespace name (e.g. <html><p><?php echo \NS\something(); ?></p></html>)
  • Don't add a use statement if use list has the same name item(Instead, the result of "Smart" or "Unqualified" CC is used)
  • Add unit tests

Note: A use statement may not be added to an expected position if the existing use list is not sorted(ignore cases)

Options

nb-php-auto-import-options-03

Single Use

nb-php-auto-import-02

Group Use

nb-php-auto-import-with-group-use

- Get aliased names for traits and enums
- Add unit tests
@junichi11 junichi11 added PHP [ci] enable extra PHP tests (php/php.editor) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Feb 5, 2024
@junichi11 junichi11 added this to the NB22 milestone Feb 5, 2024
@junichi11 junichi11 linked an issue Feb 5, 2024 that may be closed by this pull request
@junichi11 junichi11 requested a review from tmysik February 5, 2024 11:18
@junichi11
Copy link
Member Author

junichi11 commented Feb 5, 2024

@tmysik Could you please have a look at this when you have time? (Huge changes, sorry...)

@junichi11
Copy link
Member Author

Copy link
Member

@tmysik tmysik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, overall, it looks good to me. Of course, to review all the details is difficult since it is a big change :) But we have many tests for it, this is great 👍

@tmysik
Copy link
Member

tmysik commented Feb 5, 2024

@junichi11

Junichi, this feature looks amazing! Great job, as always 👍

@junichi11
Copy link
Member Author

@tmysik Thank you for your time and your review! I'll improve this a bit because there are a few feedbacks: #6947 (comment)

@junichi11
Copy link
Member Author

Changed the options a bit.
nb-php-auto-import-options-01

Fixed field orders and improve the insert position.

https://github.com/apache/netbeans/compare/9a40e281060cc08ce3dc9e9e4e3b51c5170389bc..b31c4fea571c5fcfc1496efc8d2eb91c8bcf0f6c

Thanks!

@tmysik
Copy link
Member

tmysik commented Feb 7, 2024

Cool!

- apache#6947
- Add `Auto Import` as an option for code completion
- Add `Prefer Import` and `Don't Import` options for global namespace items(`Don't Import` is enabled by default)
  - `File Scope` means a php file without a namespace name (e.g. `<html><p><?php echo \NS\something(); ?></p></html>`)
- Add `File Scope`(unchecked by default) and `Namespace Scope`(checked by default) options
- Don't add a use statement if use list has the same name item(Instead, the result of "Smart" or "Unqualified" CC is used)
- Add unit tests

Note: A use statement may not be added to an expected position if the existing use list is not sorted(ignore cases)
@junichi11 junichi11 merged commit 3eae17f into apache:php-nb22-features Feb 11, 2024
34 checks passed
@junichi11 junichi11 deleted the php-auto-import branch February 11, 2024 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically import types when selected on code completion
2 participants