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

[GitHub] [netbeans] rossluk commented on a diff in pull request #5900: [PHP] FixUsesPerformer and AddUseImportSuggestion improvement

rossluk commented on code in PR #5900:
URL: https://github.com/apache/netbeans/pull/5900#discussion_r1184819431


##########
php/php.editor/src/org/netbeans/modules/php/editor/actions/FixUsesPerformer.java:
##########
@@ -631,13 +757,221 @@ private int getOffsetWithoutLeadingWhitespaces(final int startOffset) {
         return result;
     }
 
+    private int getOffsetWithoutFollowingWhitespaces(final int endOffset) {
+        int result = endOffset;
+        baseDocument.readLock();
+        try {
+            TokenSequence<PHPTokenId> ts = LexUtilities.getPHPTokenSequence(baseDocument, endOffset);
+            if (ts != null) {
+                ts.move(endOffset);
+                while (ts.moveNext() && ts.token().id().equals(PHPTokenId.WHITESPACE)) {
+                    result = ts.offset() + ts.token().length();
+                }
+            }
+        } finally {
+            baseDocument.readUnlock();
+        }
+        return result;
+    }
+
+    private class UsesInsertStringHelper {

Review Comment:
   It can, if I make editList static or put it directly to the constructor. Could you suggest what the advantages in such case? Sorry for probably silly question, but I am not very good in Java for now. 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