Skip to content

Commit

Permalink
Expanding Completion of objects & arrays to multiple lines (#1012)
Browse files Browse the repository at this point in the history
Fixes #792
  • Loading branch information
miqm authored Nov 26, 2020
1 parent f2f9111 commit c02b8c4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Bicep.Core.Samples/Files/Completions/object.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"preselect": true,
"sortText": "1_{}",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"insertTextMode": "adjustIndentation",
"textEdit": {
"range": {},
"newText": "{$0}"
"newText": "{\n\t$0\n}"
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"preselect": true,
"sortText": "1_[]",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"insertTextMode": "adjustIndentation",
"textEdit": {
"range": {},
"newText": "[$0]"
"newText": "[\n\t$0\n]"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1477,10 +1477,10 @@
"preselect": true,
"sortText": "1_{}",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"insertTextMode": "adjustIndentation",
"textEdit": {
"range": {},
"newText": "{$0}"
"newText": "{\n\t$0\n}"
}
}
]
4 changes: 2 additions & 2 deletions src/Bicep.LangServer/Completions/BicepCompletionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private static IEnumerable<CompletionItem> GetValueCompletionsForType(TypeSymbol
const string arrayLabel = "[]";
yield return CompletionItemBuilder.Create(CompletionItemKind.Value)
.WithLabel(arrayLabel)
.WithSnippetEdit(replacementRange, "[$0]")
.WithSnippetEdit(replacementRange, "[\n\t$0\n]", InsertTextMode.AdjustIndentation)
.WithDetail(arrayLabel)
.Preselect()
.WithSortText(GetSortText(arrayLabel, CompletionPriority.High));
Expand Down Expand Up @@ -423,7 +423,7 @@ private static CompletionItem CreateObjectBodyCompletion(Range replacementRange)
const string objectLabel = "{}";
return CompletionItemBuilder.Create(CompletionItemKind.Value)
.WithLabel(objectLabel)
.WithSnippetEdit(replacementRange, "{$0}")
.WithSnippetEdit(replacementRange, "{\n\t$0\n}", InsertTextMode.AdjustIndentation)
.WithDetail(objectLabel)
.Preselect()
.WithSortText(GetSortText(objectLabel, CompletionPriority.High));
Expand Down

0 comments on commit c02b8c4

Please sign in to comment.