From 074dbdc0b70aef07e3172e7b713cd73c84a2fed1 Mon Sep 17 00:00:00 2001 From: Kris De Volder Date: Fri, 27 Jan 2017 09:06:10 -0800 Subject: [PATCH] Hover infos for 'name' and 'path' attributes in inputs/outputs of a task.yml --- .../ide/vscode/concourse/PipelineYmlSchema.java | 15 +++++++++------ .../src/main/resources/desc/TaskConfig/inputs.md | 10 ---------- .../main/resources/desc/TaskConfig/outputs.md | 12 ------------ .../src/main/resources/desc/TaskInput/name.md | 1 + .../src/main/resources/desc/TaskInput/path.md | 1 + .../src/main/resources/desc/TaskOutput/name.md | 1 + .../src/main/resources/desc/TaskOutput/path.md | 4 ++++ .../vscode/concourse/ConcourseEditorTest.java | 16 ++++++++++++++++ 8 files changed, 32 insertions(+), 28 deletions(-) create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/name.md create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/path.md create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/name.md create mode 100644 vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/path.md diff --git a/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java b/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java index cc7ced11a..efbe059c6 100644 --- a/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java +++ b/vscode-extensions/vscode-concourse/src/main/java/org/springframework/ide/vscode/concourse/PipelineYmlSchema.java @@ -168,10 +168,13 @@ public class PipelineYmlSchema implements YamlSchema { YAtomicType t_platform = f.yenum("Platform", "windows", "linux", "darwin"); t_platform.parseWith(ValueParsers.NE_STRING); //no errors because in theory platform are just strings. - YType t_name_and_path = f.ybean("NameAndPath" , - f.yprop("name", t_ne_string).isRequired(true), - f.yprop("path", t_ne_string) - ); + YBeanType t_input = f.ybean("TaskInput"); + addProp(t_input, "name", t_ne_string).isRequired(true); + addProp(t_input, "path", t_ne_string); + + YBeanType t_output = f.ybean("TaskOutput"); + addProp(t_output, "name", t_ne_string).isRequired(true); + addProp(t_output, "path", t_ne_string); YBeanType t_command = f.ybean("Command"); addProp(t_command, "path", t_ne_string).isRequired(true); @@ -183,8 +186,8 @@ public class PipelineYmlSchema implements YamlSchema { addProp(task, "platform", t_platform).isRequired(true); addProp(task, "image_resource", t_image_resource); addProp(task, "image", t_ne_string); - addProp(task, "inputs", f.yseq(t_name_and_path)).isRequired(true); - addProp(task, "outputs", f.yseq(t_name_and_path)); + addProp(task, "inputs", f.yseq(t_input)).isRequired(true); + addProp(task, "outputs", f.yseq(t_output)); addProp(task, "run", t_command).isRequired(true); addProp(task, "params", t_string_params); diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/inputs.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/inputs.md index e544daee7..94b55bbae 100644 --- a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/inputs.md +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/inputs.md @@ -1,13 +1,3 @@ *Required.* The expected set of inputs for the task. This determines which artifacts will propagate into the task, as the [build plan](https://concourse.ci/build-plans.html) executes. If any specified inputs are not present, the task will end with an error, without running. - -Each input has the following attributes: - - name: string - -Required. The logical name of the input. - - path: string - -Optional. The path where the input will be placed. If not specified, the input's name is used. \ No newline at end of file diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/outputs.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/outputs.md index f6f296329..0d7bee54e 100644 --- a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/outputs.md +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskConfig/outputs.md @@ -2,18 +2,6 @@ Each output configures a directory to make available to later steps in the [build plan](https://concourse.ci/build-plans.html). The directory will be automatically created before the task runs, and the task should place any artifacts it wants to export in the directory. -Each output has the following attributes: - - name: string - -*Required.* The logical name of the output. The contents under `path` will be made available to the rest of the plan under this name. - - path: string - -*Optional.* The path to a directory where the output will be taken from. If not specified, the output's `name` is used. - -Note that this value must not overlap with any other inputs or outputs. Each output results in a new empty directory that your task should place artifacts in; if the path overlaps it'll clobber whatever files used to be there. - For example, the following task and script would be used to propagate a built binary to later steps: --- diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/name.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/name.md new file mode 100644 index 000000000..41ef05673 --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/name.md @@ -0,0 +1 @@ +*Required.* The logical name of the input. diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/path.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/path.md new file mode 100644 index 000000000..c6a4d1486 --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskInput/path.md @@ -0,0 +1 @@ +*Optional.* The path where the input will be placed. If not specified, the input's name is used. \ No newline at end of file diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/name.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/name.md new file mode 100644 index 000000000..654fe6ff0 --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/name.md @@ -0,0 +1 @@ +*Required.* The logical name of the output. The contents under `path` will be made available to the rest of the plan under this name. diff --git a/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/path.md b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/path.md new file mode 100644 index 000000000..7d2d72973 --- /dev/null +++ b/vscode-extensions/vscode-concourse/src/main/resources/desc/TaskOutput/path.md @@ -0,0 +1,4 @@ +*Optional.* The path to a directory where the output will be taken from. If not specified, the output's `name` is used. + +Note that this value must not overlap with any other inputs or outputs. Each output results in a new empty directory that your task should place artifacts in; if the path overlaps it'll clobber whatever files used to be there. + diff --git a/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java b/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java index 14fe089df..6e300836d 100644 --- a/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java +++ b/vscode-extensions/vscode-concourse/src/test/java/org/springframework/ide/vscode/concourse/ConcourseEditorTest.java @@ -1543,6 +1543,7 @@ public class ConcourseEditorTest { editor.assertHoverContains("outputs", "The artifacts produced by the task"); editor.assertHoverContains("run", "Note that this is *not* provided as a script blob"); editor.assertHoverContains("params", "A key-value mapping of values that are exposed to the task via environment variables"); + editor.assertHoverContains("repository", "The name of the repository"); editor.assertHoverContains("platform", "The platform the task should run on"); } @@ -1626,6 +1627,21 @@ public class ConcourseEditorTest { editor.assertProblems("user: admin|'path' is required"); } + @Test public void nameAndPathHoversInTaskInputsAndOutputs() throws Exception { + Editor editor = harness.newEditor(LanguageIds.CONCOURSE_TASK, + "inputs:\n" + + "- name: sts4\n" + + " path: botk\n" + + "outputs:\n" + + "- name: vsix-files\n" + + " path: zaza" + ); + editor.assertHoverContains("name", 1, "The logical name of the input"); + editor.assertHoverContains("name", 2, "The logical name of the output"); + editor.assertHoverContains("path", 1, "The path where the input will be placed"); + editor.assertHoverContains("path", 2, "The path to a directory where the output will be taken from"); + } + ////////////////////////////////////////////////////////////////////////////// private void assertContextualCompletions(String conText, String textBefore, String... textAfter) throws Exception {