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

Fix formatting of object and array literal in decorator #3577

Conversation

timotheeguerin
Copy link
Member

@timotheeguerin timotheeguerin commented Jun 13, 2024

Currently formats to

@example(
  #{
    id: "some",
    bar: "thing",
    date: utcDateTime.fromISO("2020-01-01T00:00:00Z"),
    unixDate: unixTimestamp32.fromISO("2020-01-01T00:00:00Z"),
    encodedAsRfc7231: utcDateTime.fromISO("2020-01-01T00:00:00Z"),
    dob: plainDate.fromISO("2020-01-01"),
    timeout: duration.fromISO("PT1M"),
    timeoutInSeconds: duration.fromISO("PT1M1.5S"),
    timeoutInSecondsFloat: duration.fromISO("PT0.5S"),
  }
)

woudl get formatted to


@example(#{
    id: "some",
    bar: "thing",
    date: utcDateTime.fromISO("2020-01-01T00:00:00Z"),
    unixDate: unixTimestamp32.fromISO("2020-01-01T00:00:00Z"),
    encodedAsRfc7231: utcDateTime.fromISO("2020-01-01T00:00:00Z"),
    dob: plainDate.fromISO("2020-01-01"),
    timeout: duration.fromISO("PT1M"),
    timeoutInSeconds: duration.fromISO("PT1M1.5S"),
    timeoutInSecondsFloat: duration.fromISO("PT0.5S"),
})

@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Jun 13, 2024
@azure-sdk
Copy link
Collaborator

azure-sdk commented Jun 13, 2024

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - fix ✏️

Fix formatting of object and array literal in decorator to hug parenthesis

@azure-sdk
Copy link
Collaborator

You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/3577/

Check the website changes at https://tspwebsitepr.z22.web.core.windows.net/prs/3577/

@timotheeguerin timotheeguerin added this pull request to the merge queue Jun 14, 2024
Merged via the queue into microsoft:main with commit 6bbc247 Jun 14, 2024
21 checks passed
@timotheeguerin timotheeguerin deleted the fix/formatting-object-array-literal-hug branch June 14, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants