Merge branch 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -29,11 +29,6 @@
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enable/Disable detecting changes of running Spring Boot applications"
|
||||
},
|
||||
"strict-project-matching.on": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Use restrictive mechanism to match live running boot apps automatically with projects in your workspace"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -39,9 +39,6 @@ public class BootLanguageServerPreferencesPage extends FieldEditorPreferencePage
|
||||
|
||||
BooleanFieldEditor liveChangeDetectionPrefEditor = new BooleanFieldEditor(Constants.PREF_CHANGE_DETECTION, "Live Boot Change Detection", getFieldEditorParent());
|
||||
addField(liveChangeDetectionPrefEditor);
|
||||
|
||||
BooleanFieldEditor strictProjectMatchingPrefEditor = new BooleanFieldEditor(Constants.PREF_STRICT_PROJECT_MATCH, "Use restrictive mechanism to match live running boot apps automatically with projects in your workspace", getFieldEditorParent());
|
||||
addField(strictProjectMatchingPrefEditor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,5 @@ public class Constants {
|
||||
|
||||
public static final String PREF_BOOT_HINTS = "boot-java.boot-hints.on";
|
||||
public static final String PREF_CHANGE_DETECTION = "boot-java.change-detection.on";
|
||||
public static final String PREF_STRICT_PROJECT_MATCH = "boot-java.strict-project-matching.on";
|
||||
|
||||
}
|
||||
|
||||
@@ -125,15 +125,12 @@ public class DelegatingStreamConnectionProvider implements StreamConnectionProvi
|
||||
Map<String, Object> bootJavaObj = new HashMap<>();
|
||||
Map<String, Object> bootHint = new HashMap<>();
|
||||
Map<String, Object> bootChangeDetection = new HashMap<>();
|
||||
Map<String, Object> bootStrictProjectMatching = new HashMap<>();
|
||||
|
||||
bootHint.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_BOOT_HINTS));
|
||||
bootChangeDetection.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_CHANGE_DETECTION));
|
||||
bootStrictProjectMatching.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_STRICT_PROJECT_MATCH));
|
||||
|
||||
bootJavaObj.put("boot-hints", bootHint);
|
||||
bootJavaObj.put("change-detection", bootChangeDetection);
|
||||
bootJavaObj.put("strict-project-matching", bootStrictProjectMatching);
|
||||
|
||||
settings.put("boot-java", bootJavaObj);
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ public class PrefsInitializer extends AbstractPreferenceInitializer {
|
||||
public void initializeDefaultPreferences() {
|
||||
BootLanguageServerPlugin.getDefault().getPreferenceStore().setDefault(Constants.PREF_BOOT_HINTS, true);
|
||||
BootLanguageServerPlugin.getDefault().getPreferenceStore().setDefault(Constants.PREF_CHANGE_DETECTION, false);
|
||||
BootLanguageServerPlugin.getDefault().getPreferenceStore().setDefault(Constants.PREF_STRICT_PROJECT_MATCH, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jdt</groupId>
|
||||
<artifactId>org.eclipse.jdt.core</artifactId>
|
||||
<version>3.13.102</version>
|
||||
<version>3.14.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
|
||||
@@ -16,8 +16,6 @@ import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.DefaultRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringLiveHoverWatchdog;
|
||||
import org.springframework.ide.vscode.boot.jdt.ls.JavaProjectsService;
|
||||
@@ -65,7 +63,7 @@ public class BootLanguageServerParams {
|
||||
public final TypeUtilProvider typeUtilProvider;
|
||||
|
||||
//Boot Java
|
||||
public final ProjectAwareRunningAppProvider runningAppProvider;
|
||||
public final RunningAppProvider runningAppProvider;
|
||||
public final Duration watchDogInterval;
|
||||
|
||||
public BootLanguageServerParams(
|
||||
@@ -73,7 +71,7 @@ public class BootLanguageServerParams {
|
||||
ProjectObserver projectObserver,
|
||||
SpringPropertyIndexProvider indexProvider,
|
||||
TypeUtilProvider typeUtilProvider,
|
||||
ProjectAwareRunningAppProvider runningAppProvider,
|
||||
RunningAppProvider runningAppProvider,
|
||||
Duration watchDogInterval
|
||||
) {
|
||||
super();
|
||||
@@ -102,7 +100,7 @@ public class BootLanguageServerParams {
|
||||
jdtProjectCache,
|
||||
indexProvider,
|
||||
(IDocument doc) -> new TypeUtil(jdtProjectCache.find(new TextDocumentIdentifier(doc.getUri()))),
|
||||
new DefaultRunningAppProvider(RunningAppProvider.createDefault(server)),
|
||||
RunningAppProvider.createDefault(server),
|
||||
SpringLiveHoverWatchdog.DEFAULT_INTERVAL
|
||||
);
|
||||
};
|
||||
@@ -164,7 +162,7 @@ public class BootLanguageServerParams {
|
||||
projectObserver,
|
||||
indexProvider,
|
||||
typeUtilProvider,
|
||||
ProjectAwareRunningAppProvider.NULL,
|
||||
RunningAppProvider.NULL,
|
||||
SpringLiveHoverWatchdog.DEFAULT_INTERVAL
|
||||
);
|
||||
};
|
||||
@@ -192,7 +190,7 @@ public class BootLanguageServerParams {
|
||||
projectObserver,
|
||||
indexProvider,
|
||||
(IDocument doc) -> new TypeUtil(javaProjectFinder.find(new TextDocumentIdentifier(doc.getUri()))),
|
||||
ProjectAwareRunningAppProvider.NULL,
|
||||
RunningAppProvider.NULL,
|
||||
SpringLiveHoverWatchdog.DEFAULT_INTERVAL
|
||||
);
|
||||
};
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package org.springframework.ide.vscode.boot.java;
|
||||
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.Settings;
|
||||
import org.springframework.ide.vscode.commons.util.Log;
|
||||
|
||||
/**
|
||||
* Boot-Java LS settings
|
||||
@@ -33,11 +32,6 @@ public class BootJavaConfig {
|
||||
return enabled != null && enabled.booleanValue();
|
||||
}
|
||||
|
||||
public boolean isStrictProjectMatchingEnabled() {
|
||||
Boolean enabled = settings.getBoolean("boot-java", "strict-project-matching", "on");
|
||||
return enabled != null && enabled.booleanValue();
|
||||
}
|
||||
|
||||
public void handleConfigurationChange(Settings newConfig) {
|
||||
this.settings = newConfig;
|
||||
}
|
||||
|
||||
@@ -36,10 +36,8 @@ import org.springframework.ide.vscode.boot.java.handlers.BootJavaReferencesHandl
|
||||
import org.springframework.ide.vscode.boot.java.handlers.BootJavaWorkspaceSymbolHandler;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.CodeLensProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.CompletionProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.DefaultRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.HighlightProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.HoverProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ReferenceProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
|
||||
@@ -198,10 +196,6 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent
|
||||
else {
|
||||
liveChangeDetectionWatchdog.disableHighlights();
|
||||
}
|
||||
|
||||
if (serverParams.runningAppProvider instanceof DefaultRunningAppProvider) {
|
||||
((DefaultRunningAppProvider) serverParams.runningAppProvider).setStrictProjectMatching(config.isStrictProjectMatchingEnabled());
|
||||
}
|
||||
});
|
||||
|
||||
server.onInitialize(this::initialize);
|
||||
@@ -293,7 +287,7 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent
|
||||
}
|
||||
|
||||
protected BootJavaHoverProvider createHoverHandler(JavaProjectFinder javaProjectFinder,
|
||||
ProjectAwareRunningAppProvider runningAppProvider) {
|
||||
RunningAppProvider runningAppProvider) {
|
||||
AnnotationHierarchyAwareLookup<HoverProvider> providers = new AnnotationHierarchyAwareLookup<>();
|
||||
|
||||
providers.put(org.springframework.ide.vscode.boot.java.value.Constants.SPRING_VALUE, new ValueHoverProvider());
|
||||
|
||||
@@ -58,9 +58,10 @@ public class BootJavaHoverProvider implements HoverHandler {
|
||||
private JavaProjectFinder projectFinder;
|
||||
private BootJavaLanguageServerComponents server;
|
||||
private AnnotationHierarchyAwareLookup<HoverProvider> hoverProviders;
|
||||
private ProjectAwareRunningAppProvider runningAppProvider;
|
||||
private RunningAppProvider runningAppProvider;
|
||||
|
||||
public BootJavaHoverProvider(BootJavaLanguageServerComponents server, JavaProjectFinder projectFinder, AnnotationHierarchyAwareLookup<HoverProvider> specificProviders, ProjectAwareRunningAppProvider runningAppProvider) {
|
||||
public BootJavaHoverProvider(BootJavaLanguageServerComponents server, JavaProjectFinder projectFinder,
|
||||
AnnotationHierarchyAwareLookup<HoverProvider> specificProviders, RunningAppProvider runningAppProvider) {
|
||||
this.server = server;
|
||||
this.projectFinder = projectFinder;
|
||||
this.hoverProviders = specificProviders;
|
||||
@@ -294,7 +295,7 @@ public class BootJavaHoverProvider implements HoverHandler {
|
||||
|
||||
private SpringBootApp[] getRunningSpringApps(IJavaProject project) {
|
||||
try {
|
||||
return runningAppProvider.getAllRunningSpringApps(project).toArray(new SpringBootApp[0]);
|
||||
return RunningAppMatcher.getAllMatchingApps(runningAppProvider.getAllRunningSpringApps(), project).toArray(new SpringBootApp[0]);
|
||||
} catch (Exception e) {
|
||||
Log.log(e);
|
||||
return new SpringBootApp[0];
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2018 Pivotal, 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.handlers;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public interface ProjectAwareRunningAppProvider {
|
||||
|
||||
static final ProjectAwareRunningAppProvider NULL = (project) -> ImmutableList.of();
|
||||
|
||||
Collection<SpringBootApp> getAllRunningSpringApps(IJavaProject javaProject) throws Exception;
|
||||
}
|
||||
@@ -25,35 +25,22 @@ import org.springframework.ide.vscode.commons.util.CollectorUtil;
|
||||
/**
|
||||
* @author Martin Lippert
|
||||
*/
|
||||
public class DefaultRunningAppProvider implements ProjectAwareRunningAppProvider {
|
||||
public class RunningAppMatcher {
|
||||
|
||||
private RunningAppProvider allApps;
|
||||
|
||||
public DefaultRunningAppProvider(RunningAppProvider allApps) {
|
||||
this.allApps = allApps;
|
||||
}
|
||||
|
||||
private boolean strictProjectMatchingEnabled = false;
|
||||
|
||||
public void setStrictProjectMatching(boolean strictProjectMatchingEnabled) {
|
||||
this.strictProjectMatchingEnabled = strictProjectMatchingEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<SpringBootApp> getAllRunningSpringApps(IJavaProject project) throws Exception {
|
||||
Collection<SpringBootApp> apps = allApps.getAllRunningSpringApps();
|
||||
|
||||
if (project != null && strictProjectMatchingEnabled) {
|
||||
return apps.stream().filter((app) -> {
|
||||
return doesProjectMatch(app, project);
|
||||
public static Collection<SpringBootApp> getAllMatchingApps(Collection<SpringBootApp> apps, IJavaProject project) throws Exception {
|
||||
if (project != null) {
|
||||
Collection<SpringBootApp> matchedProjects = apps.stream().filter((app) -> {
|
||||
return RunningAppMatcher.doesProjectMatch(app, project);
|
||||
}).collect(CollectorUtil.toImmutableList());
|
||||
|
||||
if (matchedProjects.size() > 0) {
|
||||
return matchedProjects;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return apps;
|
||||
}
|
||||
return apps;
|
||||
}
|
||||
|
||||
private boolean doesProjectMatch(SpringBootApp app, IJavaProject project) {
|
||||
private static boolean doesProjectMatch(SpringBootApp app, IJavaProject project) {
|
||||
if (doesProjectNameMatch(app, project)) return true;
|
||||
if (doesProjectThinJarWrapperMatch(app, project)) return true;
|
||||
if (doesClasspathMatch(app, project)) return true;
|
||||
@@ -61,6 +48,16 @@ public class DefaultRunningAppProvider implements ProjectAwareRunningAppProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean doesProjectNameMatch(SpringBootApp app, IJavaProject project) {
|
||||
try {
|
||||
String projectName = app.getSystemProperty("spring.boot.project.name");
|
||||
return projectName != null && projectName.equals(project.getElementName());
|
||||
}
|
||||
catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean doesClasspathMatch(SpringBootApp app, IJavaProject project) {
|
||||
try {
|
||||
Set<String> runningAppClasspath = new HashSet<>();
|
||||
@@ -89,17 +86,8 @@ public class DefaultRunningAppProvider implements ProjectAwareRunningAppProvider
|
||||
}
|
||||
|
||||
public static boolean doesProjectThinJarWrapperMatch(SpringBootApp app, IJavaProject project) {
|
||||
// not yet implemented
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean doesProjectNameMatch(SpringBootApp app, IJavaProject project) {
|
||||
try {
|
||||
String projectName = app.getSystemProperty("spring.boot.project.name");
|
||||
return projectName != null && projectName.equals(project.getElementName());
|
||||
}
|
||||
catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,6 @@ package org.springframework.ide.vscode.boot.java.requestmapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -21,10 +20,8 @@ import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.SymbolInformation;
|
||||
import org.eclipse.lsp4j.SymbolKind;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.requestmappings.RequestMapping;
|
||||
import org.springframework.ide.vscode.commons.util.Log;
|
||||
|
||||
/**
|
||||
@@ -32,9 +29,9 @@ import org.springframework.ide.vscode.commons.util.Log;
|
||||
*/
|
||||
public class LiveAppURLSymbolProvider {
|
||||
|
||||
private final ProjectAwareRunningAppProvider runningAppProvider;
|
||||
private final RunningAppProvider runningAppProvider;
|
||||
|
||||
public LiveAppURLSymbolProvider(ProjectAwareRunningAppProvider runningAppProvider) {
|
||||
public LiveAppURLSymbolProvider(RunningAppProvider runningAppProvider) {
|
||||
this.runningAppProvider = runningAppProvider;
|
||||
}
|
||||
|
||||
@@ -44,7 +41,7 @@ public class LiveAppURLSymbolProvider {
|
||||
List<SymbolInformation> result = new ArrayList<>();
|
||||
|
||||
try {
|
||||
SpringBootApp[] runningApps = runningAppProvider.getAllRunningSpringApps(null).toArray(new SpringBootApp[0]);
|
||||
SpringBootApp[] runningApps = runningAppProvider.getAllRunningSpringApps().toArray(new SpringBootApp[0]);
|
||||
for (SpringBootApp app : runningApps) {
|
||||
try {
|
||||
String host = app.getHost();
|
||||
|
||||
@@ -32,8 +32,7 @@ import org.eclipse.lsp4j.Range;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.DefaultRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppMatcher;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
|
||||
import org.springframework.ide.vscode.boot.java.links.VSCodeSourceLinks;
|
||||
@@ -57,7 +56,7 @@ public class SpringLiveChangeDetectionWatchdog {
|
||||
private final long POLLING_INTERVAL_MILLISECONDS;
|
||||
|
||||
private final SimpleLanguageServer server;
|
||||
private final ProjectAwareRunningAppProvider runningAppProvider;
|
||||
private final RunningAppProvider runningAppProvider;
|
||||
private final SourceLinks sourceLinks;
|
||||
|
||||
private final ChangeDetectionHistory changeHistory;
|
||||
@@ -71,7 +70,7 @@ public class SpringLiveChangeDetectionWatchdog {
|
||||
BootJavaLanguageServerComponents bootJavaLanguageServerComponents,
|
||||
SimpleLanguageServer server,
|
||||
ProjectObserver projectObserver,
|
||||
ProjectAwareRunningAppProvider runningAppProvider,
|
||||
RunningAppProvider runningAppProvider,
|
||||
JavaProjectFinder projectFinder,
|
||||
Duration pollingInterval
|
||||
) {
|
||||
@@ -133,7 +132,7 @@ public class SpringLiveChangeDetectionWatchdog {
|
||||
public void update() {
|
||||
if (changeDetectionEnabled) {
|
||||
try {
|
||||
SpringBootApp[] runningBootApps = runningAppProvider.getAllRunningSpringApps(null).toArray(new SpringBootApp[0]);
|
||||
SpringBootApp[] runningBootApps = runningAppProvider.getAllRunningSpringApps().toArray(new SpringBootApp[0]);
|
||||
Change[] changes = changeHistory.checkForChanges(runningBootApps);
|
||||
if (changes != null && changes.length > 0) {
|
||||
for (Change change : changes) {
|
||||
@@ -214,7 +213,7 @@ public class SpringLiveChangeDetectionWatchdog {
|
||||
Collections.addAll(runningClasspath, app.getClasspath());
|
||||
|
||||
for (IJavaProject project : this.observedProjects) {
|
||||
if (DefaultRunningAppProvider.doesClasspathMatch(runningClasspath, project)) {
|
||||
if (RunningAppMatcher.doesClasspathMatch(runningClasspath, project)) {
|
||||
result.add(project);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ package org.springframework.ide.vscode.boot.java.utils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@@ -23,7 +24,7 @@ import org.eclipse.lsp4j.TextDocumentIdentifier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.BootJavaHoverProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppMatcher;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
@@ -46,7 +47,7 @@ public class SpringLiveHoverWatchdog {
|
||||
private final Set<String> watchedDocs;
|
||||
private final SimpleLanguageServer server;
|
||||
private final BootJavaHoverProvider hoverProvider;
|
||||
private ProjectAwareRunningAppProvider runningAppProvider;
|
||||
private final RunningAppProvider runningAppProvider;
|
||||
|
||||
private boolean highlightsEnabled = true;
|
||||
|
||||
@@ -71,7 +72,7 @@ public class SpringLiveHoverWatchdog {
|
||||
public SpringLiveHoverWatchdog(
|
||||
SimpleLanguageServer server,
|
||||
BootJavaHoverProvider hoverProvider,
|
||||
ProjectAwareRunningAppProvider runningAppProvider,
|
||||
RunningAppProvider runningAppProvider,
|
||||
JavaProjectFinder projectFinder,
|
||||
ProjectObserver projectChanges,
|
||||
Duration pollingInterval
|
||||
@@ -147,7 +148,7 @@ public class SpringLiveHoverWatchdog {
|
||||
try {
|
||||
if (runningBootApps == null) {
|
||||
IJavaProject project = identifyProject(docURI);
|
||||
runningBootApps = runningAppProvider.getAllRunningSpringApps(project).toArray(new SpringBootApp[0]);
|
||||
runningBootApps = RunningAppMatcher.getAllMatchingApps(runningAppProvider.getAllRunningSpringApps(), project).toArray(new SpringBootApp[0]);
|
||||
}
|
||||
|
||||
boolean hasCurrentRunningBootApps = runningBootApps != null && runningBootApps.length > 0;
|
||||
@@ -170,11 +171,12 @@ public class SpringLiveHoverWatchdog {
|
||||
protected void update() {
|
||||
if (this.watchedDocs.size() > 0) {
|
||||
try {
|
||||
Collection<SpringBootApp> runningBootApps = runningAppProvider.getAllRunningSpringApps();
|
||||
|
||||
for (String docURI : watchedDocs) {
|
||||
IJavaProject project = identifyProject(docURI);
|
||||
SpringBootApp[] runningBootApps = runningAppProvider.getAllRunningSpringApps(project).toArray(new SpringBootApp[0]);
|
||||
|
||||
update(docURI, runningBootApps);
|
||||
SpringBootApp[] matchingApps = RunningAppMatcher.getAllMatchingApps(runningBootApps, project).toArray(new SpringBootApp[0]);
|
||||
update(docURI, matchingApps);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("", e);
|
||||
|
||||
@@ -13,6 +13,7 @@ package org.springframework.ide.vscode.boot.test;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.springframework.ide.vscode.boot.properties.reconcile.ApplicationPropertiesProblemType.PROP_DUPLICATE_KEY;
|
||||
import static org.springframework.ide.vscode.languageserver.testharness.ClasspathTestUtil.getOutputFolder;
|
||||
import static org.springframework.ide.vscode.languageserver.testharness.TestAsserts.assertContains;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@@ -28,7 +29,6 @@ import org.springframework.ide.vscode.boot.BootLanguageServer;
|
||||
import org.springframework.ide.vscode.boot.BootLanguageServerParams;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.AbstractPropsEditorTest;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.StyledStringMatcher;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringLiveHoverWatchdog;
|
||||
import org.springframework.ide.vscode.boot.metadata.CachingValueProvider;
|
||||
@@ -41,13 +41,10 @@ import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguage
|
||||
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
|
||||
import org.springframework.ide.vscode.commons.util.text.LanguageId;
|
||||
import org.springframework.ide.vscode.languageserver.testharness.Editor;
|
||||
import org.springframework.ide.vscode.project.harness.ProjectsHarness;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import static org.springframework.ide.vscode.languageserver.testharness.ClasspathTestUtil.*;
|
||||
|
||||
/**
|
||||
* Boot App Properties Editor tests
|
||||
*
|
||||
@@ -1631,7 +1628,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
ProjectObserver.NULL,
|
||||
md.getIndexProvider(),
|
||||
typeUtilProvider,
|
||||
ProjectAwareRunningAppProvider.NULL,
|
||||
RunningAppProvider.NULL,
|
||||
SpringLiveHoverWatchdog.DEFAULT_INTERVAL
|
||||
)
|
||||
);
|
||||
|
||||
@@ -17,9 +17,7 @@ import static org.springframework.ide.vscode.languageserver.testharness.Editor.I
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.lsp4j.CompletionItem;
|
||||
import org.eclipse.lsp4j.Diagnostic;
|
||||
import org.junit.Ignore;
|
||||
@@ -28,7 +26,6 @@ import org.springframework.ide.vscode.boot.BootLanguageServer;
|
||||
import org.springframework.ide.vscode.boot.BootLanguageServerParams;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.AbstractPropsEditorTest;
|
||||
import org.springframework.ide.vscode.boot.editor.harness.StyledStringMatcher;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.SpringLiveHoverWatchdog;
|
||||
import org.springframework.ide.vscode.boot.metadata.CachingValueProvider;
|
||||
@@ -37,7 +34,6 @@ import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.languageserver.composable.ComposableLanguageServer;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver;
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
|
||||
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
|
||||
import org.springframework.ide.vscode.commons.util.RunnableWithException;
|
||||
import org.springframework.ide.vscode.commons.util.StringUtil;
|
||||
import org.springframework.ide.vscode.commons.util.text.LanguageId;
|
||||
@@ -3871,7 +3867,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
ProjectObserver.NULL,
|
||||
md.getIndexProvider(),
|
||||
typeUtilProvider,
|
||||
ProjectAwareRunningAppProvider.NULL,
|
||||
RunningAppProvider.NULL,
|
||||
SpringLiveHoverWatchdog.DEFAULT_INTERVAL
|
||||
)
|
||||
);
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.junit.Assert;
|
||||
import org.springframework.ide.vscode.boot.BootLanguageServer;
|
||||
import org.springframework.ide.vscode.boot.BootLanguageServerParams;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.ProjectAwareRunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider;
|
||||
import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider;
|
||||
import org.springframework.ide.vscode.boot.metadata.types.TypeUtilProvider;
|
||||
@@ -55,7 +54,7 @@ public class BootJavaLanguageServerHarness extends LanguageServerHarness<Composa
|
||||
private JavaProjectFinder projectFinder = null;
|
||||
private ProjectObserver projectObserver = null;
|
||||
private SpringPropertyIndexProvider indexProvider = null;
|
||||
private ProjectAwareRunningAppProvider runningAppProvider = null;
|
||||
private RunningAppProvider runningAppProvider = null;
|
||||
private PropertyIndexHarness indexHarness = null;
|
||||
private Duration watchDogInterval = null;
|
||||
private TypeUtilProvider typeUtilProvider = null;
|
||||
@@ -70,12 +69,12 @@ public class BootJavaLanguageServerHarness extends LanguageServerHarness<Composa
|
||||
projectFinder = indexHarness.getProjectFinder();
|
||||
indexProvider = indexHarness.getIndexProvider();
|
||||
projectObserver = ProjectObserver.NULL;
|
||||
runningAppProvider = ProjectAwareRunningAppProvider.NULL;
|
||||
runningAppProvider = RunningAppProvider.NULL;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder runningAppProvider(RunningAppProvider provider) {
|
||||
this.runningAppProvider = (project) -> provider.getAllRunningSpringApps();
|
||||
this.runningAppProvider = () -> provider.getAllRunningSpringApps();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,11 +73,6 @@
|
||||
"default": false,
|
||||
"description": "Enable/Disable detecting changes of running Spring Boot applications"
|
||||
},
|
||||
"boot-java.strict-project-matching.on": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Use restrictive mechanism to match live running boot apps automatically with projects in your workspace"
|
||||
},
|
||||
"boot-java.remote-apps" : {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
Reference in New Issue
Block a user