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

Allow trailing commas for tuple and array literals and update formatter to put them #4373

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

timotheeguerin
Copy link
Member

@timotheeguerin timotheeguerin commented Sep 9, 2024

fix #2284

Two changes:

  • Allow parsing of trailing commas for tuple and array values
  • Formatter Change Make the formatter put some when there is multiple lines involved: This is consitent with other formatting where we add the trailing separator(It is also the default for example for js/ts formatter)

@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Sep 9, 2024
@timotheeguerin timotheeguerin changed the title Update formatter Allow trailing commas for tuple and array literals and update formatter to put them Sep 9, 2024
@azure-sdk
Copy link
Collaborator

azure-sdk commented Sep 9, 2024

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - feature ✏️

Allow trailing commas for tuple and array literals

@typespec/compiler - breaking ✏️

Formatter will add trailing commas for multi line tuples and array values

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

@timotheeguerin timotheeguerin added the breaking-change A change that might cause specs or code to break label Sep 9, 2024
Copy link
Member Author

Choose a reason for hiding this comment

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

there is also another issue that just says to do that for all list, so wondering if I should split this into 2 prs.

  1. remove the resitriction (allow parsing trailing separator for all lists)
    2.update formatter.

Copy link
Member Author

Choose a reason for hiding this comment

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

move the restrition removal to another PR and we can keep this one for the formatting change #4837

@microsoft-github-policy-service microsoft-github-policy-service bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Nov 22, 2024
Copy link
Contributor

Hi @timotheeguerin. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

1 similar comment
Copy link
Contributor

Hi @timotheeguerin. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the stale label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change A change that might cause specs or code to break compiler:core Issues for @typespec/compiler stale Mark a PR that hasn't been recently updated and will be closed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow trailing commas in array
2 participants