Skip to content

Commit 8264535

Browse files
committed
fix(yaml): remove square brackets from array completions
Fixes jsonnext#152
1 parent 806504f commit 8264535

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/features/__tests__/json-completion.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,14 +742,14 @@ describe.each([
742742
detail: "array",
743743
info: "",
744744
label: "arrayOfObjects",
745-
template: "arrayOfObjects: [#{}]",
745+
template: "arrayOfObjects: #{}",
746746
},
747747
{
748748
type: "property",
749749
detail: "array",
750750
info: "",
751751
label: "arrayOfOneOf",
752-
template: "arrayOfOneOf: [#{}]",
752+
template: "arrayOfOneOf: #{}",
753753
},
754754
],
755755
},

src/features/completion.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,17 @@ export class JSONCompletion {
506506
}
507507
break;
508508
case "array":
509-
value = "[#{}]";
509+
switch (this.mode) {
510+
case MODES.JSON5:
511+
value = "[#{}]";
512+
break;
513+
case MODES.YAML:
514+
value = "#{}";
515+
break;
516+
default:
517+
value = "[#{}]";
518+
break;
519+
}
510520
break;
511521
case "number":
512522
case "integer":

0 commit comments

Comments
 (0)