dbalek commented on code in PR #6123:
URL: https://github.com/apache/netbeans/pull/6123#discussion_r1243349427


##########
java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/protocol/WorkspaceServiceImpl.java:
##########
@@ -926,33 +927,34 @@ public boolean cancel(boolean mayInterruptIfRunning) {
         WORKER.post(() -> {
             try {
                 List<WorkspaceSymbol> symbols = new ArrayList<>();
-                if (client.getNbCodeCapabilities().wantsJavaSupport()) {
-                    SearchType searchType = getSearchType(queryFin, exactFin, 
false, null, null);
+                SearchType searchType = getSearchType(queryFin, exactFin, 
false, null, null);
 
-                    // CSL Part
-                    Collection<? extends IndexSearcher> providers = 
Lookup.getDefault().lookupAll(IndexSearcher.class);
-                    Set<? extends IndexSearcher.Descriptor> descriptors;
+                // CSL Part
+                Collection<? extends IndexSearcher> providers = 
Lookup.getDefault().lookupAll(IndexSearcher.class);
+                Set<? extends IndexSearcher.Descriptor> descriptors;
+                for (Project project : openedProjects) {
                     if (!providers.isEmpty()) {
                         for (IndexSearcher provider : providers) {
-                            descriptors = provider.getSymbols(null, queryFin, 
Utils.searchType2QueryKind(searchType), null);
+                            descriptors = provider.getSymbols(project, 
queryFin, Utils.searchType2QueryKind(searchType), null);
                             for (IndexSearcher.Descriptor desc : descriptors) {
                                 FileObject fo = desc.getFileObject();
                                 org.netbeans.modules.csl.api.ElementHandle 
element = desc.getElement();
                                 if (fo != null) {
-                                    Position startPos = 
Utils.createPosition(fo, desc.getOffset());
-                                    Position endPos = Utils.createPosition(fo, 
desc.getOffset() + desc.getSimpleName().length());
+                                    Position pos = Utils.createPosition(fo, 
desc.getOffset());
                                     WorkspaceSymbol symbol = new 
WorkspaceSymbol(
                                             desc.getSimpleName(),
                                             
Utils.cslElementKind2SymbolKind(element.getKind()),
-                                            Either.forLeft(new 
Location(Utils.toUri(fo), new Range(startPos, endPos))),
+                                            Either.forLeft(new 
Location(Utils.toUri(fo), new Range(pos, pos))),

Review Comment:
   endPos computed from the startPos by adding a symbol name length does not 
make sense for symbols without name span directly present in the source file.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to