Skip to content

Commit

Permalink
include required mark for parameters that doesn't have a default va…
Browse files Browse the repository at this point in the history
…lue (#12749)

Fixes #12039 

Adding `(Required)` text to the parameter title when the parameter
doesn't have a default value;

Screenshot of a `.bicepparam` file with a `(Required)` parameter shown;

![image](https://github.com/Azure/bicep/assets/118744/4f0087ef-fe90-41ea-8890-c415429e22df)

Screenshot of a `.bicepparam` file with a `not` `(Required)` parameter
shown;

![image](https://github.com/Azure/bicep/assets/118744/41377372-898e-4f22-a615-2a6a37e3ac89)

> Just like submodule parameters in `.bicep` files has `(Required)` text
if they don't have a default value;

Screenshot of a sample `.bicep` file;

![image](https://github.com/Azure/bicep/assets/118744/2d12576c-db36-4508-8f2b-b8505fef435e)

###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/12749)
  • Loading branch information
polatengin committed Dec 14, 2023
1 parent 528df32 commit e1e66df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Bicep.LangServer/Completions/BicepCompletionProvider.cs
Expand Up @@ -111,7 +111,7 @@ private IEnumerable<CompletionItem> GetParamIdentifierCompletions(SemanticModel
.WithDocumentation(
MarkdownHelper.AppendNewline($"Type: `{metadata.TypeReference.Type}`") +
MarkdownHelper.AppendNewline(metadata.Description))
.WithDetail(metadata.Name)
.WithDetail(!metadata.IsRequired ? metadata.Name : $"{metadata.Name} (Required)")
.WithPlainTextEdit(paramsCompletionContext.ReplacementRange, metadata.Name)
.Build();
}
Expand Down Expand Up @@ -2147,7 +2147,7 @@ private static string FormatPropertyDocumentation(TypeProperty property)

var documentation = DescriptionHelper.TryGetFromDecorator(model, decorableSyntax);
buffer.Append(MarkdownHelper.AppendNewline(documentation));

return buffer.ToString();
}

Expand Down

0 comments on commit e1e66df

Please sign in to comment.