Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested enhancements to extraction refactoring #15193

Closed
2 of 9 tasks
StephenWeatherford opened this issue Oct 2, 2024 · 1 comment
Closed
2 of 9 tasks

Suggested enhancements to extraction refactoring #15193

StephenWeatherford opened this issue Oct 2, 2024 · 1 comment
Assignees
Labels
devdiv Related to Bicep tooling efforts in DevDiv enhancement New feature or request story: refactoring
Milestone

Comments

@StephenWeatherford
Copy link
Contributor

StephenWeatherford commented Oct 2, 2024

Pulled from #14701

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 == |)

resource namespace 'Microsoft.EventHub/namespaces@2024-01-01' existing = {|
  name: 'askdjfh'
}

Another place we should block the action:

resource eventHub 'Microsoft.EventHub/namespaces/eventhubs@2024-01-01' = if (|foo != null) {
  parent: namespace
  name: foo!
}

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:

var test = ''
var test2 = t|est

"Extract parameter" generates invalid code here:

var test2 = {}
var test = |test2

In this case:

var thing = ''



var test2 = {|
  value: {
    
  }
}

I get the following:

var thing = ''
var newVariable = {
  value: {}
}

var test2 = newVariable


It looks like it appends directly under the previous declaration, which felt a little bit surprising. The behavior which I think would feel most intuitive to me would be prepending, but with a double new-line gap - e.g.:

```bicep
var thing = ''

var newVariable = {
  value: {}
}

var test2 = newVariable
@StephenWeatherford StephenWeatherford added the enhancement New feature or request label Oct 2, 2024
@StephenWeatherford StephenWeatherford self-assigned this Oct 2, 2024
@StephenWeatherford StephenWeatherford added devdiv Related to Bicep tooling efforts in DevDiv story: refactoring and removed Needs: Triage 🔍 labels Oct 2, 2024
@StephenWeatherford StephenWeatherford modified the milestones: v0.32, v0.31 Oct 2, 2024
@StephenWeatherford
Copy link
Contributor Author

Fixed the newline issues. Moved the other issues to separate bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devdiv Related to Bicep tooling efforts in DevDiv enhancement New feature or request story: refactoring
Projects
Status: Done
Development

No branches or pull requests

1 participant