Adjustments for CodeLens for boot hints
This commit is contained in:
@@ -147,7 +147,7 @@ public class AutowiredHoverProvider implements HoverProvider {
|
||||
List<LiveBean> autowiredBeans) {
|
||||
hover.append("**Autowired `");
|
||||
hover.append(definedBean.getId());
|
||||
hover.append("` → ");
|
||||
hover.append("` ← ");
|
||||
if (LiveHoverUtils.doBeansFitInline(autowiredBeans, MAX_INLINE_BEANS_STRING_LENGTH - definedBean.getId().length(),
|
||||
INLINE_BEANS_STRING_SEPARATOR)) {
|
||||
hover.append(autowiredBeans.stream().map(b -> LiveHoverUtils.showBeanInline(server, project, b))
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
package org.springframework.ide.vscode.boot.java.handlers;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.core.dom.ASTNode;
|
||||
@@ -92,7 +92,7 @@ public class BootJavaHoverProvider implements HoverHandler {
|
||||
|
||||
public CodeLens[] getLiveHoverHints(final TextDocument document, final SpringBootApp[] runningBootApps) {
|
||||
return server.getCompilationUnitCache().withCompilationUnit(document, cu -> {
|
||||
Collection<CodeLens> result = new HashSet<>();
|
||||
Collection<CodeLens> result = new LinkedHashSet<>();
|
||||
try {
|
||||
if (cu != null) {
|
||||
cu.accept(new ASTVisitor() {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class AutowiredHoverProviderTest {
|
||||
|
||||
editor.assertHighlights("@Component", "@Inject");
|
||||
editor.assertTrimmedHover("@Inject",
|
||||
"**Autowired `autowiredClass` → `dependencyA`**\n" +
|
||||
"**Autowired `autowiredClass` ← `dependencyA`**\n" +
|
||||
"- Bean: `dependencyA` \n" +
|
||||
" Type: `com.example.DependencyA` \n" +
|
||||
" Resource: `" + Paths.get("com/example/DependencyA.class") + "`\n" +
|
||||
@@ -231,7 +231,7 @@ public class AutowiredHoverProviderTest {
|
||||
|
||||
editor.assertHighlights("@Component", "@Autowired");
|
||||
editor.assertTrimmedHover("@Autowired",
|
||||
"**Autowired `autowiredClass` → `dependencyA` `dependencyB`**\n" +
|
||||
"**Autowired `autowiredClass` ← `dependencyA` `dependencyB`**\n" +
|
||||
"- Bean: `dependencyA` \n" +
|
||||
" Type: `com.example.DependencyA` \n" +
|
||||
" Resource: `" + Paths.get("com/example/DependencyA.class") + "`\n" +
|
||||
@@ -382,11 +382,11 @@ public class AutowiredHoverProviderTest {
|
||||
Editor editor = harness.newEditor(LanguageId.JAVA, FOO_IMPL_CONTENTS);
|
||||
editor.assertHighlights("@Component", "@Autowired", "@Autowired");
|
||||
editor.assertHoverContains("@Autowired", 1,
|
||||
"**Autowired `defaultFoo` → `superBean`**\n" +
|
||||
"**Autowired `defaultFoo` ← `superBean`**\n" +
|
||||
"- Bean: `superBean` \n" +
|
||||
" Type: `com.example.FooImplementation`");
|
||||
editor.assertHoverContains("@Autowired", 2,
|
||||
"**Autowired `defaultFoo` → `scheduler`**\n" +
|
||||
"**Autowired `defaultFoo` ← `scheduler`**\n" +
|
||||
"- Bean: `scheduler` \n" +
|
||||
" Type: `org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler`");
|
||||
}
|
||||
@@ -436,7 +436,7 @@ public class AutowiredHoverProviderTest {
|
||||
);
|
||||
editor.assertHighlights("@Controller", "@Autowired");
|
||||
editor.assertHoverContains("@Autowired",
|
||||
"**Autowired `myController` → `restTemplate`**\n" +
|
||||
"**Autowired `myController` ← `restTemplate`**\n" +
|
||||
"- Bean: `restTemplate` \n" +
|
||||
" Type: `org.springframework.web.client.RestTemplate`"
|
||||
);
|
||||
@@ -493,7 +493,7 @@ public class AutowiredHoverProviderTest {
|
||||
editor.assertHighlights("@Component", "SomeComponent");
|
||||
|
||||
editor.assertTrimmedHover("SomeComponent", 2,
|
||||
"**Autowired `someComponent` → `dependencyA` `dependencyB`**\n" +
|
||||
"**Autowired `someComponent` ← `dependencyA` `dependencyB`**\n" +
|
||||
"- Bean: `dependencyA` \n" +
|
||||
" Type: `com.example.DependencyA`\n" +
|
||||
"- Bean: `dependencyB` \n" +
|
||||
@@ -644,7 +644,7 @@ public class AutowiredHoverProviderTest {
|
||||
|
||||
editor.assertHighlights("@Component", "@Autowired");
|
||||
editor.assertTrimmedHover("@Autowired", 1,
|
||||
"**Autowired `anotherComponent` → `anonymousBeanFactory`**\n" +
|
||||
"**Autowired `anotherComponent` ← `anonymousBeanFactory`**\n" +
|
||||
"- Bean: `anonymousBeanFactory` \n" +
|
||||
" Type: `com.example.SomeComponent$1`\n" +
|
||||
" \n" +
|
||||
|
||||
@@ -499,7 +499,7 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
editor.assertHighlights("@Component", "AutowiredClass");
|
||||
editor.assertTrimmedHover("@Component",
|
||||
"**Injected `autowiredClass` → _not injected anywhere_** \n" +
|
||||
"**Autowired `autowiredClass` → `dependencyA` `dependencyB`**\n" +
|
||||
"**Autowired `autowiredClass` ← `dependencyA` `dependencyB`**\n" +
|
||||
"- Bean: `dependencyA` \n" +
|
||||
" Type: `com.example.DependencyA` \n" +
|
||||
" Resource: `com/example/DependencyA.class`\n" +
|
||||
@@ -555,7 +555,7 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
editor.assertHighlights("@Component", "@Autowired");
|
||||
editor.assertTrimmedHover("@Component",
|
||||
"**Injected `autowiredClass` → _not injected anywhere_** \n" +
|
||||
"**Autowired `autowiredClass` → `dependencyA` `dependencyB`**\n" +
|
||||
"**Autowired `autowiredClass` ← `dependencyA` `dependencyB`**\n" +
|
||||
"- Bean: `dependencyA` \n" +
|
||||
" Type: `com.example.DependencyA`\n" +
|
||||
"- Bean: `dependencyB` \n" +
|
||||
|
||||
Reference in New Issue
Block a user