Misleading error highlight when resource defined in invalid scope
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
**Bicep version**
VS Code 0.4.1124
**Describe the bug**
Consider the following
```bicep
targetScope='resourceGroup'
resource foo 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: 'blah'
}
```
I'd expect
1. The error highlighting for BCP135 to highlight `Microsoft.Resources/resourceGroups@2021-04-01` rather than the resource body as it is the resource type that's invalid.
2. The `BCP035` error should be supressed - whilst it is true the `location` property is missing, since the resource type is not valid in this scope, adding a `location` is not going to make the template any more valid.
**To Reproduce**

**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
No source files or tests are named. Start by reproducing the BCP135 and BCP035 diagnostics with the provided resource-group example, then trace the diagnostic highlighting and validation behavior. Done means BCP135 highlights the resource type and BCP035 is suppressed for this invalid scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vscode
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100