feat: add TOML 1.1 support with multiline inline tables#5655
Draft
baszalmstra wants to merge 12 commits intomainfrom
Draft
feat: add TOML 1.1 support with multiline inline tables#5655baszalmstra wants to merge 12 commits intomainfrom
baszalmstra wants to merge 12 commits intomainfrom
Conversation
Update toml-span from 0.6.0 to 0.7.1 (adds TOML 1.1 spec support), toml from 0.9.8 to 0.9.11, and toml_edit from 0.23.0 to 0.23.7. Add tests demonstrating multiline inline table parsing in both the manifest parser (toml-span) and document editor (toml_edit). Document the TOML 1.1 multiline inline table support in the manifest reference. https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
… test - Use insta snapshots in all multiline inline table tests to verify parsed content and formatting are correct - Bump toml-span to 0.7.0 (minimum for TOML 1.1 support) - Bump toml_edit to 0.24.0 (minimum for official TOML 1.1 support) - Revert toml to 0.9.8 (not needed for pixi.toml parsing) - Add error span test to verify diagnostics point to correct locations inside multiline inline tables https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
- Bump toml_edit from 0.24.0 to 0.25.0 (latest minor with parsing fixes) - Remove insta snapshots from parse-only manifest tests — these only need to verify parsing succeeds via unwrap() - Keep insta snapshots for document editing tests (verify formatting) and error span test (verify diagnostic locations) https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
Change the error span test to use an invalid version value ("!invalid!")
so the diagnostic points to the value itself (line 9, col 24) rather
than the whole table. This verifies toml-span correctly tracks spans
within multiline inline tables at field-level granularity.
https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
- Bump toml from 0.9.8 to 0.9.10 (minimum for TOML 1.1 support) - Fix insert_into_inline_table to place new entries on their own line when the existing table uses multiline formatting. Detects indentation from existing entries and applies matching decoration to the new key. https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
Fix the space-before-comma artifact (` ,`) by clearing value suffix decoration. Preserve the original trailing comma style: if the table had a trailing comma, the new entry gets one too; if not, it doesn't. Ensure the closing `}` stays on its own line in both cases. Add test for the no-trailing-comma case to verify both styles. https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
When inserting into a multiline inline table, detect whether the existing keys are sorted (case-insensitive). If sorted, insert the new key at the correct position to maintain order. If unsorted, append at the end to preserve the user's custom ordering. Extracted small, independently testable helpers: - is_sorted_case_insensitive: checks if a key list is sorted - sorted_insert_position: binary search for the insertion index - detect_inline_table_indentation: extracts multiline indent Added 15 new tests: 10 unit tests for the helpers, 4 integration tests for sorted/unsorted/mixed-case/start-position insertion, plus the existing trailing comma tests. https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
Reverts the following commits: - feat: sorted insertion for multiline inline tables - fix: preserve trailing comma style in multiline inline table insertion - feat: bump toml to 0.9.10, fix multiline inline table insertion https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
- Bump toml from 0.9.8 to 0.9.10 (minimum for TOML 1.1 support) - Fix insert_into_inline_table to place new entries on their own line when the existing table uses multiline formatting - Fix space-before-comma artifact by clearing value suffix decoration - Preserve trailing comma style: if the table had a trailing comma the new entry gets one too; if not, it doesn't - Ensure closing `}` stays on its own line in both cases - Add test for the no-trailing-comma variant https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
- Let rustfmt reformat the key builder chain
- Replace useless format!("\n") with "\n".to_string()
https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
Contributor
Hofer-Julian
left a comment
There was a problem hiding this comment.
Really excited for this. I'd like to play a bit more with it locally before we merge it
Replace external .snap files with inline snapshot strings for the two multiline inline table insertion tests. https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
Contributor
|
[workspace]
authors = ["Julian Hofer <julianhofer@gnome.org>"]
channels = ["conda-forge"]
name = "toml-1.1"
platforms = ["linux-64"]
version = "0.1.0"
[tasks]
[feature.test]
dependencies = {
numpy = "*"
}
[environments]
test = ["test"]Then run [feature.test]
dependencies = {
numpy = "*"
, pydantic = ">=2.12.5,<3" }I would have expected: [feature.test]
dependencies = {
numpy = "*",
pydantic = ">=2.12.5,<3",
} |
Adds an explicit test reproducing the issue from PR #5655 comment where inserting into a single-entry multiline inline table without a trailing comma could produce malformatted output. The fix already handles this case correctly. https://claude.ai/code/session_01FT59TTz4yRy3DPwbREE82u
Contributor
Author
|
I converted to draft because I think this could be integrated better in more places. Im working on that now. |
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.
Description
Update TOML crates to support the TOML 1.1 specification, which introduces multiline inline tables and trailing commas. This improves readability of
pixi.tomlfiles by allowing users to write:Crate updates (minimum versions for TOML 1.1):
toml-span: 0.6.0 → 0.7.0 (TOML 1.1 parsing support)toml_edit: 0.23.0 → 0.25.0 (TOML 1.1 editing support)Documentation updated to note TOML 1.1 support in the manifest reference.
How Has This Been Tested?
Added 6 new tests in
pixi_manifest:toml_editpreserves multiline inline table formatting when parsing and inserting valuesAll 285
pixi_manifesttests pass. Full project builds cleanly (cargo checksucceeds).AI Disclosure
Tools: Claude Code
Checklist: