Skip to content

Commit

Permalink
Logging to track Boot LS start/stop
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Mar 27, 2023
1 parent 01caab7 commit ebddbc6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -40,6 +40,7 @@ public BootProjectTracker(Logger logger, Collection<Consumer<Set<IJavaProject>>>

@Override
public void classpathChanged(IJavaProject jp) {
logger.log("Classpath changed for project: " + jp.getElementName());
processProject(jp);
}
});
Expand All @@ -56,10 +57,12 @@ public void classpathChanged(IJavaProject jp) {
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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@ 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();
if (bootProjectPresent != currentBootProjectsPresent) {
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);
Expand Down

0 comments on commit ebddbc6

Please sign in to comment.