Logging to track Boot LS start/stop

This commit is contained in:
aboyko
2023-03-27 16:58:40 -04:00
parent 01caab7cac
commit ebddbc6e12
2 changed files with 9 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 VMware, Inc.
* Copyright (c) 2022, 2023 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,6 +40,7 @@ public class BootProjectTracker {
@Override
public void classpathChanged(IJavaProject jp) {
logger.log("Classpath changed for project: " + jp.getElementName());
processProject(jp);
}
});
@@ -56,10 +57,12 @@ public class BootProjectTracker {
private void processProject(IJavaProject jp) {
if (isSpringProject(jp)) {
if (springProjects.add(jp)) {
logger.log("Boot project ADDED: " + jp.getElementName());
fireEvent();
}
} else {
if (springProjects.remove(jp)) {
logger.log("Boot project REMOVED: " + jp.getElementName());
fireEvent();
}
}

View File

@@ -35,7 +35,7 @@ public class JdtLsExtensionPlugin extends Plugin {
public void start(BundleContext context) throws Exception {
instance = this;
super.start(context);
Logger logger = Logger.forEclipsePlugin(() -> this);
Logger logger = Logger.forEclipsePlugin(() -> JdtLsExtensionPlugin.getInstance());
initializationFuture().thenAccept(v -> {
Consumer<Set<IJavaProject>> l = bootProjects -> {
boolean currentBootProjectsPresent = !bootProjects.isEmpty();
@@ -43,11 +43,15 @@ public class JdtLsExtensionPlugin extends Plugin {
bootProjectPresent = currentBootProjectsPresent;
try {
if (bootProjectPresent) {
logger.log("About to START Boot LS since Boot project has been detected in the workspace");
JavaLanguageServerPlugin.getInstance().getClientConnection()
.executeClientCommand("vscode-spring-boot.ls.start");
logger.log("Boot LS START command executed successfully");
} else {
logger.log("About to STOP Boot LS since no Boot projects have been detected in the workspace");
JavaLanguageServerPlugin.getInstance().getClientConnection()
.executeClientCommand("vscode-spring-boot.ls.stop");
logger.log("Boot LS STOP command executed successfully");
}
} catch (Exception e) {
logger.log(e);