Skip to content

Commit

Permalink
Set completion priority of resource snippets to high (Azure#2076)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsubra authored Mar 31, 2021
1 parent 17e8590 commit 418276b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/Bicep.Core.Samples/Files/Completions/declarations.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
"detail": "Resource keyword",
"deprecated": false,
"preselect": false,
"sortText": "2_resource",
"sortText": "1_resource",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
Expand All @@ -371,7 +371,7 @@
},
"deprecated": false,
"preselect": false,
"sortText": "2_resource",
"sortText": "1_resource",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"textEdit": {
Expand All @@ -389,7 +389,7 @@
},
"deprecated": false,
"preselect": false,
"sortText": "2_resource",
"sortText": "1_resource",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"textEdit": {
Expand All @@ -407,7 +407,7 @@
},
"deprecated": false,
"preselect": false,
"sortText": "2_resource",
"sortText": "1_resource",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"textEdit": {
Expand All @@ -425,7 +425,7 @@
},
"deprecated": false,
"preselect": false,
"sortText": "2_resource",
"sortText": "1_resource",
"insertTextFormat": "snippet",
"insertTextMode": "asIs",
"textEdit": {
Expand Down
10 changes: 5 additions & 5 deletions src/Bicep.LangServer/Completions/BicepCompletionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,29 @@ private IEnumerable<CompletionItem> GetDeclarationCompletions(BicepCompletionCon
yield return CreateKeywordCompletion(LanguageConstants.VariableKeyword, "Variable keyword", context.ReplacementRange);
yield return CreateContextualSnippetCompletion(LanguageConstants.VariableKeyword, "Variable declaration", "var ${1:Identifier} = $0", context.ReplacementRange);

yield return CreateKeywordCompletion(LanguageConstants.ResourceKeyword, "Resource keyword", context.ReplacementRange);
yield return CreateKeywordCompletion(LanguageConstants.ResourceKeyword, "Resource keyword", context.ReplacementRange, priority: CompletionPriority.High);
yield return CreateContextualSnippetCompletion(LanguageConstants.ResourceKeyword, "Resource with defaults", @"resource ${1:Identifier} 'Microsoft.${2:Provider}/${3:Type}@${4:Version}' = {
name: $5
location: $6
properties: {
$0
}
}", context.ReplacementRange);
}", context.ReplacementRange, priority: CompletionPriority.High);
yield return CreateContextualSnippetCompletion(LanguageConstants.ResourceKeyword, "Child Resource with defaults", @"resource ${1:Identifier} 'Microsoft.${2:Provider}/${3:ParentType}/${4:ChildType}@${5:Version}' = {
name: $6
properties: {
$0
}
}", context.ReplacementRange);
}", context.ReplacementRange, priority: CompletionPriority.High);
yield return CreateContextualSnippetCompletion(LanguageConstants.ResourceKeyword, "Resource without defaults", @"resource ${1:Identifier} 'Microsoft.${2:Provider}/${3:Type}@${4:Version}' = {
name: $5
$0
}
", context.ReplacementRange);
", context.ReplacementRange, priority: CompletionPriority.High);
yield return CreateContextualSnippetCompletion(LanguageConstants.ResourceKeyword, "Child Resource without defaults", @"resource ${1:Identifier} 'Microsoft.${2:Provider}/${3:ParentType}/${4:ChildType}@${5:Version}' = {
name: $6
$0
}", context.ReplacementRange);
}", context.ReplacementRange, priority: CompletionPriority.High);

yield return CreateKeywordCompletion(LanguageConstants.OutputKeyword, "Output keyword", context.ReplacementRange);
yield return CreateContextualSnippetCompletion(LanguageConstants.OutputKeyword, "Output declaration", "output ${1:Identifier} ${2:Type} = $0", context.ReplacementRange);
Expand Down

0 comments on commit 418276b

Please sign in to comment.