Merge branches 'master' and 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -26,12 +26,14 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
import org.apache.maven.model.DependencyManagement;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
@@ -245,7 +247,7 @@ public class MavenCore {
|
||||
return artifacts.parallelStream().map(artifact -> {
|
||||
if (!artifact.isResolved()) {
|
||||
try {
|
||||
artifact = maven.resolve(artifact, null, request);
|
||||
artifact = maven.resolve(artifact, project.getRemoteArtifactRepositories(), request);
|
||||
} catch (MavenException e) {
|
||||
Log.log(e);
|
||||
// Maven 2.x quirk: an artifact always points at the local repo,
|
||||
@@ -269,20 +271,20 @@ public class MavenCore {
|
||||
return lrm.getRepository().getBasedir();
|
||||
}
|
||||
|
||||
public Artifact getSources(Artifact artifact) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_SOURCES, null, maven.createExecutionRequest());
|
||||
public Artifact getSources(Artifact artifact, List<ArtifactRepository> repositories) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_SOURCES, repositories, maven.createExecutionRequest());
|
||||
}
|
||||
|
||||
public Artifact getJavadoc(Artifact artifact) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_JAVADOC, null, maven.createExecutionRequest());
|
||||
public Artifact getJavadoc(Artifact artifact, List<ArtifactRepository> repositories) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_JAVADOC, repositories, maven.createExecutionRequest());
|
||||
}
|
||||
|
||||
public Artifact getTests(Artifact artifact) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_TESTS, null, maven.createExecutionRequest());
|
||||
public Artifact getTests(Artifact artifact, List<ArtifactRepository> repositories) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_TESTS, repositories, maven.createExecutionRequest());
|
||||
}
|
||||
|
||||
public Artifact getTestSources(Artifact artifact) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_TESTSOURCES, null, maven.createExecutionRequest());
|
||||
public Artifact getTestSources(Artifact artifact, List<ArtifactRepository> repositories) throws MavenException {
|
||||
return maven.resolve(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), CLASSIFIER_TESTSOURCES, repositories, maven.createExecutionRequest());
|
||||
}
|
||||
|
||||
public Stream<Path> getJreLibs() throws MavenException {
|
||||
|
||||
@@ -192,7 +192,7 @@ public class MavenProjectClasspath implements IClasspath {
|
||||
return new ParserJavadocProvider(type -> {
|
||||
try {
|
||||
Artifact artifact = getArtifactFromJarFile(classpathResource).get();
|
||||
URL sourceContainer = maven.getSources(artifact).getFile().toURI().toURL();
|
||||
URL sourceContainer = maven.getSources(artifact, project.getRemoteArtifactRepositories()).getFile().toURI().toURL();
|
||||
return SourceUrlProviderFromSourceContainer.JAR_SOURCE_URL_PROVIDER.sourceUrl(sourceContainer,
|
||||
type);
|
||||
} catch (MavenException e) {
|
||||
@@ -225,7 +225,7 @@ public class MavenProjectClasspath implements IClasspath {
|
||||
return new HtmlJavadocProvider(type -> {
|
||||
try {
|
||||
Artifact artifact = getArtifactFromJarFile(classpathResource).get();
|
||||
URL sourceContainer = maven.getJavadoc(artifact).getFile().toURI().toURL();
|
||||
URL sourceContainer = maven.getJavadoc(artifact, project.getRemoteArtifactRepositories()).getFile().toURI().toURL();
|
||||
return SourceUrlProviderFromSourceContainer.JAR_JAVADOC_URL_PROVIDER.sourceUrl(sourceContainer,
|
||||
type);
|
||||
} catch (MavenException e) {
|
||||
|
||||
@@ -343,6 +343,20 @@ public class Editor {
|
||||
assertContains(expectSnippet, hover.getContents().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies an expected text is the hover text that is computed when
|
||||
* hovering mouse at position at the end of first occurrence of a given
|
||||
* string in the editor.
|
||||
*/
|
||||
public void assertHoverExactText(String afterString, String expectedHover) throws Exception {
|
||||
int pos = getRawText().indexOf(afterString);
|
||||
if (pos>=0) {
|
||||
pos += afterString.length();
|
||||
}
|
||||
Hover hover = harness.getHover(document, document.toPosition(pos));
|
||||
assertEquals(expectedHover, hover.getContents().toString());
|
||||
}
|
||||
|
||||
public void assertCompletionDetails(String expectLabel, String expectDetail, String expectDocSnippet) throws Exception {
|
||||
CompletionItem it = harness.resolveCompletionItem(assertCompletionWithLabel(expectLabel));
|
||||
if (expectDetail!=null) {
|
||||
|
||||
@@ -24,12 +24,14 @@ public class InformationTemplates {
|
||||
|
||||
public static Renderable createHover(PropertyInfo info) {
|
||||
Deprecation deprecation = createDeprecation(info);
|
||||
return InformationTemplates.createHover(info.getId(), info.getType(), info.getDefaultValue(), text(info.getDescription()), deprecation);
|
||||
Renderable description = info.getDescription() == null ? null : text(info.getDescription());
|
||||
return InformationTemplates.createHover(info.getId(), info.getType(), info.getDefaultValue(), description, deprecation);
|
||||
}
|
||||
|
||||
public static Renderable createCompletionDocumentation(PropertyInfo info) {
|
||||
Deprecation deprecation = createDeprecation(info);
|
||||
return InformationTemplates.createCompletionDocumentation(text(info.getDescription()), info.getDefaultValue(), deprecation);
|
||||
Renderable description = info.getDescription() == null ? null : text(info.getDescription());
|
||||
return InformationTemplates.createCompletionDocumentation(description, info.getDefaultValue(), deprecation);
|
||||
}
|
||||
|
||||
public static Renderable createHover(String id, String type, Object defaultValue, Renderable description, Deprecation deprecation) {
|
||||
|
||||
@@ -1577,6 +1577,14 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
editor.assertNoHover("ggggg.kkkk");
|
||||
}
|
||||
|
||||
@Test public void testEmptyDescriptionHover() throws Exception {
|
||||
data("debug", "java.lang.String", null, null);
|
||||
Editor editor = newEditor(
|
||||
"debug=something\n"
|
||||
);
|
||||
editor.assertHoverExactText("debug", "[**debug** \n[java.lang.String](null)]");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SimpleLanguageServer newLanguageServer() {
|
||||
BootPropertiesLanguageServer server = new BootPropertiesLanguageServer(md.getIndexProvider(), typeUtilProvider, javaProjectFinder);
|
||||
|
||||
Reference in New Issue
Block a user