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

[prettier] Adds prettier-plugin-move #18405

Closed
wants to merge 21 commits into from
Closed

[prettier] Adds prettier-plugin-move #18405

wants to merge 21 commits into from

Conversation

damirka
Copy link
Contributor

@damirka damirka commented Jun 25, 2024

Description

Upstreams the prettier plugin development.

Test plan

Features tests.


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@damirka damirka requested a review from ronny-mysten as a code owner June 25, 2024 16:18
Copy link

vercel bot commented Jun 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2024 4:10pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jul 28, 2024 4:10pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jul 28, 2024 4:10pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview Jul 28, 2024 4:10pm

Copy link
Contributor

@awelc awelc left a comment

Choose a reason for hiding this comment

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

In addition to additional tests requested in the PR's body, it would be great to see separate tests for more complicated (nested, breaking, etc.) imports (aka uses) and attributes


fun binary_expression_folding() {
// binary_expression
say_something_really_long && say_something_really_long || say_something_really_long;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add tests for parenthesized variants

Copy link
Contributor

Choose a reason for hiding this comment

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

I was hoping for something that will exercise breaks involving parenthesized conditions. Something like a couple of differently parenthesized variants of the following:

((say_something_really_long || say_something_really_long) && say_something_really_long) || (say_something_really_long && say_something_really_long) || (say_something_really_long || say_something_really_long)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not technically feasible today. I'm waiting on Tim to try and patch the structure of the binary_expression, so we know we're inside a binary expression. But overall these are the hardest to get and require special treatment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Acknowledged. As suggested in the other comment, let's add some additional explanation and a test, and move on

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be really good to get a bit more detailed explanation on the difficulty related to binary expressions, even if they are not fully handled as part of this PR, so that we know what's missing (if anything) and what kind of effort could be involved in getting this to completion

function printBindField(path: AstPath<Node>, options: ParserOptions, print: printFn): Doc {
const nonFormatting = path.node.nonFormattingChildren;
const isMut = !!path.node.children.find((c) => c.text === 'mut');
// const rename = nonFormatting.length == 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?


fun binary_expression_folding() {
// binary_expression
say_something_really_long && say_something_really_long || say_something_really_long;
Copy link
Contributor

Choose a reason for hiding this comment

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

I was hoping for something that will exercise breaks involving parenthesized conditions. Something like a couple of differently parenthesized variants of the following:

((say_something_really_long || say_something_really_long) && say_something_really_long) || (say_something_really_long && say_something_really_long) || (say_something_really_long || say_something_really_long)

@awelc
Copy link
Contributor

awelc commented Jul 23, 2024

Here's a summary of testing that needs to happen either as part of this PR or a series of the following ones (in the latter case we should probably keep track of this via a series of opened issue):
Tests for:

  • more complicated (nested, breaking, etc.) imports (aka uses)
  • more complicated (nested, breaking, etc.) attributes
  • the case when function types need to break (both in the parameters and return type)
  • more complicated if conditions, in particular parenthesized in a nested fashion
  • index notation when a list of indexes is very long with both short and long index values
  • more complicated enum matches
  • binary expressions that exercise breaks involving parenthesized conditions. Something like a couple of differently parenthesized variants of the following:
((say_something_really_long || say_something_really_long) && say_something_really_long) || (say_something_really_long && say_something_really_long) || (say_something_really_long || say_something_really_long)

@damirka damirka force-pushed the ds/prettier-move branch from 92518b9 to 4cd6bb4 Compare July 23, 2024 19:39
@damirka damirka requested review from pchrysochoidis and mystieanwaya and removed request for a team July 28, 2024 15:58
@github-actions github-actions bot added the Type: Documentation Improvements or additions to documentation label Jul 28, 2024
@damirka damirka force-pushed the ds/prettier-move branch from 29fa35d to 9709700 Compare July 28, 2024 15:59
@github-actions github-actions bot removed the Type: Documentation Improvements or additions to documentation label Jul 28, 2024
Copy link
Contributor

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Sep 27, 2024
@tedks
Copy link
Contributor

tedks commented Nov 18, 2024

Is this obsolete in favor of #20203?

@damirka
Copy link
Contributor Author

damirka commented Nov 18, 2024

@tedks correct! Closing!

@damirka damirka closed this Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants