Consider blocking the extract menu for some specific scenarios
- Dominant language
- Bicep
- Stars
- 3.6k
- Forks
- 830
- Avg merge
- 1d 21m
- Merged PRs (30d)
- 79
Description
- [ ] [@anthony-c-martin]
> There are a few places where an object can't be substituted (module body & resource body AFAIK, but there may be more). We should block it here (cursor == `|`)
>
> ```bicep
> resource namespace 'Microsoft.EventHub/namespaces@2024-01-01' existing = {|
> name: 'askdjfh'
> }
> ```
- [ ] [@anthony-c-martin]
> Another place we should block the action:
>
> ```bicep
> resource eventHub 'Microsoft.EventHub/namespaces/eventhubs@2024-01-01' = if (|foo != null) {
> parent: namespace
> name: foo!
> }
> ```
- [ ] [@anthony-c-martin]
> Technically it's not doing anything wrong here, but I'm wondering if we should block extracting a variable reference into a variable, because it's a bit odd:
>
> ```bicep
> var test = ''
> var test2 = t|est
> ```
- [ ] [@anthony-c-martin]
> "Extract parameter" generates invalid code here:
>
> ```bicep
> var test2 = {}
> var test = |test2
> ```
- [ ] [@anthony-c-martin]
> In this case:
>
> ```bicep
> var thing = ''
>
>
>
> var test2 = {|
> value: {
>
> }
> }
> ```
>
> I get the following:
>
> ```bicep
> var thing = ''
> var newVariable = {
> value: {}
> }
>
- [ ] User-defined functions:
func abcd(resourceId string) string => string(resourceId)
Contributor guide
Research direction
Start with the extract menu and extract parameter behavior described in the examples, including resource bodies, conditional expressions, variable references, object literals, and user-defined functions. Reproduce each cursor position and verify that unsupported actions are blocked and that supported extraction does not generate invalid or unexpectedly structured Bicep code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100