astral-sh / ruff-lsp

A Language Server Protocol implementation for Ruff.
Other
1.34k stars 46 forks source link

Fix single-cell formatting #496

Closed MichaReiser closed 2 months ago

MichaReiser commented 2 months ago

Summary

https://github.com/astral-sh/ruff/pull/12864 changed ruff to respect the language specified in cell.metadata when determining Python cells. To do so, the PR added the new cell.metadata field and made it required as specified in the specification.

https://github.com/astral-sh/ruff-lsp/pull/485 patched ruff-lsp to send an empty dict for cell.metadata but we, unfortunately, missed updating the JSON for a single cell document that is used by the formatter. This PR fixes this.

Fixes https://github.com/astral-sh/ruff-vscode/issues/617

Test Plan

I tested that formatting notebooks is working as expected.