Fix a bunch of auto-complete issues

This commit is contained in:
Christopher Schleiden
2023-01-19 10:17:43 -08:00
parent a7fd04c47d
commit e6a2e3eb43
10 changed files with 214 additions and 73 deletions
@@ -37,6 +37,10 @@ describe("expressions", () => {
expect(test("${{ github.| == 'test' }}")).toBe(" github.");
expect(test("test ${{ github.| == 'test' }}")).toBe(" github.");
expect(test("${{ vars }} ${{ gh |}}")).toBe(" gh ");
expect(test("${{ test.|")).toBe(" test.");
expect(test("${{ test.| }}")).toBe(" test.");
expect(test("${{ 1 == (test.|)")).toBe(" 1 == (test.");
});
describe("top-level auto-complete", () => {
@@ -58,6 +62,16 @@ describe("expressions", () => {
]);
});
it("within parentheses", async () => {
const result = await complete(
...getPositionFromCursor("run-name: ${{ 1 == (github.|) }}"),
undefined,
contextProviderConfig
);
expect(result.map(x => x.label)).toEqual(["event"]);
});
it("contains description", async () => {
const input = "run-name: ${{ github.| }}";
const result = await complete(...getPositionFromCursor(input), undefined, undefined);
@@ -202,6 +216,25 @@ jobs:
});
});
it("nested with parentheses", async () => {
const input = `on:
workflow_dispatch:
inputs:
test:
type: string
jobs:
build:
runs-on: ubuntu-latest
env:
foo: '{}'
steps:
- name: "\${{ fromJSON('test') == (inputs.|) }}"`;
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);
expect(result.map(x => x.label)).toEqual(["test"]);
});
it("nested auto-complete", async () => {
const input = "run-name: ${{ github.| }}";
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);