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

feat(rome_formatter): Dedent to Root IR #3062

Merged
merged 2 commits into from
Aug 16, 2022
Merged

Conversation

MichaReiser
Copy link
Contributor

@MichaReiser MichaReiser commented Aug 15, 2022

Summary

This PR extends the dedent IR element to support dedenting by one level or to the start of the line.

I intentionally called the mode root because it may become necessary in the future that it's possible to mark a root which is different to the start of the line.

This IR is necessary to correctly format TemplateLiterals where inserting any indent characters that weren't present of the template in the source changes the templates content at runtime.

Test Plan

I added a doc test demonstrating how the IR can be used and verifies that the printer correctly resets the indent level.

@MichaReiser MichaReiser added the A-Formatter Area: formatter label Aug 15, 2022
@MichaReiser MichaReiser added this to the 0.9.0 milestone Aug 15, 2022
@MichaReiser MichaReiser requested a review from ematipico as a code owner August 15, 2022 13:01
@MichaReiser MichaReiser temporarily deployed to aws August 15, 2022 13:01 Inactive
@MichaReiser MichaReiser force-pushed the feat/reset-indent-ir branch from 8528e11 to 94256b1 Compare August 15, 2022 13:03
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 15, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8e9381d
Status:⚡️  Build in progress...

View logs

@MichaReiser MichaReiser temporarily deployed to aws August 15, 2022 13:03 Inactive
@MichaReiser MichaReiser marked this pull request as draft August 15, 2022 13:04
@github-actions
Copy link

github-actions bot commented Aug 15, 2022

This PR extends the `dedent` IR element to support dedenting by one level or to the start of the line.

I intentionally called the mode `root` because it may become necessary in the future that it's possible to mark a root which is different to the start of the line.

This IR is necessary to correctly format `TemplateLiteral`s where inserting any indent characters that weren't present of the template in the source changes the `template`s content at runtime.
@MichaReiser MichaReiser force-pushed the feat/reset-indent-ir branch from 94256b1 to 86919fa Compare August 15, 2022 13:12
@MichaReiser MichaReiser temporarily deployed to aws August 15, 2022 13:12 Inactive
@MichaReiser MichaReiser changed the title feat(rome_formatter): Reset Indent IR feat(rome_formatter): Dedent Root IR Aug 15, 2022
@MichaReiser MichaReiser marked this pull request as ready for review August 15, 2022 13:15
@MichaReiser MichaReiser temporarily deployed to aws August 16, 2022 09:00 Inactive
@MichaReiser MichaReiser changed the title feat(rome_formatter): Dedent Root IR feat(rome_formatter): Dedent to Root IR Aug 16, 2022
@MichaReiser MichaReiser merged commit 24e83be into main Aug 16, 2022
@MichaReiser MichaReiser deleted the feat/reset-indent-ir branch August 16, 2022 09:06
IWANABETHATGUY pushed a commit to IWANABETHATGUY/tools that referenced this pull request Aug 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载