-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TOML Trailing Comma bug #6636
Comments
As per the troubleshooting doc, this is a problem with the upstream grammar. Please open an issue there. |
is it possible the upstream grammar is being improperly applied somehow? The textmate toml bundle seems to parse fine in TextMate itself- but you can see even some of the official toml spec test cases show up with error highlights in the github rendering. I can't pin this down exactly but I don't remember toml files rendering this way in the past and neither the toml spec nor the upstream grammar have changed in years. I feel like I would've noticed this in one of the many pyproject.toml files that now highlight in red. 🤷 |
@ahvigil This isn't the fault of the TextMate grammar. There appears to have been a change in GitHub's own PrettyLights highlighter; the grammar itself is valid and no changes to it are necessary. See #6603 (comment) for more details. |
I've opened #6668 to track the highlighting issues in one place |
Also, for what it's worth I believe the issue here is triggered by the line comment, not the trailing comma. It looks fine if I remove the last comment in the [tool.ruff]
select = ["ALL"]
ignore = [
"D107", # we have pydoclint with class docstring
"D407", # we have google style docstrings
"E501", # we have black
"ANN", # we have mypy
"TRY003", # there is EM102
"D203", # there is D211
"D213", # there is D212
"FIX002 ---> comment removed here",
]
[tool.ruff.extend-per-file-ignores]
"**/tests/**/*.py" = [
"S101", # assert is fine in tests
"D100", # tests is not a package
"D104", # tests modules don't need docstrings
] |
Describe the bug
Hi 👋
TOML allows trailing comma in inline arrays ref toml-lang/toml#246 (comment).
Here's an example TOML where the trailing comma causes a bug (incorrect red highlight onwards): https://github.com/ddelange/mapply/blob/0.1.23/pyproject.toml#L60
Expected behaviour
Code following the inline array with trailing comma should not have red highlight.
Related discussion
Additional notes
The text was updated successfully, but these errors were encountered: