Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

☂️ JSX Formatting Support #2262

Closed
9 tasks done
ematipico opened this issue Mar 21, 2022 · 5 comments
Closed
9 tasks done

☂️ JSX Formatting Support #2262

ematipico opened this issue Mar 21, 2022 · 5 comments
Labels
A-Formatter Area: formatter I-Difficult Implementation: requires deep knowledge of the tools and the problem. umbrella Issue to track a collection of other issues

Comments

@ematipico
Copy link
Contributor

ematipico commented Mar 21, 2022

Description

This issue will be used to track the works around the formatting of JSX inside the formatter.

Please refer to the ungram file to make sure which grammar is supported by the parser which one is not.

For external contributors

Please refer to this section when writing tests for the formatter.

  • we want to format valid JSX programs;
  • start with simple programs, without comments;
  • by default all nodes implement the method format_verbatim, the objective is to remove that and apply a custom formatting;
  • use prettier as inspiration to apply the formatting;
  • if the snapshot will contain a section like "## Unimplemented nodes/tokens", it means that some nodes haven't been implemented and still use the function format_verbatim;
  • when the formatting makes sense, try add some case with comments;
  • the test suites will consider a test valid when:
    1. all tokens are formatted and formatted only once;
    2. the emitted code is a valid program (no syntax errors);
    3. the emitted code, when formatted a second time, is the same;
  • use the playground to understand the AST/CST;
  • use this quick test to inspect the AST. The test is ignored on purpose, so it can be run from an IDE without breaking the CI;
  • use the *Fields structs to extract the tokens/nodes;
@ematipico ematipico added good first issue Good for newcomers umbrella Issue to track a collection of other issues A-Formatter Area: formatter labels Mar 21, 2022
darrow-olykos added a commit to RustPhilly/tools that referenced this issue Mar 22, 2022
the simplest tag_expression (that is not self closing) to format is the smallest possible tree that
needs no formatting. for example `<a></a>`.
@darrow-olykos
Copy link
Contributor

I would like to work on JsxElement please!

@ematipico
Copy link
Contributor Author

@darrow-olykos I assigned you to the issue

@ematipico ematipico pinned this issue Apr 28, 2022
@darrow-olykos
Copy link
Contributor

Hey @ematipico, I cannot commit to finishing JsxElement for personal reasons. I sincerely appreciate all of the education you and others shared with me while looking into this!

@yassere yassere added this to Rome 2022 May 8, 2022
@MichaReiser MichaReiser unpinned this issue May 10, 2022
@ematipico ematipico added I-Difficult Implementation: requires deep knowledge of the tools and the problem. I-Staff Implementation: should be in charge of a core member of the team and removed good first issue Good for newcomers I-Staff Implementation: should be in charge of a core member of the team labels May 23, 2022
@ematipico ematipico moved this to Done in Rome 2022 Jul 5, 2022
@darrow-olykos
Copy link
Contributor

Sigh, good memories, exciting to see this closed

@ematipico
Copy link
Contributor Author

Sigh, good memories, exciting to see this closed

Yes! Finally! :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter I-Difficult Implementation: requires deep knowledge of the tools and the problem. umbrella Issue to track a collection of other issues
Projects
Status: Done
Development

No branches or pull requests

2 participants