Formatter: Fix syntax error location in notebooks (#16499)

## Summary

Fixes https://github.com/astral-sh/ruff/issues/16476
fixes: #11453

We format notebooks cell by cell. That means, that offsets in parse
errors are relative
to the cell and not the entire document. We didn't account for this fact
when emitting syntax errors for notebooks in the formatter. 

This PR ensures that we correctly offset parse errors by the cell
location.

## Test Plan

Added test (it panicked before)
This commit is contained in:
Micha Reiser
2025-03-04 17:00:31 +00:00
committed by GitHub
parent e7b93f93ef
commit 087d92cbf4
4 changed files with 89 additions and 1 deletions

1
Cargo.lock generated
View File

@@ -2693,6 +2693,7 @@ dependencies = [
"ruff_notebook",
"ruff_python_ast",
"ruff_python_formatter",
"ruff_python_parser",
"ruff_server",
"ruff_source_file",
"ruff_text_size",