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

var loops and completion fixes #2077

Merged
merged 2 commits into from
Apr 1, 2021
Merged

var loops and completion fixes #2077

merged 2 commits into from
Apr 1, 2021

Conversation

majastrz
Copy link
Member

Changes:

  • Added variable loops (this fixes Implement variable loops #1814). Variable loops cannot depend on runtime functions such as list*() or reference() and cannot retrieve a property of another resource. An error diagnostic listing the variable dependency chain is emitted in this case.
  • Added variable loop snippets
  • Fixed parameter value and output value snippets to be more consistent with property value snippets of the same type (this fixes Output loop snippets are missing #2073). None of this is introducing any new capabilities - just reusing existing code better.

Variable Loops

image

Variable completions

image

Parameter completions

image
(The {} completion was missing before.)

Output completions

image
(The [] completion and loop snippets were missing before.)

@@ -174,6 +174,25 @@ public void EmitLanguageExpression(SyntaxBase syntax)

public void EmitCopyObject(string? name, ForSyntax syntax, SyntaxBase? input, string? copyIndexOverride = null, long? batchSize = null)
{
// local function
static bool CanEmitAsInputDirectly(SyntaxBase input)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CanEmitAsInputDirectly [](start = 24, length = 22)

I have an internal task to fix this in the runtime, so the workarounds aren't needed anymore.

@@ -24,6 +24,57 @@
},
"functions": [],
"variables": {
"copy": [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy [](start = 5, length = 4)

I've deployed a template that compiled to this addition and it worked.

@majastrz majastrz marked this pull request as ready for review March 31, 2021 04:22
@majastrz majastrz merged commit 7492a04 into main Apr 1, 2021
@majastrz majastrz deleted the majastrz/loopy-vars branch April 1, 2021 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output loop snippets are missing Implement variable loops
2 participants