PT 152567032 - Use same process id/name as live beans hovers for
conditionals and request mappings live hovers.
This commit is contained in:
@@ -27,7 +27,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.boot.java.livehover.LiveHoverUtils;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.LiveConditional;
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
@@ -115,7 +115,7 @@ public class ConditionalsLiveHoverProvider implements HoverProvider {
|
||||
for (int i = 0; i < conditionals.size(); i++) {
|
||||
LiveConditional conditional = conditionals.get(i);
|
||||
hoverContent.add(Either.forLeft(conditional.getMessage()));
|
||||
hoverContent.add(Either.forLeft(HoverContentUtils.getProcessInformation(conditional.getProcessId(), conditional.getProcessName())));
|
||||
hoverContent.add(Either.forLeft(LiveHoverUtils.niceAppName(conditional.getProcessId(), conditional.getProcessName())));
|
||||
|
||||
if (i < conditionals.size() - 1) {
|
||||
hoverContent.add(Either.forLeft("---"));
|
||||
|
||||
@@ -28,7 +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.boot.java.livehover.LiveHoverUtils;
|
||||
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.java.IJavaProject;
|
||||
@@ -162,7 +162,7 @@ public class RequestMappingHoverProvider implements HoverProvider {
|
||||
renderableUrls.remove(renderableUrls.size() - 1);
|
||||
|
||||
hoverContent.add(Either.forLeft(Renderables.concat(renderableUrls).toMarkdown()));
|
||||
hoverContent.add(Either.forLeft(HoverContentUtils.getProcessInformation(app)));
|
||||
hoverContent.add(Either.forLeft(LiveHoverUtils.niceAppName(app)));
|
||||
if (i < mappingMethods.size() - 1) {
|
||||
// Three dashes == line separator in Markdown
|
||||
hoverContent.add(Either.forLeft("---"));
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 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.utils;
|
||||
|
||||
import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp;
|
||||
|
||||
public class HoverContentUtils {
|
||||
|
||||
public static String getProcessInformation(SpringBootApp app) {
|
||||
return getProcessInformation(app.getProcessID(), app.getProcessName());
|
||||
}
|
||||
|
||||
public static String getProcessInformation(String processId, String processName) {
|
||||
return "Process " + processId + ": " + processName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class ConditionalsLiveHoverTest {
|
||||
editor.assertHoverContains("@ConditionalOnBean",
|
||||
"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found bean 'missing'\n" +
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -102,7 +102,7 @@ public class ConditionalsLiveHoverTest {
|
||||
Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA);
|
||||
editor.assertHoverContains("@ConditionalOnMissingBean", "@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\n"+
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -126,24 +126,24 @@ public class ConditionalsLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@ConditionalOnBean", "@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found beans 'hi', 'missing'\n" +
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverContains("@ConditionalOnWebApplication", "@ConditionalOnWebApplication (required) found StandardServletEnvironment\n"+
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverContains("@ConditionalOnJava(value=ConditionalOnJava.JavaVersion.EIGHT)",
|
||||
"@ConditionalOnJava (1.8 or newer) found 1.8\n" +
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverContains("@ConditionalOnMissingClass", "@ConditionalOnClass found required class; @ConditionalOnMissingClass did not find unwanted class\n" +
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverContains("@ConditionalOnExpression", "@ConditionalOnExpression (#{true}) resulted in true\n" +
|
||||
"\n" +
|
||||
"Process 22022: test-conditionals-live-hover");
|
||||
"Process [PID=22022, name=`test-conditionals-live-hover`]");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -181,19 +181,19 @@ public class ConditionalsLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@ConditionalOnMissingBean", "@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\n" +
|
||||
"\n" +
|
||||
"Process 70000: test-conditionals-live-hover\n" +
|
||||
"Process [PID=70000, name=`test-conditionals-live-hover`]\n" +
|
||||
"\n" +
|
||||
"---\n" +
|
||||
"\n" +
|
||||
"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\n" +
|
||||
"\n" +
|
||||
"Process 80000: test-conditionals-live-hover\n" +
|
||||
"Process [PID=80000, name=`test-conditionals-live-hover`]\n" +
|
||||
"\n" +
|
||||
"---\n" +
|
||||
"\n" +
|
||||
"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\n" +
|
||||
"\n" +
|
||||
"Process 90000: test-conditionals-live-hover");
|
||||
"Process [PID=90000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -231,21 +231,21 @@ public class ConditionalsLiveHoverTest {
|
||||
// hovering over only one of the conditional annotations
|
||||
editor.assertHoverExactText("@ConditionalOnBean",
|
||||
"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found beans 'hi', 'missing'\n" + "\n"
|
||||
+ "Process 70000: test-conditionals-live-hover");
|
||||
+ "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverExactText("@ConditionalOnWebApplication",
|
||||
"@ConditionalOnWebApplication (required) found StandardServletEnvironment\n" + "\n"
|
||||
+ "Process 70000: test-conditionals-live-hover");
|
||||
+ "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverExactText("@ConditionalOnJava(value=ConditionalOnJava.JavaVersion.EIGHT)",
|
||||
"@ConditionalOnJava (1.8 or newer) found 1.8\n" + "\n" + "Process 70000: test-conditionals-live-hover");
|
||||
"@ConditionalOnJava (1.8 or newer) found 1.8\n" + "\n" + "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverExactText("@ConditionalOnMissingClass",
|
||||
"@ConditionalOnClass found required class; @ConditionalOnMissingClass did not find unwanted class\n"
|
||||
+ "\n" + "Process 70000: test-conditionals-live-hover");
|
||||
+ "\n" + "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverExactText("@ConditionalOnExpression", "@ConditionalOnExpression (#{true}) resulted in true\n"
|
||||
+ "\n" + "Process 70000: test-conditionals-live-hover");
|
||||
+ "\n" + "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -274,10 +274,10 @@ public class ConditionalsLiveHoverTest {
|
||||
|
||||
editor.assertHoverExactText("@ConditionalOnWebApplication",
|
||||
"@ConditionalOnWebApplication (required) found StandardServletEnvironment\n" + "\n"
|
||||
+ "Process 70000: test-conditionals-live-hover");
|
||||
+ "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
editor.assertHoverExactText("@ConditionalOnJava(value=ConditionalOnJava.JavaVersion.EIGHT)",
|
||||
"@ConditionalOnJava (1.8 or newer) found 1.8\n" + "\n" + "Process 70000: test-conditionals-live-hover");
|
||||
"@ConditionalOnJava (1.8 or newer) found 1.8\n" + "\n" + "Process [PID=70000, name=`test-conditionals-live-hover`]");
|
||||
|
||||
// Test that the hovers dont have extra information of the other conditionals:
|
||||
Hover hover = editor.getHover("@ConditionalOnWebApplication");
|
||||
|
||||
@@ -64,7 +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 22022: test-request-mapping-live-hover");
|
||||
"Process [PID=22022, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -94,11 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
editor.assertHoverContains("@RequestMapping(\"/goodbye\")", "[http://cfapps.io:999/goodbye](http://cfapps.io:999/goodbye)\n" +
|
||||
"\n" +
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class RequestMappingLiveHoverTest {
|
||||
|
||||
editor.assertHoverContains("@DeleteMapping(\"/greetings\")", "[http://cfapps.io:999/greetings](http://cfapps.io:999/greetings)\n" +
|
||||
"\n" +
|
||||
"Process 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -305,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -355,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -405,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -456,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -507,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -556,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -605,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -654,7 +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 76543: test-request-mapping-live-hover");
|
||||
"Process [PID=76543, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
@@ -706,19 +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 70000: test-request-mapping-live-hover\n" +
|
||||
"Process [PID=70000, name=`test-request-mapping-live-hover`]\n" +
|
||||
"\n" +
|
||||
"---\n" +
|
||||
"\n" +
|
||||
"[http://cfapps.io:1001/hello](http://cfapps.io:1001/hello)\n" +
|
||||
"\n" +
|
||||
"Process 80000: test-request-mapping-live-hover\n" +
|
||||
"Process [PID=80000, name=`test-request-mapping-live-hover`]\n" +
|
||||
"\n" +
|
||||
"---\n" +
|
||||
"\n" +
|
||||
"[http://cfapps.io:1002/hello](http://cfapps.io:1002/hello)\n" +
|
||||
"\n" +
|
||||
"Process 90000: test-request-mapping-live-hover");
|
||||
"Process [PID=90000, name=`test-request-mapping-live-hover`]");
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user