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/30 14:18:05 UTC

[GitHub] [netbeans] ppisl opened a new pull request, #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

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

   This adds the SymbolProvider interface, which is used to retrieve symbols from open projects, to the LSP API. So far we only support symbol extraction from Java. This will make it possible to provide symbols from other languages as well. An implementation has been added to allow symbols to be retrieved from GSF languages.
   
   SymbolProvider returns a list of `StructureElements`. It's not ideal, but I wanted to reuse the code as much as possible. Of course, no children are used from StructureElement, just a file, a simple name and a selection range to find the position. If the range is not known, it can be null and then at least the file is opened. 


-- 
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 #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

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


##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/Utils.java:
##########
@@ -99,6 +102,57 @@ public static SymbolKind structureElementKind2SymbolKind (StructureElement.Kind
         return SymbolKind.Object;
     }
     
+    @NonNull
+    public static QuerySupport.Kind searchType2QueryKind(@NonNull final SearchType searchType) {
+        switch (searchType) {
+            case CAMEL_CASE:
+                return QuerySupport.Kind.CAMEL_CASE;
+            case CASE_INSENSITIVE_CAMEL_CASE:
+                return QuerySupport.Kind.CASE_INSENSITIVE_CAMEL_CASE;
+            case CASE_INSENSITIVE_EXACT_NAME:
+            case EXACT_NAME:
+                return QuerySupport.Kind.EXACT;
+            case CASE_INSENSITIVE_PREFIX:
+                return QuerySupport.Kind.CASE_INSENSITIVE_PREFIX;
+            case CASE_INSENSITIVE_REGEXP:
+                return QuerySupport.Kind.CASE_INSENSITIVE_REGEXP;
+            case PREFIX:
+                return QuerySupport.Kind.PREFIX;
+            case REGEXP:
+                return QuerySupport.Kind.REGEXP;
+            default:
+                throw new IllegalThreadStateException(String.valueOf(searchType));
+        }
+    }
+    
+    public static SymbolKind cslElementKind2SymbolKind(final org.netbeans.modules.csl.api.ElementKind elementKind) {
+        switch(elementKind) {
+            case ATTRIBUTE: return SymbolKind.Property;
+            case CALL: return SymbolKind.Event;
+            case CLASS: return SymbolKind.Class;
+            case CONSTANT: return SymbolKind.Constant;
+            case CONSTRUCTOR: return SymbolKind.Constructor;
+            case DB: return SymbolKind.File;
+            case ERROR: return SymbolKind.Event;
+            case METHOD: return SymbolKind.Method;
+            case FILE: return SymbolKind.File;
+            case FIELD: return SymbolKind.Field;
+            case MODULE: return SymbolKind.Module;
+            case VARIABLE: return SymbolKind.Variable;
+            case GLOBAL: return SymbolKind.Module;
+            case INTERFACE: return SymbolKind.Interface;
+            case KEYWORD: return SymbolKind.Key;
+            case OTHER: return SymbolKind.Object;
+            case PACKAGE: return SymbolKind.Package;
+            case PARAMETER: return SymbolKind.TypeParameter;

Review Comment:
   Maybe `SymbolKind.Variable` could be better ?



-- 
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 #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

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


##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/Utils.java:
##########
@@ -99,6 +102,57 @@ public static SymbolKind structureElementKind2SymbolKind (StructureElement.Kind
         return SymbolKind.Object;
     }
     
+    @NonNull
+    public static QuerySupport.Kind searchType2QueryKind(@NonNull final SearchType searchType) {
+        switch (searchType) {
+            case CAMEL_CASE:
+                return QuerySupport.Kind.CAMEL_CASE;
+            case CASE_INSENSITIVE_CAMEL_CASE:
+                return QuerySupport.Kind.CASE_INSENSITIVE_CAMEL_CASE;
+            case CASE_INSENSITIVE_EXACT_NAME:
+            case EXACT_NAME:
+                return QuerySupport.Kind.EXACT;
+            case CASE_INSENSITIVE_PREFIX:
+                return QuerySupport.Kind.CASE_INSENSITIVE_PREFIX;
+            case CASE_INSENSITIVE_REGEXP:
+                return QuerySupport.Kind.CASE_INSENSITIVE_REGEXP;
+            case PREFIX:
+                return QuerySupport.Kind.PREFIX;
+            case REGEXP:
+                return QuerySupport.Kind.REGEXP;
+            default:
+                throw new IllegalThreadStateException(String.valueOf(searchType));
+        }
+    }
+    
+    public static SymbolKind cslElementKind2SymbolKind(final org.netbeans.modules.csl.api.ElementKind elementKind) {
+        switch(elementKind) {
+            case ATTRIBUTE: return SymbolKind.Property;
+            case CALL: return SymbolKind.Event;
+            case CLASS: return SymbolKind.Class;
+            case CONSTANT: return SymbolKind.Constant;
+            case CONSTRUCTOR: return SymbolKind.Constructor;
+            case DB: return SymbolKind.File;
+            case ERROR: return SymbolKind.Event;
+            case METHOD: return SymbolKind.Method;
+            case FILE: return SymbolKind.File;
+            case FIELD: return SymbolKind.Field;
+            case MODULE: return SymbolKind.Module;
+            case VARIABLE: return SymbolKind.Variable;
+            case GLOBAL: return SymbolKind.Module;
+            case INTERFACE: return SymbolKind.Interface;
+            case KEYWORD: return SymbolKind.Key;
+            case OTHER: return SymbolKind.Object;
+            case PACKAGE: return SymbolKind.Package;
+            case PARAMETER: return SymbolKind.TypeParameter;

Review Comment:
   Yes, it can be better. I will change it. 



-- 
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 pull request #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

Posted by GitBox <gi...@apache.org>.
sdedic commented on PR #4302:
URL: https://github.com/apache/netbeans/pull/4302#issuecomment-1180474758

   > I changed the implementation. Now the implementation does not require any API change. On the other hand, LSP Server depends on CSL API and CSL Types.
   
   IMHO dependency on CSL is not harmful, as CSL provides common infra for many languages (groovy included, *wink*).


-- 
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] dbalek commented on pull request #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

Posted by GitBox <gi...@apache.org>.
dbalek commented on PR #4302:
URL: https://github.com/apache/netbeans/pull/4302#issuecomment-1171335587

   Unfortunately, the current design of `SymbolProvider` that returns a list of `StructureElements` does not fit to the lazy source file loading mechanism currently implemented in Java symbol extraction.


-- 
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 #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

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


-- 
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 pull request #4302: Adding symbol provider to obtain symbols for GoTo Symbol in workspace

Posted by GitBox <gi...@apache.org>.
ppisl commented on PR #4302:
URL: https://github.com/apache/netbeans/pull/4302#issuecomment-1180470211

   I changed the implementation. Now the implementation does not require any API change. On the other hand, LSP Server depends on CSL API and CSL Types. 


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