Auto completion for multi-line expressions

This commit is contained in:
Christopher Schleiden
2022-12-09 08:38:50 -08:00
parent 1af3f0b672
commit efe71dd684
3 changed files with 86 additions and 8 deletions
@@ -88,6 +88,64 @@ describe("expressions", () => {
]);
});
describe("multi-line strings", () => {
it("indented |", async () => {
const input = `on: push
jobs:
build:
steps:
- run: |
first line
test \${{ github.| }}
test2`;
const result = await complete(...getPositionFromCursor(input, 1), undefined, contextProviderConfig);
expect(result.map(x => x.label)).toEqual(["event"]);
});
it("indented |+", async () => {
const input = `on: push
jobs:
build:
steps:
- run: |+
first line
test \${{ github.| }}
test2`;
const result = await complete(...getPositionFromCursor(input, 1), undefined, contextProviderConfig);
expect(result.map(x => x.label)).toEqual(["event"]);
});
it("indented >", async () => {
const input = `on: push
jobs:
build:
steps:
- run: >
first line
test \${{ github.| }}
test2`;
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);
expect(result.map(x => x.label)).toEqual(["event"]);
});
it("indented >+", async () => {
const input = `on: push
jobs:
build:
steps:
- run: >+
first line
test \${{ github.| }}
test2`;
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);
expect(result.map(x => x.label)).toEqual(["event"]);
});
});
it("nested auto-complete", async () => {
const input = "run-name: ${{ github.| }}";
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);