Repository navigation
ruff.applyFormat now formats an entire notebook document - #11493
Merged
Merged
Conversation
snowsignal
force-pushed
the
jane/server/notebook/format/all-cells-cmd
branch
from
May 22, 2024 09:33
f31f4d2 to
4421339
Compare
Contributor
|
dhruvmanila
approved these changes
May 22, 2024
MichaReiser
reviewed
May 27, 2024
| pub(super) fn format_full_document(snapshot: &DocumentSnapshot) -> Result<Fixes> { | ||
| let mut fixes = Fixes::default(); | ||
|
|
||
| if let Some(notebook) = snapshot.query().as_notebook() { |
Member
There was a problem hiding this comment.
Nit: Would it make sense to store the result of snapshot.query() in a variable. It's used in multiple places and feels fairly repetitive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Previously,
ruff.applyFormat, seen in VS Code as the commandRuff: Format Document, would only format the currently active notebook cell inside a notebook document. This PR makesruff.applyFormatformat the entire notebook document at once, operating on each code cell in order.Test Plan
Ruff: Format Documentthrough the Command Palette (Ctrl/Cmd+Shift+Pby default)