Merge branch 'master' of github.com:spring-projects/sts4
This commit is contained in:
@@ -28,6 +28,7 @@ import org.eclipse.lsp4j.MarkedString;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.jsonrpc.messages.Either;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.HoverProvider;
|
||||
import org.springframework.ide.vscode.boot.java.utils.HoverContentUtils;
|
||||
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.BadLocationException;
|
||||
@@ -139,8 +140,7 @@ public class RequestMappingHoverProvider implements HoverProvider {
|
||||
for (int i = 0; i < mappingMethods.size(); i++) {
|
||||
Tuple2<RequestMapping, SpringBootApp> mappingMethod = mappingMethods.get(i);
|
||||
|
||||
String processId = mappingMethod.getT2().getProcessID();
|
||||
String processName = mappingMethod.getT2().getProcessName();
|
||||
SpringBootApp app = mappingMethod.getT2();
|
||||
String port = mappingMethod.getT2().getPort();
|
||||
String host = mappingMethod.getT2().getHost();
|
||||
|
||||
@@ -161,8 +161,7 @@ public class RequestMappingHoverProvider implements HoverProvider {
|
||||
renderableUrls.remove(renderableUrls.size() - 1);
|
||||
|
||||
hoverContent.add(Either.forLeft(Renderables.concat(renderableUrls).toMarkdown()));
|
||||
hoverContent.add(Either.forLeft("Process ID: " + processId));
|
||||
hoverContent.add(Either.forLeft("Process Name: " + processName));
|
||||
hoverContent.add(Either.forLeft(HoverContentUtils.getProcessInformation(app)));
|
||||
if (i < mappingMethods.size() - 1) {
|
||||
// Three dashes == line separator in Markdown
|
||||
hoverContent.add(Either.forLeft("---"));
|
||||
|
||||
@@ -64,9 +64,7 @@ public class RequestMappingLiveHoverTest {
|
||||
Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA);
|
||||
editor.assertHoverContains("@RequestMapping(method=RequestMethod.GET)", "[http://cfapps.io:1111/hello-world](http://cfapps.io:1111/hello-world)\n" +
|
||||
"\n" +
|
||||
"Process ID: 22022\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 22022: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -96,15 +94,11 @@ public class RequestMappingLiveHoverTest {
|
||||
Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA);
|
||||
editor.assertHoverContains("@RequestMapping(\"/hello\")", "[http://cfapps.io:999/hello](http://cfapps.io:999/hello)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(\"/goodbye\")", "[http://cfapps.io:999/goodbye](http://cfapps.io:999/goodbye)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -173,9 +167,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@DeleteMapping(\"/greetings\")", "[http://cfapps.io:999/greetings](http://cfapps.io:999/greetings)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -313,9 +305,7 @@ public class RequestMappingLiveHoverTest {
|
||||
editor.assertHoverContains("@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)", "[http://cfapps.io:999/greetings](http://cfapps.io:999/greetings) \n" +
|
||||
"[http://cfapps.io:999/hello](http://cfapps.io:999/hello)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -365,9 +355,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -417,9 +405,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -470,9 +456,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -523,9 +507,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -574,9 +556,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -625,9 +605,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -676,9 +654,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(value=\"/find\", method=GET)", "[http://cfapps.io:999/find](http://cfapps.io:999/find)\n" +
|
||||
"\n" +
|
||||
"Process ID: 76543\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
@@ -730,25 +706,19 @@ public class RequestMappingLiveHoverTest {
|
||||
Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA);
|
||||
editor.assertHoverContains("@RequestMapping(\"/hello\")", "[http://cfapps.io:1000/hello](http://cfapps.io:1000/hello)\n" +
|
||||
"\n" +
|
||||
"Process ID: 70000\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover\n" +
|
||||
"Process 70000: test-request-mapping-live-hover\n" +
|
||||
"\n" +
|
||||
"---\n" +
|
||||
"\n" +
|
||||
"[http://cfapps.io:1001/hello](http://cfapps.io:1001/hello)\n" +
|
||||
"\n" +
|
||||
"Process ID: 80000\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover\n" +
|
||||
"Process 80000: test-request-mapping-live-hover\n" +
|
||||
"\n" +
|
||||
"---\n" +
|
||||
"\n" +
|
||||
"[http://cfapps.io:1002/hello](http://cfapps.io:1002/hello)\n" +
|
||||
"\n" +
|
||||
"Process ID: 90000\n" +
|
||||
"\n" +
|
||||
"Process Name: test-request-mapping-live-hover");
|
||||
"Process 90000: test-request-mapping-live-hover");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -82,13 +83,34 @@ public class GradleProjectClasspath extends JandexClasspath {
|
||||
}
|
||||
}) };
|
||||
}
|
||||
|
||||
public EclipseProject getRootProject() {
|
||||
EclipseProject root = this.gradleProject;
|
||||
while(root.getParent() != null) {
|
||||
root = root.getParent();
|
||||
}
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<Path> getClasspathEntries() throws Exception {
|
||||
return Stream.concat(gradleProject.getClasspath().stream().map(dep -> dep.getFile().toPath()),
|
||||
gradleProject.getProjectDependencies().stream().map(project -> new File(project.getPath()).toPath()));
|
||||
EclipseProject root = getRootProject();
|
||||
List<Path> classpathList = Stream.concat(gradleProject.getClasspath().stream().map(dep -> dep.getFile().toPath()),
|
||||
gradleProject.getProjectDependencies().stream()
|
||||
.map(d -> findPeer(root, d.getTargetProject().getName()))
|
||||
.filter(o -> o.isPresent())
|
||||
.map(o -> o.get())
|
||||
.map(p -> p.getProjectDirectory().toPath().resolve(p.getOutputLocation().getPath()))
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return classpathList.stream();
|
||||
}
|
||||
|
||||
|
||||
private Optional<? extends EclipseProject> findPeer(EclipseProject root, String name) {
|
||||
return root.getChildren().stream().filter(p -> p.getName().equals(name)).findFirst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> getClasspathResources() {
|
||||
return gradleProject.getSourceDirectories().stream().map(sourceDirectory -> sourceDirectory.getDirectory()).flatMap(folder -> {
|
||||
|
||||
Reference in New Issue
Block a user