added test code that dumps the bean model when displaying project-related symbols in dialog or view - to be removed later
This commit is contained in:
@@ -12,6 +12,7 @@ package org.springframework.tooling.ls.eclipse.gotosymbol.dialogs;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -24,6 +25,9 @@ import org.eclipse.lsp4j.WorkspaceSymbol;
|
||||
import org.eclipse.lsp4j.WorkspaceSymbolParams;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.eclipse.lsp4j.services.LanguageServer;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.SpringModelLanguageServer;
|
||||
import org.springframework.ide.vscode.commons.protocol.spring.SpringModelService;
|
||||
import org.springframework.tooling.ls.eclipse.gotosymbol.GotoSymbolPlugin;
|
||||
import org.springsource.ide.eclipse.commons.livexp.core.LiveExpression;
|
||||
import org.springsource.ide.eclipse.commons.livexp.util.ExceptionUtil;
|
||||
@@ -88,6 +92,8 @@ public class InProjectSymbolsProvider implements SymbolsProvider {
|
||||
IProject project = this.project.get();
|
||||
|
||||
if (project != null) {
|
||||
dumpBeansModel(project.getName());
|
||||
|
||||
String projectLocationPrefix = LSPEclipseUtils.toUri(project).toASCIIString();
|
||||
query = "locationPrefix:" + projectLocationPrefix + "?" + query;
|
||||
|
||||
@@ -122,4 +128,31 @@ public class InProjectSymbolsProvider implements SymbolsProvider {
|
||||
GotoSymbolPlugin.getInstance().getLog().log(ExceptionUtil.status(e));
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private void dumpBeansModel(String projectName) {
|
||||
List<LanguageServer> activeLanguageServers = LanguageServiceAccessor.getActiveLanguageServers(null);
|
||||
|
||||
for (LanguageServer languageServer : activeLanguageServers) {
|
||||
if (languageServer instanceof SpringModelLanguageServer) {
|
||||
SpringModelLanguageServer springServer = (SpringModelLanguageServer) languageServer;
|
||||
SpringModelService service = springServer.getSpringModelService();
|
||||
CompletableFuture<List<Bean>> beansFuture = service.beans(projectName);
|
||||
|
||||
try {
|
||||
List<Bean> beans = beansFuture.get();
|
||||
|
||||
for (Bean bean : beans) {
|
||||
System.out.println(bean);
|
||||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (java.util.concurrent.ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,9 +22,7 @@ import org.eclipse.jface.bindings.TriggerSequence;
|
||||
import org.eclipse.lsp4e.LSPEclipseUtils;
|
||||
import org.eclipse.lsp4e.LanguageServiceAccessor;
|
||||
import org.eclipse.lsp4e.LanguageServiceAccessor.LSPDocumentInfo;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IWorkbenchPage;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
@@ -78,6 +76,7 @@ public class GotoSymbolHandler extends AbstractHandler {
|
||||
}
|
||||
debug("<<<GotoSymbolHandler.execute");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user