Add support for CTRL-click nav to property sources
... in application.yml See: https://www.pivotaltracker.com/story/show/169240253
This commit is contained in:
@@ -46,7 +46,7 @@ public class PropertyIndexHarness {
|
||||
|
||||
protected final SpringPropertyIndexProvider indexProvider = new SpringPropertyIndexProvider() {
|
||||
@Override
|
||||
public FuzzyMap<PropertyInfo> getIndex(IDocument doc) {
|
||||
public SpringPropertyIndex getIndex(IDocument doc) {
|
||||
synchronized (PropertyIndexHarness.this) {
|
||||
if (index==null) {
|
||||
IClasspath classpath = testProject == null ? null : testProject.getClasspath();
|
||||
|
||||
@@ -125,7 +125,7 @@ public class IndexNavigatorTest {
|
||||
* Reset navigation state to point at the root of the index.
|
||||
*/
|
||||
public void start(PropertyIndexHarness harness) {
|
||||
navigator = IndexNavigator.with(harness.getIndexProvider().getIndex(null));
|
||||
navigator = IndexNavigator.with(harness.getIndexProvider().getIndex(null).getProperties());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PropertiesIndexTest {
|
||||
SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(
|
||||
new ValueProviderRegistry(), null, null);
|
||||
IJavaProject mavenProject = projects.mavenProject(CUSTOM_PROPERTIES_PROJECT);
|
||||
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService);
|
||||
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService).getProperties();
|
||||
PropertyInfo propertyInfo = index.get("server.port");
|
||||
assertNotNull(propertyInfo);
|
||||
assertEquals(Integer.class.getName(), propertyInfo.getType());
|
||||
@@ -50,7 +50,7 @@ public class PropertiesIndexTest {
|
||||
SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(
|
||||
new ValueProviderRegistry(), null, null);
|
||||
IJavaProject mavenProject = projects.mavenProject(CUSTOM_PROPERTIES_PROJECT);
|
||||
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService);
|
||||
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService).getProperties();
|
||||
PropertyInfo propertyInfo = index.get("demo.settings.user");
|
||||
assertNotNull(propertyInfo);
|
||||
assertEquals(String.class.getName(), propertyInfo.getType());
|
||||
@@ -62,7 +62,7 @@ public class PropertiesIndexTest {
|
||||
SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(
|
||||
new ValueProviderRegistry(), null, null);
|
||||
IJavaProject mavenProject = projects.mavenProject(CUSTOM_PROPERTIES_PROJECT);
|
||||
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService);
|
||||
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService).getProperties();
|
||||
PropertyInfo propertyInfo = index.get("my.server.port");
|
||||
assertNull(propertyInfo);
|
||||
}
|
||||
|
||||
@@ -1859,8 +1859,10 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
editor = newEditor(
|
||||
"my.screen.background=green"
|
||||
);
|
||||
definitionLinkAsserts.assertLinkTargets(editor, "background", project, editor.rangeOf("my.screen.background", "my.screen.background"), method("com.example.demo.MyProperties$Screen", "getScreen"));
|
||||
definitionLinkAsserts.assertLinkTargets(editor, "green", project, editor.rangeOf("green", "green"), field("com.example.demo.Color", "GREEN"));
|
||||
definitionLinkAsserts.assertLinkTargets(editor, "background", project, editor.rangeOf("my.screen.background"),
|
||||
method("com.example.demo.MyProperties$Screen", "setBackground", "com.example.demo.Color")
|
||||
);
|
||||
definitionLinkAsserts.assertLinkTargets(editor, "green", project, editor.rangeOf("green"), field("com.example.demo.Color", "GREEN"));
|
||||
}
|
||||
|
||||
@Test public void testNoHoverForUnrecognizedProperty() throws Exception {
|
||||
|
||||
@@ -3849,7 +3849,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void definitionLinks_bug_169240253() throws Exception {
|
||||
@Test public void definitionLinks_bug_169240253_nested() throws Exception {
|
||||
MavenJavaProject p = createPredefinedMavenProject("boot-web-actuator-2.2.0");
|
||||
//See: https://www.pivotaltracker.com/story/show/169240253
|
||||
useProject(p );
|
||||
@@ -3874,6 +3874,26 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void definitionLinks_bug_169240253_parent() throws Exception {
|
||||
MavenJavaProject p = createPredefinedMavenProject("boot-web-actuator-2.2.0");
|
||||
//See: https://www.pivotaltracker.com/story/show/169240253
|
||||
useProject(p );
|
||||
Editor editor = newEditor(
|
||||
"management:\n" +
|
||||
" endpoints:\n" +
|
||||
" web:\n" +
|
||||
" exposure:\n" +
|
||||
" exclude: '*'\n" +
|
||||
"spring:\n" +
|
||||
" messages:\n" +
|
||||
" basename: messages/messages\n"
|
||||
);
|
||||
//org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties.getExposure()
|
||||
definitionLinkAsserts.assertLinkTargets(editor, "exposure", p, editor.rangeOf("exposure"),
|
||||
method("org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties", "getExposure")
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void testClassReferenceInValueLink() throws Exception {
|
||||
Editor editor;
|
||||
MavenJavaProject project = createPredefinedMavenProject("empty-boot-1.3.0-with-mongo");
|
||||
@@ -3992,7 +4012,7 @@ public class ApplicationYamlEditorTest extends AbstractPropsEditorTest {
|
||||
useProject(createPredefinedMavenProject("boot-1.3.3-app-with-resource-prop"));
|
||||
|
||||
//Check the metadata reflects the 'handle-as':
|
||||
PropertyInfo metadata = getIndexProvider().getIndex(null).get("my.welcome.path");
|
||||
PropertyInfo metadata = getIndexProvider().getIndex(null).getProperties().get("my.welcome.path");
|
||||
assertEquals("org.springframework.core.io.Resource", metadata.getType());
|
||||
|
||||
//Check the content assist based on it works too:
|
||||
|
||||
Reference in New Issue
Block a user