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/06/24 08:45:39 UTC

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

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