Azure / Azure/bicep

Improve error when parameter name & type are given the wrong way around

Open
#5,933 0 comments 0 reactions 0 assignees View on GitHub
enhancement error-message
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
Coming from a C# background, I constantly find myself writing the following

```bicep
param string foo
```

**Describe the solution you'd like**
It would be really nice if bicep could detect these scenarios where the type and value are the wrong way around. (specifically when the type is invalid, but the variable name is a valid type), and highlight that as a specific error (and with a code fix)

![image](https://user-images.githubusercontent.com/289860/153382384-ba092e41-98eb-4374-8059-8653d6f6b701.png)

i.e. the error message could say something like:
> Did you mean `param foo string`

Contributor guide

Open the contributing guide

Research direction

Reproduce the declaration `param string foo` and compare it with the intended `param foo string` form. Trace the parameter declaration diagnostic and code-fix entry points, then verify that the wrong ordering receives a specific “Did you mean” correction without changing valid declarations.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.