Hover info provider for tasks wired-up properly
Note: still need to add the markdown blobs for most properties however. So you still won't see much info in the hovers.
This commit is contained in:
@@ -112,7 +112,17 @@ public class ConcourseLanguageServer extends SimpleLanguageServer {
|
||||
throw new IllegalStateException("Not implemented");
|
||||
|
||||
});
|
||||
documents.onHover(forPipelines.hoverEngine::getHover); //TODO: dispatch based on language id
|
||||
documents.onHover(params -> {
|
||||
TextDocument doc = documents.get(params);
|
||||
if (doc!=null) {
|
||||
if (LanguageIds.CONCOURSE_PIPELINE.equals(doc.getLanguageId())) {
|
||||
return forPipelines.hoverEngine.getHover(params);
|
||||
} else if (LanguageIds.CONCOURSE_TASK.equals(doc.getLanguageId())) {
|
||||
return forTasks.hoverEngine.getHover(params);
|
||||
}
|
||||
}
|
||||
return SimpleTextDocumentService.NO_HOVER;
|
||||
});
|
||||
documents.onDefinition(definitionFinder);
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,8 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
}
|
||||
}
|
||||
|
||||
YType t_platform = f.yenum("Platform", "windows", "linux", "darwin");
|
||||
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),
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
*Required.* The platform the task should run on. By convention, `windows`,
|
||||
`linux`, or `darwin` are specified. This determines the pool of workers
|
||||
that the task can run against. The base deployment provides Linux workers.
|
||||
@@ -1480,7 +1480,6 @@ public class ConcourseEditorTest {
|
||||
"params: the-params\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"a-platform|unknown 'Platform'",
|
||||
"name|Unknown property",
|
||||
"bogus-source-prop|Unknown property",
|
||||
"path: path/to/input|'name' is required",
|
||||
@@ -1512,8 +1511,35 @@ public class ConcourseEditorTest {
|
||||
"run:\n" +
|
||||
" <*>"
|
||||
);
|
||||
|
||||
assertTaskCompletions(
|
||||
"platform: <*>"
|
||||
, //=>
|
||||
"platform: darwin<*>",
|
||||
"platform: linux<*>",
|
||||
"platform: windows<*>"
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void hoversForTaskFileToplevelProperties() throws Exception {
|
||||
Editor editor = harness.newEditor(LanguageIds.CONCOURSE_TASK,
|
||||
"image: some-image\n" +
|
||||
"image_resource:\n" +
|
||||
" type: docker-image\n" +
|
||||
" source:\n" +
|
||||
" repository: kdvolder/sts4-build-env\n" +
|
||||
"inputs: []\n" +
|
||||
"outputs: []\n" +
|
||||
"params: {}\n" +
|
||||
"platform: linux\n" +
|
||||
"run:\n" +
|
||||
" path: sts4/concourse/tasks/build-vscode-extensions.sh"
|
||||
);
|
||||
|
||||
editor.assertHoverContains("platform", "The platform the task should run on");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void assertContextualCompletions(String conText, String textBefore, String... textAfter) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user