diff --git a/vscode-extensions/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/hover/YamlHoverInfoProvider.java b/vscode-extensions/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/hover/YamlHoverInfoProvider.java index 40c56d3d6..a310750cb 100644 --- a/vscode-extensions/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/hover/YamlHoverInfoProvider.java +++ b/vscode-extensions/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/hover/YamlHoverInfoProvider.java @@ -82,12 +82,14 @@ public class YamlHoverInfoProvider implements HoverInfoProvider { } assistContext = assistPath.traverse(assistContext); if (assistContext != null) { - if (path.pointsAtValue()) { - Renderable info = assistContext.getValueHoverInfo(ymlDoc, new DocumentRegion(doc, region)); + Renderable info = path.pointsAtValue() + ? assistContext.getValueHoverInfo(ymlDoc, new DocumentRegion(doc, region)) + : assistContext.getHoverInfo(); + + // Fix for: PT 134914895. If assist context cannot provide an info, then don't return a Tuple. + if (info != null) { return Tuples.of(info, region); } - Renderable info = assistContext.getHoverInfo(); - return Tuples.of(info, region); } } } diff --git a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java index de4327652..726a99272 100644 --- a/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java +++ b/vscode-extensions/vscode-manifest-yaml/src/test/java/org/springframework/ide/vscode/manifest/yaml/ManifestYamlEditorTest.java @@ -408,7 +408,6 @@ public class ManifestYamlEditorTest { " timeout: 80\n" + " health-check-type: none\n" ); - editor.assertNoHover("comment"); editor.assertIsHoverRegion("memory"); editor.assertIsHoverRegion("inherit"); @@ -454,6 +453,26 @@ public class ManifestYamlEditorTest { editor.assertHoverContains("timeout", "The `timeout` attribute defines the number of seconds Cloud Foundry allocates for starting your application"); editor.assertHoverContains("health-check-type", "Use the `health-check-type` attribute to"); } + + @Test + public void noHoverInfos() throws Exception { + Editor editor = harness.newEditor( + "#comment\n" + + "applications:\n" + + "- buildpack: zbuildpack\n" + + " name: foo\n" + + " domains:\n" + + " - pivotal.io\n" + + " - otherdomain.org\n" + + ); + editor.assertNoHover("comment"); + + // May fail in the future if hover support is added, but if hover support is added in the future, + // it is expected that these should start to fail, as right now they have no hover + editor.assertNoHover("pivotal.io"); + editor.assertNoHover("otherdomain.org"); + } //////////////////////////////////////////////////////////////////////////////