Skip to content

fix: perform format operation in chunks - #115

Merged
43081j merged 6 commits into
prettier:mainfrom
cellison-figma:ce/chunk-file-formatting
Sep 4, 2026
Merged

fix: perform format operation in chunks#115
43081j merged 6 commits into
prettier:mainfrom
cellison-figma:ce/chunk-file-formatting

Conversation

@cellison-figma

Copy link
Copy Markdown
Contributor

Description

Maps file formatting with concurrency, bound to passed in parallel worker count or CPU count minus one (as fallback). This replaces the previous unbounded Promise.allSettled & addresses an outstanding TODO comment. Cache reads, config resolution, file contents, and formatting jobs are still bound together. Errors still settle independently, and results retain their original file order.

The concurrency mapper has added tests to cover core functionality.

This resolves issue #114

@cellison-figma cellison-figma changed the title feat: perform format operation in chunks fix: perform format operation in chunks Jul 22, 2026
Comment thread src/map_settled_with_concurrency.ts Outdated
@cellison-figma
cellison-figma requested a review from 43081j August 17, 2026 13:18
@pkg-pr-new

pkg-pr-new Bot commented Aug 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

yarn add https://pkg.pr.new/@prettier/cli@115.tgz

commit: 83c4a2c

Comment thread src/index.ts Outdated
@fisker

fisker commented Sep 3, 2026

Copy link
Copy Markdown
Member

Is options.parallelWorkers intentionally removed in 1c031c8 ?

@cellison-figma

Copy link
Copy Markdown
Contributor Author

@fisker sorry, that was me missing it in the update. Restored.

Comment thread src/index.ts Outdated
Co-authored-by: fisker Cheung <lionkay@gmail.com>
Comment thread src/utils.ts Outdated
Comment thread src/utils.ts
await Promise.all(Array.from({ length: runnersCount }, runNext));

return results;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@43081j Did you review the implementation of this function? It doesn't feel correct to me.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

its a shame we need it but thats more a fault of Node not having any built-in capability for it.

the implementation seems fine to me 👍

basically kicks off runnersCount functions which iterate until the queue is drained.

Co-authored-by: fisker Cheung <lionkay@gmail.com>

@fisker fisker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure about #115 (comment), other changes looks good to me, I'll leave this to @43081j

@43081j
43081j merged commit 29816a8 into prettier:main Sep 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants