You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "junichi11 (via GitHub)" <gi...@apache.org> on 2024/02/05 05:20:10 UTC

[PR] Add the Auto Import feature for Code Completion [netbeans]

junichi11 opened a new pull request, #7027:
URL: https://github.com/apache/netbeans/pull/7027

   - https://github.com/apache/netbeans/issues/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
   - Don't add a use statement if use list has the same name item(Instead, the result of Smart 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)
   
   ![nb-php-auto-import-options](https://github.com/apache/netbeans/assets/738383/8f920ee8-650c-4ef4-8c4a-c68a1cd90e9c)
   
   ![nb-php-auto-import-01](https://github.com/apache/netbeans/assets/738383/42bb61e6-e669-49b2-a994-28134d219f60)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1478284380


##########
php/php.editor/src/org/netbeans/modules/php/editor/codegen/AutoImport.java:
##########
@@ -0,0 +1,910 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.php.editor.codegen;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NullAllowed;
+import org.netbeans.api.editor.document.LineDocumentUtils;
+import org.netbeans.api.lexer.Token;
+import org.netbeans.api.lexer.TokenSequence;
+import org.netbeans.api.lexer.TokenUtilities;
+import org.netbeans.editor.BaseDocument;
+import org.netbeans.modules.csl.api.EditList;
+import org.netbeans.modules.csl.api.OffsetRange;
+import org.netbeans.modules.editor.indent.api.IndentUtils;
+import org.netbeans.modules.php.api.util.StringUtils;
+import org.netbeans.modules.php.editor.CodeUtils;
+import org.netbeans.modules.php.editor.api.AliasedName;
+import org.netbeans.modules.php.editor.api.QualifiedName;
+import org.netbeans.modules.php.editor.indent.CodeStyle;
+import org.netbeans.modules.php.editor.lexer.LexUtilities;
+import org.netbeans.modules.php.editor.lexer.PHPTokenId;
+import org.netbeans.modules.php.editor.model.GroupUseScope;
+import org.netbeans.modules.php.editor.model.ModelElement;
+import org.netbeans.modules.php.editor.model.ModelUtils;
+import org.netbeans.modules.php.editor.model.NamespaceScope;
+import org.netbeans.modules.php.editor.model.UseScope;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.CONST;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.FUNCTION;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.TYPE;
+import org.netbeans.modules.php.editor.parser.PHPParseResult;
+import org.netbeans.modules.php.editor.parser.astnodes.DeclareStatement;
+import org.netbeans.modules.php.editor.parser.astnodes.EmptyStatement;
+import org.netbeans.modules.php.editor.parser.astnodes.Program;
+import org.netbeans.modules.php.editor.parser.astnodes.Statement;
+import org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor;
+
+public final class AutoImport {
+
+    public static final String PARAM_NAME = "php-auto-import"; // NOI18N
+    public static final String PARAM_KEY_FQ_NAME = "fqName"; // NOI18N
+    public static final String PARAM_KEY_ALIAS_NAME = "aliasName"; // NOI18N
+    public static final String PARAM_KEY_USE_TYPE = "useType"; // NOI18N
+    public static final String USE_TYPE = "type"; // NOI18N
+    public static final String USE_FUNCTION = "function"; // NOI18N
+    public static final String USE_CONST = "const"; // NOI18N
+    private static final Logger LOGGER = Logger.getLogger(AutoImport.class.getName());

Review Comment:
   Will do that :) Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1477691025


##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java:
##########
@@ -359,12 +368,99 @@ public String getInsertPrefix() {
                     assert false : "[" + tpl + "] should start with [" + extraPrefix + "]";
                 }
             }
+            if (getCodeCompletionType() == CodeCompletionType.AUTO_IMPORT) {
+                String fqName = ifq.getFullyQualifiedName().toString().substring(CodeUtils.NS_SEPARATOR.length());
+                String name = getName();
+                String useType = getUseType();
+                String aliasName = CodeUtils.EMPTY_STRING;

Review Comment:
   This is not used at the moment. However, it would be useful if someone requests importing as an alias(when the use list has the same name) in the future.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#issuecomment-1927064285

   @tmysik Thank you for your time and your review! I'll improve this a bit because there are a few feedbacks: https://github.com/apache/netbeans/issues/6947#issuecomment-1926982191


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#issuecomment-1929115181

   Changed the options a bit.
   ![nb-php-auto-import-options-01](https://github.com/apache/netbeans/assets/738383/f34a9878-adc2-4578-9b2d-eec682a3c8b1)
   
   Fixed field orders and improve the insert position.
   
   https://github.com/apache/netbeans/compare/9a40e281060cc08ce3dc9e9e4e3b51c5170389bc..b31c4fea571c5fcfc1496efc8d2eb91c8bcf0f6c
   
   Thanks!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1478284795


##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java:
##########
@@ -129,16 +131,22 @@ public abstract class PHPCompletionItem implements CompletionProposal {
     protected static final ImageIcon KEYWORD_ICON = IconsUtils.loadKeywordIcon();
     protected static final ImageIcon ENUM_CASE_ICON = IconsUtils.loadEnumCaseIcon();
     private static final int TYPE_NAME_MAX_LENGTH = Integer.getInteger("nb.php.editor.ccTypeNameMaxLength", 30); // NOI18N
-    final CompletionRequest request;
-    private final ElementHandle element;
-    private QualifiedNameKind generateAs;
     private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
     private static final Cache<FileObject, PhpLanguageProperties> PROPERTIES_CACHE
             = new Cache<>(new WeakHashMap<>());
+    private static final String AUTO_IMPORT_PARAM_FORMAT = "%s${php-auto-import default=\"\" fqName=%s aliasName=\"%s\" useType=%s editable=false}"; // NOI18N
+    private static volatile Boolean ADD_FIRST_CLASS_CALLABLE = null; // for unit tests
+
+    final CompletionRequest request;
+    private final ElementHandle element;
+    private QualifiedNameKind generateAs;

Review Comment:
   Will do that. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1479467537


##########
php/php.editor/src/org/netbeans/modules/php/editor/codegen/AutoImport.java:
##########
@@ -0,0 +1,910 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.php.editor.codegen;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NullAllowed;
+import org.netbeans.api.editor.document.LineDocumentUtils;
+import org.netbeans.api.lexer.Token;
+import org.netbeans.api.lexer.TokenSequence;
+import org.netbeans.api.lexer.TokenUtilities;
+import org.netbeans.editor.BaseDocument;
+import org.netbeans.modules.csl.api.EditList;
+import org.netbeans.modules.csl.api.OffsetRange;
+import org.netbeans.modules.editor.indent.api.IndentUtils;
+import org.netbeans.modules.php.api.util.StringUtils;
+import org.netbeans.modules.php.editor.CodeUtils;
+import org.netbeans.modules.php.editor.api.AliasedName;
+import org.netbeans.modules.php.editor.api.QualifiedName;
+import org.netbeans.modules.php.editor.indent.CodeStyle;
+import org.netbeans.modules.php.editor.lexer.LexUtilities;
+import org.netbeans.modules.php.editor.lexer.PHPTokenId;
+import org.netbeans.modules.php.editor.model.GroupUseScope;
+import org.netbeans.modules.php.editor.model.ModelElement;
+import org.netbeans.modules.php.editor.model.ModelUtils;
+import org.netbeans.modules.php.editor.model.NamespaceScope;
+import org.netbeans.modules.php.editor.model.UseScope;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.CONST;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.FUNCTION;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.TYPE;
+import org.netbeans.modules.php.editor.parser.PHPParseResult;
+import org.netbeans.modules.php.editor.parser.astnodes.DeclareStatement;
+import org.netbeans.modules.php.editor.parser.astnodes.EmptyStatement;
+import org.netbeans.modules.php.editor.parser.astnodes.Program;
+import org.netbeans.modules.php.editor.parser.astnodes.Statement;
+import org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor;
+
+public final class AutoImport {
+
+    public static final String PARAM_NAME = "php-auto-import"; // NOI18N
+    public static final String PARAM_KEY_FQ_NAME = "fqName"; // NOI18N
+    public static final String PARAM_KEY_ALIAS_NAME = "aliasName"; // NOI18N
+    public static final String PARAM_KEY_USE_TYPE = "useType"; // NOI18N
+    public static final String USE_TYPE = "type"; // NOI18N
+    public static final String USE_FUNCTION = "function"; // NOI18N
+    public static final String USE_CONST = "const"; // NOI18N
+    private static final Logger LOGGER = Logger.getLogger(AutoImport.class.getName());

Review Comment:
   Fixed.



##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java:
##########
@@ -129,16 +131,22 @@ public abstract class PHPCompletionItem implements CompletionProposal {
     protected static final ImageIcon KEYWORD_ICON = IconsUtils.loadKeywordIcon();
     protected static final ImageIcon ENUM_CASE_ICON = IconsUtils.loadEnumCaseIcon();
     private static final int TYPE_NAME_MAX_LENGTH = Integer.getInteger("nb.php.editor.ccTypeNameMaxLength", 30); // NOI18N
-    final CompletionRequest request;
-    private final ElementHandle element;
-    private QualifiedNameKind generateAs;
     private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
     private static final Cache<FileObject, PhpLanguageProperties> PROPERTIES_CACHE
             = new Cache<>(new WeakHashMap<>());
+    private static final String AUTO_IMPORT_PARAM_FORMAT = "%s${php-auto-import default=\"\" fqName=%s aliasName=\"%s\" useType=%s editable=false}"; // NOI18N
+    private static volatile Boolean ADD_FIRST_CLASS_CALLABLE = null; // for unit tests
+
+    final CompletionRequest request;
+    private final ElementHandle element;
+    private QualifiedNameKind generateAs;

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1478160033


##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java:
##########
@@ -129,16 +131,22 @@ public abstract class PHPCompletionItem implements CompletionProposal {
     protected static final ImageIcon KEYWORD_ICON = IconsUtils.loadKeywordIcon();
     protected static final ImageIcon ENUM_CASE_ICON = IconsUtils.loadEnumCaseIcon();
     private static final int TYPE_NAME_MAX_LENGTH = Integer.getInteger("nb.php.editor.ccTypeNameMaxLength", 30); // NOI18N
-    final CompletionRequest request;
-    private final ElementHandle element;
-    private QualifiedNameKind generateAs;
     private static ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor();
     private static final Cache<FileObject, PhpLanguageProperties> PROPERTIES_CACHE
             = new Cache<>(new WeakHashMap<>());
+    private static final String AUTO_IMPORT_PARAM_FORMAT = "%s${php-auto-import default=\"\" fqName=%s aliasName=\"%s\" useType=%s editable=false}"; // NOI18N
+    private static volatile Boolean ADD_FIRST_CLASS_CALLABLE = null; // for unit tests
+
+    final CompletionRequest request;
+    private final ElementHandle element;
+    private QualifiedNameKind generateAs;

Review Comment:
   Can we put non-final fields below the final ones?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1478105495


##########
php/php.editor/src/org/netbeans/modules/php/editor/codegen/AutoImport.java:
##########
@@ -0,0 +1,910 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.php.editor.codegen;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NullAllowed;
+import org.netbeans.api.editor.document.LineDocumentUtils;
+import org.netbeans.api.lexer.Token;
+import org.netbeans.api.lexer.TokenSequence;
+import org.netbeans.api.lexer.TokenUtilities;
+import org.netbeans.editor.BaseDocument;
+import org.netbeans.modules.csl.api.EditList;
+import org.netbeans.modules.csl.api.OffsetRange;
+import org.netbeans.modules.editor.indent.api.IndentUtils;
+import org.netbeans.modules.php.api.util.StringUtils;
+import org.netbeans.modules.php.editor.CodeUtils;
+import org.netbeans.modules.php.editor.api.AliasedName;
+import org.netbeans.modules.php.editor.api.QualifiedName;
+import org.netbeans.modules.php.editor.indent.CodeStyle;
+import org.netbeans.modules.php.editor.lexer.LexUtilities;
+import org.netbeans.modules.php.editor.lexer.PHPTokenId;
+import org.netbeans.modules.php.editor.model.GroupUseScope;
+import org.netbeans.modules.php.editor.model.ModelElement;
+import org.netbeans.modules.php.editor.model.ModelUtils;
+import org.netbeans.modules.php.editor.model.NamespaceScope;
+import org.netbeans.modules.php.editor.model.UseScope;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.CONST;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.FUNCTION;
+import static org.netbeans.modules.php.editor.model.UseScope.Type.TYPE;
+import org.netbeans.modules.php.editor.parser.PHPParseResult;
+import org.netbeans.modules.php.editor.parser.astnodes.DeclareStatement;
+import org.netbeans.modules.php.editor.parser.astnodes.EmptyStatement;
+import org.netbeans.modules.php.editor.parser.astnodes.Program;
+import org.netbeans.modules.php.editor.parser.astnodes.Statement;
+import org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor;
+
+public final class AutoImport {
+
+    public static final String PARAM_NAME = "php-auto-import"; // NOI18N
+    public static final String PARAM_KEY_FQ_NAME = "fqName"; // NOI18N
+    public static final String PARAM_KEY_ALIAS_NAME = "aliasName"; // NOI18N
+    public static final String PARAM_KEY_USE_TYPE = "useType"; // NOI18N
+    public static final String USE_TYPE = "type"; // NOI18N
+    public static final String USE_FUNCTION = "function"; // NOI18N
+    public static final String USE_CONST = "const"; // NOI18N
+    private static final Logger LOGGER = Logger.getLogger(AutoImport.class.getName());

Review Comment:
   Nitpick: Don't we put `LOGGER` always as the first field in a class?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#issuecomment-1926926124

   @junichi11 
   
   Junichi, this feature looks amazing! Great job, as always :+1: 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#issuecomment-1926758131

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#issuecomment-1932382650

   Cool!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 merged PR #7027:
URL: https://github.com/apache/netbeans/pull/7027


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "junichi11 (via GitHub)" <gi...@apache.org>.
junichi11 commented on PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#issuecomment-1926763662

   Dev build to test this: https://github.com/apache/netbeans/suites/20437665071/artifacts/1219370144


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [PR] Add the Auto Import feature for Code Completion [netbeans]

Posted by "tmysik (via GitHub)" <gi...@apache.org>.
tmysik commented on code in PR #7027:
URL: https://github.com/apache/netbeans/pull/7027#discussion_r1478063798


##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java:
##########
@@ -359,12 +368,99 @@ public String getInsertPrefix() {
                     assert false : "[" + tpl + "] should start with [" + extraPrefix + "]";
                 }
             }
+            if (getCodeCompletionType() == CodeCompletionType.AUTO_IMPORT) {
+                String fqName = ifq.getFullyQualifiedName().toString().substring(CodeUtils.NS_SEPARATOR.length());
+                String name = getName();
+                String useType = getUseType();
+                String aliasName = CodeUtils.EMPTY_STRING;

Review Comment:
   I see.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists