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 2022/05/09 13:14:16 UTC

[GitHub] [netbeans] ppisl opened a new pull request, #4091: Implementation of GoTo Symbol for Groovy

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

   This PR adds functionality of GoTo Symbol for Groovy. Also there are fixes of Go to Type, now it's able to navigate to the type declaration. So far only file with the type declaration was opened and the position was set up to 0. 
   
   The location is carrently stored in index. 


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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r893634432


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/language/GroovyTypeSearcher.java:
##########
@@ -59,10 +62,38 @@ public class GroovyTypeSearcher implements IndexSearcher {
 
     @Override
     public Set<? extends Descriptor> getSymbols(Project project, String textForQuery, Kind kind, Helper helper) {
-        // TODO - search for methods too!!
+        GroovyIndex index = GroovyIndex.get(QuerySupport.findRoots(project, Collections.singleton(ClassPath.SOURCE), Collections.<String>emptySet(), Collections.<String>emptySet()));
 
-        // For now, just at a minimum do the types
-        return getTypes(project, textForQuery, kind, helper);
+        kind = adjustKind(kind, textForQuery);
+        
+        if (kind == QuerySupport.Kind.CASE_INSENSITIVE_PREFIX /*|| kind == QuerySupport.Kind.CASE_INSENSITIVE_REGEXP*/) {
+            textForQuery = textForQuery.toLowerCase(Locale.ENGLISH);
+        }
+        
+        Set<GroovyTypeDescriptor> result = new HashSet<GroovyTypeDescriptor>();
+        
+        
+        if (textForQuery.length() > 0) {
+            Set<IndexedClass> classes = null;
+            classes = index.getClasses(textForQuery, kind);
+            for (IndexedClass cls : classes) {
+                result.add(new GroovyTypeDescriptor(cls, helper));
+            }
+            
+            Set<IndexedField> fields = index.getFields(textForQuery, null, kind);
+            for (IndexedField field : fields) {
+                result.add(new GroovyTypeDescriptor(field, helper));
+            }
+            
+            Set<IndexedMethod> methods = index.getMethods(textForQuery, null, kind);
+            for (IndexedMethod method : methods) {
+                if (method.getOffsetRange(null)  != OffsetRange.NONE) {

Review Comment:
   I have to admit that can look strange. The condition is here for my testing purposes and can be deleted. Unfortunately currently we don't store into the index whether the element is synthetic. Synthetic elements have offset [0,0] so it can be a sign how to recognize them. The question is, should we offer them in the Goto Symbol?



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


[GitHub] [netbeans] sdedic commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r883397225


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +359,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();
+        String whereP = where.toLowerCase();
+        int index = -1;
+        for (int i = 0; i < textP.length(); i++) {
+            index = whereP.indexOf(textP.charAt(i), index + 1);
+            if (index == -1) {
+                return false;
+            }
+            if (whereP.length() <= (index + 1)) {

Review Comment:
   I don't understand this condition; at line 370, `index` is computed as `whereP.indexOf`, which can be either `< whereP.length()` or `-1`. This condition seems always `false` for me.



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -593,18 +630,28 @@ private IndexedMethod createMethod(String signature, IndexResult map) {
 
         // Extract attributes
         int attributeIndex = signature.indexOf(';', typeIndex + 1);
+        int offsetRangeIndex = signature.indexOf(";[", attributeIndex == -1 ? typeIndex + 1 : attributeIndex + 1);

Review Comment:
   Hm, since `signature.indexOf(';', typeIndex + 1)` did not find even the `;` (-> attributeIndex == -1), it won't find `;[` either. Or in another way, if `attribute` part would be missing, then the `attributeIndex` will be the first to catch up on the `;[` string since it only looks for `;`. Take as an example `field;int;[100-130]` (missing attribute part).
   
   Consider ordering all mandatory parts at the start and optionals at the end. 



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java:
##########
@@ -321,6 +323,9 @@ private void indexClass(ASTClass element, IndexDocument document) {
             document.addPair(FQN_NAME, element.getFqn(), true, true);
             document.addPair(CLASS_NAME, name, true, true);
             document.addPair(CASE_INSENSITIVE_CLASS_NAME, name.toLowerCase(), true, true);
+            StringBuilder sb = new StringBuilder();

Review Comment:
   Q: `addPair(CLASS_NAME,...)` is called multiple times (toplevel classes, inner classes), but [it is read as a single value here](https://github.com/apache/netbeans/pull/4091/files#diff-d59a38cf1daed90d439de7eb0be4bcea950ef015a4f2321d2cfdd9a50b90a104R607) -- will this work OK with fields of inner classes ? If not I'd suggest to file a bug for Groovy & fix it in a later PR.



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +359,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();
+        String whereP = where.toLowerCase();
+        int index = -1;
+        for (int i = 0; i < textP.length(); i++) {
+            index = whereP.indexOf(textP.charAt(i), index + 1);
+            if (index == -1) {
+                return false;
+            }
+            if (whereP.length() <= (index + 1)) {

Review Comment:
   BTW do I understand right that this check basically returns `true`, if the characters present in `text` are found (case-insensitive) in `where` in the same order, so e.g. `matchInsensitiveCamelCase("bfu", "beloved favourite user") == true` (see no CamelCase in either search pattern or the matched text) ?
   



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -252,10 +253,18 @@ public Set<IndexedMethod> getConstructors(final String className) {
                     }
                 }
                 int flags = 0;
-                if (parts.length > 2) {
+                if (parts.length > 3) {

Review Comment:
   Please document what the `signature` syntax is; from the code it seems that e.g. `type` and `attribute` part may be optional (there are checks for that, but still better to have it documented), the `range` part is (?) mandatory.
   
   Depending on that various checks may be insufficient; e.g. there are (?) 2 optional parts (type, attributes) separted by the same separator. So from notation `name;a` it's not obvious what 'a' is: a type or an attribute ?
   
   But from the Indexer code, it seems that `type` is always present, so maybe the checks in index reading code can be simplified ?



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/language/GroovyTypeSearcher.java:
##########
@@ -59,10 +62,38 @@ public class GroovyTypeSearcher implements IndexSearcher {
 
     @Override
     public Set<? extends Descriptor> getSymbols(Project project, String textForQuery, Kind kind, Helper helper) {
-        // TODO - search for methods too!!
+        GroovyIndex index = GroovyIndex.get(QuerySupport.findRoots(project, Collections.singleton(ClassPath.SOURCE), Collections.<String>emptySet(), Collections.<String>emptySet()));
 
-        // For now, just at a minimum do the types
-        return getTypes(project, textForQuery, kind, helper);
+        kind = adjustKind(kind, textForQuery);
+        
+        if (kind == QuerySupport.Kind.CASE_INSENSITIVE_PREFIX /*|| kind == QuerySupport.Kind.CASE_INSENSITIVE_REGEXP*/) {
+            textForQuery = textForQuery.toLowerCase(Locale.ENGLISH);
+        }
+        
+        Set<GroovyTypeDescriptor> result = new HashSet<GroovyTypeDescriptor>();
+        
+        
+        if (textForQuery.length() > 0) {
+            Set<IndexedClass> classes = null;
+            classes = index.getClasses(textForQuery, kind);
+            for (IndexedClass cls : classes) {
+                result.add(new GroovyTypeDescriptor(cls, helper));
+            }
+            
+            Set<IndexedField> fields = index.getFields(textForQuery, null, kind);
+            for (IndexedField field : fields) {
+                result.add(new GroovyTypeDescriptor(field, helper));
+            }
+            
+            Set<IndexedMethod> methods = index.getMethods(textForQuery, null, kind);
+            for (IndexedMethod method : methods) {
+                if (method.getOffsetRange(null)  != OffsetRange.NONE) {

Review Comment:
   Why is this check done for methods and not for fields + classes ? Synthetic methods ? Shouldn't we rather flag them with an attribute ?



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


[GitHub] [netbeans] sdedic commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r905879985


##########
groovy/groovy.editor/apichanges.xml:
##########
@@ -97,6 +97,20 @@ is the proper place.
             </p>
         </description>
         <class package="org.netbeans.modules.groovy.editor.api.lexer" name="LexUtilities"/>
+    </change>    
+    <change id="GroovyElement.outer">
+        <api name="groovy-parsing"/>
+        <summary>Alternative construction for path more suitable for expressions, API to resolve types</summary>
+        <version major="1" minor="85"/>

Review Comment:
   Bump version in manifest as well ?



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/language/GroovyTypeSearcher.java:
##########
@@ -59,10 +62,38 @@ public class GroovyTypeSearcher implements IndexSearcher {
 
     @Override
     public Set<? extends Descriptor> getSymbols(Project project, String textForQuery, Kind kind, Helper helper) {
-        // TODO - search for methods too!!
+        GroovyIndex index = GroovyIndex.get(QuerySupport.findRoots(project, Collections.singleton(ClassPath.SOURCE), Collections.<String>emptySet(), Collections.<String>emptySet()));
 
-        // For now, just at a minimum do the types
-        return getTypes(project, textForQuery, kind, helper);
+        kind = adjustKind(kind, textForQuery);
+        
+        if (kind == QuerySupport.Kind.CASE_INSENSITIVE_PREFIX /*|| kind == QuerySupport.Kind.CASE_INSENSITIVE_REGEXP*/) {
+            textForQuery = textForQuery.toLowerCase(Locale.ENGLISH);
+        }
+        
+        Set<GroovyTypeDescriptor> result = new HashSet<GroovyTypeDescriptor>();
+        
+        
+        if (textForQuery.length() > 0) {

Review Comment:
   So fo an empty query (i.e. empty prefix) we do not return any results, but for `.*` regexp we do. Consistent with Java ?



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -649,38 +673,35 @@ private IndexedField createField(String signature, IndexResult map, boolean inhe
 
         //String fqn = map.getValue(GroovyIndexer.FQN_NAME);
 
-        int typeIndex = signature.indexOf(';');
-        String name = signature;
-        String type = "java.lang.Object";
-        if (typeIndex != -1) {
-            int endIndex = signature.indexOf(';', typeIndex + 1);
-            if (endIndex == -1) {
-                endIndex = signature.length();
-            }
-            type = signature.substring(typeIndex + 1, endIndex);
-            name = signature.substring(0, typeIndex);
-        }
-
-        int attributeIndex = signature.indexOf(';', typeIndex + 1);
-        String attributes = null;
-        int flags = 0;
-
-        if (attributeIndex != -1) {
-            flags = IndexedElement.stringToFlag(signature, attributeIndex + 1);
-
-            if (signature.length() > attributeIndex + 1) {
-                attributes = signature.substring(attributeIndex + 1, signature.length());
-            }
-
-            //signature = signature.substring(0, attributeIndex);
-        }
-
+        String[] parts = signature.split(";");
+        String name = parts[0];
+        String type = parts[1].isEmpty() ? "java.lang.Object" : parts[1];
+        int flags = parts[2].isEmpty() ? 0 : IndexedElement.stringToFlag(parts[2], 0);
+        String isProperty = parts[3];
+        String attributes = flags + ";" + isProperty;
+        OffsetRange range = createOffsetRange(parts[4]);
+        
         IndexedField m = IndexedField.create(type, name, clz, map, attributes, flags);
         m.setInherited(inherited);
-
+        if (range != null) {
+            m.setOffsetRange(range);
+        }   
         return m;
     }
 
+    private static OffsetRange createOffsetRange(String text) {
+        OffsetRange result = null;
+        int offsetStartIndex = text.indexOf('[');
+        int commaIndex = text.indexOf(',', offsetStartIndex + 1);
+        int offsetLastIndex = text.indexOf(']', commaIndex != -1 ? commaIndex : offsetStartIndex);

Review Comment:
   Nitpick - only if other more important edit is done: The condition `commaIndex != -1` can be safely removed: it will work for both `commaIndex == -1` and other values, and if `commaIndex == -1`, the `offsetLastIndex` won't be used (condition below)



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/language/GroovyTypeSearcher.java:
##########
@@ -59,10 +62,38 @@ public class GroovyTypeSearcher implements IndexSearcher {
 
     @Override
     public Set<? extends Descriptor> getSymbols(Project project, String textForQuery, Kind kind, Helper helper) {
-        // TODO - search for methods too!!
+        GroovyIndex index = GroovyIndex.get(QuerySupport.findRoots(project, Collections.singleton(ClassPath.SOURCE), Collections.<String>emptySet(), Collections.<String>emptySet()));
 
-        // For now, just at a minimum do the types
-        return getTypes(project, textForQuery, kind, helper);
+        kind = adjustKind(kind, textForQuery);
+        
+        if (kind == QuerySupport.Kind.CASE_INSENSITIVE_PREFIX /*|| kind == QuerySupport.Kind.CASE_INSENSITIVE_REGEXP*/) {

Review Comment:
   Why not the regexp as well?



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java:
##########
@@ -321,6 +323,9 @@ private void indexClass(ASTClass element, IndexDocument document) {
             document.addPair(FQN_NAME, element.getFqn(), true, true);
             document.addPair(CLASS_NAME, name, true, true);
             document.addPair(CASE_INSENSITIVE_CLASS_NAME, name.toLowerCase(), true, true);
+            StringBuilder sb = new StringBuilder();

Review Comment:
   Wrong theory. Each class gets its own `IndexDocument` although they are all bound to the same Indexable.



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -242,7 +243,7 @@ public Set<IndexedMethod> getConstructors(final String className) {
 
             for (String constructor : constructors) {
                 String[] parts = constructor.split(";");
-                String paramList = parts.length > 1 ? parts[1] : ""; // NOI18N
+                String paramList = parts[1];

Review Comment:
   I'd add a sanity check that `parts` has the required (fixed) number of items; should not happen anyway if the index is consistent & done by this impl.



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +358,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();

Review Comment:
   Sorry :) I still believe this function is not a proper impl. At least two bugs here:
   `matchInsensitiveCamelCase("RgExPars", "RegExParser")` produces `true`, but `RgEx` should not match `R`e`gEx`. The culprit is IMHO this lowercase, as we loose information on the Capital-and-lowercase exact substrings to be searched.
   
   Try in IDE's Goto Type (type `RgExPars`)
   
   The 2nd bug is 
   ```
   if (whereP.length() <= (index + 1)) 
   ```
   That causes same string match (`matchInsensitiveCamelCase("RegExParser", "RegExParser")`)  to return `false` -- the last matching character satisfies the condition.



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r906041673


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +358,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();

Review Comment:
   The function is used only if the query has kind `CASE_INSENSITIVE_CAMEL_CASE`. So it shouldn't be case sensitive (the name od method is `matchInsensitiveCamelCase`) and your example of `matchInsensitiveCamelCase("RgEx", "RegExParser")` imho should return true . But probably I don't understand the `CASE_INSENSITIVE_CAMEL_CASE` kind. 



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


[GitHub] [netbeans] sdedic commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r905967489


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +358,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();

Review Comment:
   Sorry :) I still believe this function is not a proper impl. At least two bugs here:
   `matchInsensitiveCamelCase("RgExPars", "RegExParser")` produces `true`, but `RgEx` should not match `R`e`gEx`. The culprit is IMHO this lowercase, as we loose information on the Capital-and-lowercase exact substrings to be searched.
   
   Try in IDE's Goto Type (type `RgExPars`)
   
   The 2nd bug is 
   ```
   if (whereP.length() <= (index + 1)) 
   ```
   That causes same string match (`matchInsensitiveCamelCase("RegExParser", "RegExParser")`)  to return `false` -- the last matching character satisfies the condition. Perhaps `break` should be here instead of `return`



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r905152866


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -252,10 +253,18 @@ public Set<IndexedMethod> getConstructors(final String className) {
                     }
                 }
                 int flags = 0;
-                if (parts.length > 2) {
+                if (parts.length > 3) {

Review Comment:
   I have rewrite the index and indexer to store always the same amount of items. So the code now is much simplier. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r893662149


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -252,10 +253,18 @@ public Set<IndexedMethod> getConstructors(final String className) {
                     }
                 }
                 int flags = 0;
-                if (parts.length > 2) {
+                if (parts.length > 3) {

Review Comment:
   Type and range are mondatory. The attribute part is optional. I tried to keep same order as the version before.



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r893663464


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -593,18 +630,28 @@ private IndexedMethod createMethod(String signature, IndexResult map) {
 
         // Extract attributes
         int attributeIndex = signature.indexOf(';', typeIndex + 1);
+        int offsetRangeIndex = signature.indexOf(";[", attributeIndex == -1 ? typeIndex + 1 : attributeIndex + 1);

Review Comment:
   You are right, I'm going to change the order. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r904952361


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +359,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();
+        String whereP = where.toLowerCase();
+        int index = -1;
+        for (int i = 0; i < textP.length(); i++) {
+            index = whereP.indexOf(textP.charAt(i), index + 1);
+            if (index == -1) {
+                return false;
+            }
+            if (whereP.length() <= (index + 1)) {

Review Comment:
   The condition is ok. I check whether is not whereP shorter then the searched text. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r905154735


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -593,18 +630,28 @@ private IndexedMethod createMethod(String signature, IndexResult map) {
 
         // Extract attributes
         int attributeIndex = signature.indexOf(';', typeIndex + 1);
+        int offsetRangeIndex = signature.indexOf(";[", attributeIndex == -1 ? typeIndex + 1 : attributeIndex + 1);

Review Comment:
   I rewrote the index and indexer to always store the same amount of entries. So the code is much simpler now. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907392117


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +358,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();

Review Comment:
   I have rewritten the algorithm. Added tests, so it should be ok now. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r906041673


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +358,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();

Review Comment:
   The function is used only if the query has kind `CASE_INSENSITIVE_CAMEL_CASE`. So it shouldn't be case sensitive (the name od method is matchInsensitiveCamelCase) and your example of `matchInsensitiveCamelCase("RgEx", "RegExParser")` imho should return true . But probably I don't understand the `CASE_INSENSITIVE_CAMEL_CASE` kind. 



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


[GitHub] [netbeans] sdedic commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r905855284


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/language/GroovyTypeSearcher.java:
##########
@@ -59,10 +62,38 @@ public class GroovyTypeSearcher implements IndexSearcher {
 
     @Override
     public Set<? extends Descriptor> getSymbols(Project project, String textForQuery, Kind kind, Helper helper) {
-        // TODO - search for methods too!!
+        GroovyIndex index = GroovyIndex.get(QuerySupport.findRoots(project, Collections.singleton(ClassPath.SOURCE), Collections.<String>emptySet(), Collections.<String>emptySet()));
 
-        // For now, just at a minimum do the types
-        return getTypes(project, textForQuery, kind, helper);
+        kind = adjustKind(kind, textForQuery);
+        
+        if (kind == QuerySupport.Kind.CASE_INSENSITIVE_PREFIX /*|| kind == QuerySupport.Kind.CASE_INSENSITIVE_REGEXP*/) {
+            textForQuery = textForQuery.toLowerCase(Locale.ENGLISH);
+        }
+        
+        Set<GroovyTypeDescriptor> result = new HashSet<GroovyTypeDescriptor>();
+        
+        
+        if (textForQuery.length() > 0) {
+            Set<IndexedClass> classes = null;
+            classes = index.getClasses(textForQuery, kind);
+            for (IndexedClass cls : classes) {
+                result.add(new GroovyTypeDescriptor(cls, helper));
+            }
+            
+            Set<IndexedField> fields = index.getFields(textForQuery, null, kind);
+            for (IndexedField field : fields) {
+                result.add(new GroovyTypeDescriptor(field, helper));
+            }
+            
+            Set<IndexedMethod> methods = index.getMethods(textForQuery, null, kind);
+            for (IndexedMethod method : methods) {
+                if (method.getOffsetRange(null)  != OffsetRange.NONE) {

Review Comment:
   I don't think we can goto to anything synthetic ;)



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r893659838


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java:
##########
@@ -321,6 +323,9 @@ private void indexClass(ASTClass element, IndexDocument document) {
             document.addPair(FQN_NAME, element.getFqn(), true, true);
             document.addPair(CLASS_NAME, name, true, true);
             document.addPair(CASE_INSENSITIVE_CLASS_NAME, name.toLowerCase(), true, true);
+            StringBuilder sb = new StringBuilder();

Review Comment:
   I'm not sure what you mean, the link shows me the whole diff.  But inner classes, even with the same name as outer class should work and work.



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r906041673


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +358,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();

Review Comment:
   The function is used only if the query has kind `CASE_INSENSITIVE_CAMEL_CASE`. So it shouldn't be case sensitive (the name od method is `matchInsensitiveCamelCase`) and your example of `matchInsensitiveCamelCase("RgEx", "RegExParser")` imho should return true . But probably I don't understand the `CASE_INSENSITIVE_CAMEL_CASE` kind. 



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


[GitHub] [netbeans] sdedic commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907507231


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -340,14 +332,56 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
 
                     // XXX THIS DOES NOT WORK WHEN THERE ARE IDENTICAL SIGNATURES!!!
                     assert map != null;
-                    methods.add(createMethod(signature, map));
+                    IndexedMethod method = createMethod(signature, map);
+                    if (method != null) {
+                        methods.add(method);
+                    }
                 }
             }
         }
 
         return methods;
     }
-
+    
+    // protected for test reasons.
+    protected static boolean matchCamelCase(String prefix, String where, boolean insensitive) {
+        if (where == null || where.length() == 0 || prefix == null || prefix.length() == 0) {
+            return false;
+        }
+        if (!prefix.equals(cachedPrefix) || cachedInsensitive != insensitive) {
+            cachedCamelCasePattern = null;
+        }
+        if (cachedCamelCasePattern == null) {
+            StringBuilder sb = new StringBuilder();
+            int lastIndex = 0;
+            int index;
+            do {
+                index = findNextUpper(prefix, lastIndex + 1);
+                String token = prefix.substring(lastIndex, index == -1 ? prefix.length() : index);
+                if (insensitive) {

Review Comment:
   What about `matchCamelCase("CaCa", "CAMELCase")` -- IMHO the first token ("Ca") will be searched as `Ca|ca`, which will not match "`CA`MELCase" ... ? It's probably better to just compile the pattern with `Pattern.CASE_INSENSITIVE`
   
   This works OK in Java BUT Java indexer uses pair of fields, one for raw values and the other for case-insensitive (lowercase) ones. This would require yet additional changes ... for (IMHO) a niche case. Let's leave it for now, but I wonder what other queries could be affected.



##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -340,14 +332,56 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
 
                     // XXX THIS DOES NOT WORK WHEN THERE ARE IDENTICAL SIGNATURES!!!
                     assert map != null;
-                    methods.add(createMethod(signature, map));
+                    IndexedMethod method = createMethod(signature, map);
+                    if (method != null) {
+                        methods.add(method);
+                    }
                 }
             }
         }
 
         return methods;
     }
-
+    
+    // protected for test reasons.
+    protected static boolean matchCamelCase(String prefix, String where, boolean insensitive) {
+        if (where == null || where.length() == 0 || prefix == null || prefix.length() == 0) {
+            return false;
+        }
+        if (!prefix.equals(cachedPrefix) || cachedInsensitive != insensitive) {

Review Comment:
   Note the `cachePrefix`, `cachedInsensitive` and `cachedCamelCasePattern` are shared between all instances of `GroovyIndex` across threads (2 threads can call `GroovyIndex.getFields()` simultaneously). Without synchronizing, Java may flush just part of the triplet on write making it temporarily inconsistent for other concurrent accesses.



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


[GitHub] [netbeans] ppisl merged pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl merged PR #4091:
URL: https://github.com/apache/netbeans/pull/4091


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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r904954816


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -348,6 +359,25 @@ public Set<IndexedMethod> getMethods(final String name, final String clz, QueryS
         return methods;
     }
 
+    private boolean matchInsensitiveCamelCase(String text, String where) {
+        if (text.length() > where.length()) {
+            return false;
+        }
+        String textP = text.toLowerCase();
+        String whereP = where.toLowerCase();
+        int index = -1;
+        for (int i = 0; i < textP.length(); i++) {
+            index = whereP.indexOf(textP.charAt(i), index + 1);
+            if (index == -1) {
+                return false;
+            }
+            if (whereP.length() <= (index + 1)) {

Review Comment:
   The method `matchInsensitiveCamelCase` solve the case when search kind is CASE_INSENSITIVE_CAMEL_CASE.



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r905152866


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -252,10 +253,18 @@ public Set<IndexedMethod> getConstructors(final String className) {
                     }
                 }
                 int flags = 0;
-                if (parts.length > 2) {
+                if (parts.length > 3) {

Review Comment:
   I rewrote the index and indexer to always store the same amount of entries. So the code is much simpler now. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907393850


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -649,38 +673,35 @@ private IndexedField createField(String signature, IndexResult map, boolean inhe
 
         //String fqn = map.getValue(GroovyIndexer.FQN_NAME);
 
-        int typeIndex = signature.indexOf(';');
-        String name = signature;
-        String type = "java.lang.Object";
-        if (typeIndex != -1) {
-            int endIndex = signature.indexOf(';', typeIndex + 1);
-            if (endIndex == -1) {
-                endIndex = signature.length();
-            }
-            type = signature.substring(typeIndex + 1, endIndex);
-            name = signature.substring(0, typeIndex);
-        }
-
-        int attributeIndex = signature.indexOf(';', typeIndex + 1);
-        String attributes = null;
-        int flags = 0;
-
-        if (attributeIndex != -1) {
-            flags = IndexedElement.stringToFlag(signature, attributeIndex + 1);
-
-            if (signature.length() > attributeIndex + 1) {
-                attributes = signature.substring(attributeIndex + 1, signature.length());
-            }
-
-            //signature = signature.substring(0, attributeIndex);
-        }
-
+        String[] parts = signature.split(";");
+        String name = parts[0];
+        String type = parts[1].isEmpty() ? "java.lang.Object" : parts[1];
+        int flags = parts[2].isEmpty() ? 0 : IndexedElement.stringToFlag(parts[2], 0);
+        String isProperty = parts[3];
+        String attributes = flags + ";" + isProperty;
+        OffsetRange range = createOffsetRange(parts[4]);
+        
         IndexedField m = IndexedField.create(type, name, clz, map, attributes, flags);
         m.setInherited(inherited);
-
+        if (range != null) {
+            m.setOffsetRange(range);
+        }   
         return m;
     }
 
+    private static OffsetRange createOffsetRange(String text) {
+        OffsetRange result = null;
+        int offsetStartIndex = text.indexOf('[');
+        int commaIndex = text.indexOf(',', offsetStartIndex + 1);
+        int offsetLastIndex = text.indexOf(']', commaIndex != -1 ? commaIndex : offsetStartIndex);

Review Comment:
   Changed :)



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907381358


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/language/GroovyTypeSearcher.java:
##########
@@ -59,10 +62,38 @@ public class GroovyTypeSearcher implements IndexSearcher {
 
     @Override
     public Set<? extends Descriptor> getSymbols(Project project, String textForQuery, Kind kind, Helper helper) {
-        // TODO - search for methods too!!
+        GroovyIndex index = GroovyIndex.get(QuerySupport.findRoots(project, Collections.singleton(ClassPath.SOURCE), Collections.<String>emptySet(), Collections.<String>emptySet()));
 
-        // For now, just at a minimum do the types
-        return getTypes(project, textForQuery, kind, helper);
+        kind = adjustKind(kind, textForQuery);
+        
+        if (kind == QuerySupport.Kind.CASE_INSENSITIVE_PREFIX /*|| kind == QuerySupport.Kind.CASE_INSENSITIVE_REGEXP*/) {
+            textForQuery = textForQuery.toLowerCase(Locale.ENGLISH);
+        }
+        
+        Set<GroovyTypeDescriptor> result = new HashSet<GroovyTypeDescriptor>();
+        
+        
+        if (textForQuery.length() > 0) {

Review Comment:
   In reality `textForQuery` has always a length. Method `getSymbols` is called only with some `textForQuery`. So the condition is unnecessary, but other index searchers use it as well. So in the end it's consistent with Java. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907392800


##########
groovy/groovy.editor/apichanges.xml:
##########
@@ -97,6 +97,20 @@ is the proper place.
             </p>
         </description>
         <class package="org.netbeans.modules.groovy.editor.api.lexer" name="LexUtilities"/>
+    </change>    
+    <change id="GroovyElement.outer">
+        <api name="groovy-parsing"/>
+        <summary>Alternative construction for path more suitable for expressions, API to resolve types</summary>
+        <version major="1" minor="85"/>

Review Comment:
   Corrected. This was my mistake. I didn't noticed when I merged it with the trunk.



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907393501


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -242,7 +243,7 @@ public Set<IndexedMethod> getConstructors(final String className) {
 
             for (String constructor : constructors) {
                 String[] parts = constructor.split(";");
-                String paramList = parts.length > 1 ? parts[1] : ""; // NOI18N
+                String paramList = parts[1];

Review Comment:
   Sanity checks added. Not only on this place, but also for fields and methods. 



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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4091: Implementation of GoTo Symbol for Groovy

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r893662149


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -252,10 +253,18 @@ public Set<IndexedMethod> getConstructors(final String className) {
                     }
                 }
                 int flags = 0;
-                if (parts.length > 2) {
+                if (parts.length > 3) {

Review Comment:
   Type and range are mondatory. The attribute part is optional. I tried to keep same order as the version before, I will change the order. 



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