Merge branch 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -90,19 +90,19 @@ public class SpringIndexer {
|
||||
|
||||
@Override
|
||||
public void created(IJavaProject project) {
|
||||
log.debug("project created event: {}", project.getElementName());
|
||||
log.info("project created event: {}", project.getElementName());
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changed(IJavaProject project) {
|
||||
log.debug("project changed event: {}", project.getElementName());
|
||||
log.info("project changed event: {}", project.getElementName());
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleted(IJavaProject project) {
|
||||
log.debug("project deleted event: {}", project.getElementName());
|
||||
log.info("project deleted event: {}", project.getElementName());
|
||||
refresh();
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SpringIndexer {
|
||||
updateWorker.start();
|
||||
|
||||
getWorkspaceService().onDidChangeWorkspaceFolders(evt -> {
|
||||
log.debug("workspace roots have changed event arrived - added: " + evt.getEvent().getAdded() + " - removed: " + evt.getEvent().getRemoved());
|
||||
log.info("workspace roots have changed event arrived - added: " + evt.getEvent().getAdded() + " - removed: " + evt.getEvent().getRemoved());
|
||||
refresh();
|
||||
});
|
||||
|
||||
@@ -208,7 +208,7 @@ public class SpringIndexer {
|
||||
symbolsByDoc.clear();
|
||||
|
||||
Collection<WorkspaceFolder> roots = server.getWorkspaceRoots();
|
||||
log.debug("refresh spring indexer for roots: {}", roots.toString());
|
||||
log.info("refresh spring indexer for roots: {}", roots.toString());
|
||||
initialize(roots);
|
||||
}
|
||||
}
|
||||
@@ -552,7 +552,7 @@ public class SpringIndexer {
|
||||
private final CompletableFuture<Void> future;
|
||||
|
||||
public InitializeItem(WorkspaceFolder[] workspaceRoots) {
|
||||
log.debug("initialze spring indexer task created for roots: " + Arrays.toString(workspaceRoots));
|
||||
log.info("initialze spring indexer task created for roots: " + Arrays.toString(workspaceRoots));
|
||||
|
||||
this.workspaceRoots = workspaceRoots;
|
||||
this.future = new CompletableFuture<Void>();
|
||||
@@ -566,18 +566,18 @@ public class SpringIndexer {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!future.isCancelled()) {
|
||||
log.debug("initialze spring indexer task started for roots: " + Arrays.toString(workspaceRoots));
|
||||
log.info("initialze spring indexer task started for roots: " + Arrays.toString(workspaceRoots));
|
||||
|
||||
for (WorkspaceFolder root : workspaceRoots) {
|
||||
SpringIndexer.this.scanFiles(root);
|
||||
}
|
||||
|
||||
log.debug("initialze spring indexer task completed for roots: " + Arrays.toString(workspaceRoots));
|
||||
log.info("initialze spring indexer task completed for roots: " + Arrays.toString(workspaceRoots));
|
||||
|
||||
future.complete(null);
|
||||
}
|
||||
else {
|
||||
log.debug("initialze spring indexer task canceled for roots: " + Arrays.toString(workspaceRoots));
|
||||
log.info("initialze spring indexer task canceled for roots: " + Arrays.toString(workspaceRoots));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.Annotations;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
|
||||
@@ -39,10 +41,15 @@ import org.springframework.ide.vscode.languageserver.testharness.LanguageServerH
|
||||
import org.springframework.ide.vscode.project.harness.BootJavaLanguageServerHarness;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.base.Suppliers;
|
||||
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public class SpringIndexerTest {
|
||||
|
||||
private static Supplier<Logger> LOG = Suppliers.memoize(() -> LoggerFactory.getLogger(SpringIndexerTest.class));
|
||||
|
||||
private Map<String, SymbolProvider> symbolProviders;
|
||||
private LanguageServerHarness<ComposableLanguageServer<BootJavaLanguageServerComponents>> harness;
|
||||
@@ -333,6 +340,7 @@ public class SpringIndexerTest {
|
||||
|
||||
@Test
|
||||
public void testRefreshOnProjectChange() throws Exception {
|
||||
LOG.get().info("testRefreshOnProjectChange STARTED");
|
||||
harness.intialize(new File(ProjectsHarness.class.getResource("/test-projects/test-annotation-indexing-parent/test-annotation-indexing/").toURI()));
|
||||
|
||||
File directory = new File(ProjectsHarness.class.getResource("/test-projects/test-annotation-indexing-parent/test-annotation-indexing/").toURI());
|
||||
@@ -345,11 +353,14 @@ public class SpringIndexerTest {
|
||||
assertFalse(indexer().isInitializing());
|
||||
harness.changeFile(pomFile.toURI().toString());
|
||||
// Refresh in progress
|
||||
LOG.get().info("testRefreshOnProjectChange - FILE CHANGED HANLED");
|
||||
assertTrue(indexer().isInitializing());
|
||||
LOG.get().info("testRefreshOnProjectChange - INDEX INIT in PROGRESS");
|
||||
|
||||
allSymbols = indexer().getAllSymbols("");
|
||||
assertFalse(indexer().isInitializing());
|
||||
assertEquals(6, allSymbols.size());
|
||||
LOG.get().info("testRefreshOnProjectChange - FINISHED");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user