Support allowed/suggested value providers

This commit is contained in:
Christopher Schleiden
2022-11-28 16:15:57 -08:00
parent 71619bee95
commit a9cdcdba80
8 changed files with 98 additions and 46 deletions
+6 -3
View File
@@ -1,7 +1,7 @@
import {complete} from "./complete";
import {WorkflowContext} from "./context/workflow-context";
import {getPositionFromCursor} from "./test-utils/cursor-position";
import {ValueProviderConfig} from "./value-providers/config";
import {ValueProviderConfig, ValueProviderKind} from "./value-providers/config";
describe("completion", () => {
it("runs-on", async () => {
@@ -180,8 +180,11 @@ jobs:
const input = "on: push\njobs:\n build:\n runs-on: |";
const config: ValueProviderConfig = {
"runs-on": async (_: WorkflowContext) => {
return [{label: "my-custom-label"}];
"runs-on": {
kind: ValueProviderKind.SuggestedValues,
get: async (_: WorkflowContext) => {
return [{label: "my-custom-label"}];
}
}
};
const result = await complete(...getPositionFromCursor(input), config);