You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/07/07 08:11:25 UTC

[GitHub] [netbeans] junichi11 commented on a change in pull request #2241: [NETBEANS-4503] Code completion does not work in functions declared inside methods

junichi11 commented on a change in pull request #2241:
URL: https://github.com/apache/netbeans/pull/2241#discussion_r450685461



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/model/VariableScopeFinder.java
##########
@@ -45,10 +51,22 @@ public VariableScope find(final Scope scope, final int offset, final ScopeRangeA
     }
 
     public VariableScope find(final List<? extends ModelElement> elements, final int offset, final ScopeRangeAcceptor scopeRangeAcceptor) {
-        return findWrapper(elements, offset, scopeRangeAcceptor).getVariableScope();
+        AtomicBoolean isLazilyScanned = new AtomicBoolean(false);
+        VariableScope variableScope = findWrapper(elements, offset, scopeRangeAcceptor, isLazilyScanned).getVariableScope();
+        if (isLazilyScanned.get()) {
+            // some scopes may be added new elements when LazyBuild elements are scanned.
+            // so, find again.
+            // e.g. Source instances are cached as weak references.
+            // so, ParserResult may not be the same instance even if the FileObject is the same.
+            // it means that new Model and new ModelVisitor are created again. in such case, LazyBuild elements may not be scanned yet.
+            LOGGER.log(Level.FINE, "(LazyBuild)Scope is scanned."); // NOI18N
+            isLazilyScanned.set(false);

Review comment:
       yes, will remove.




----------------------------------------------------------------
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.

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