Summary -- This PR updates `check_path` in the `ruff_linter` crate to return a `Vec<Message>` instead of a `Vec<Diagnostic>`. The main motivation for this is to make it easier to convert semantic syntax errors directly into `Message`s rather than `Diagnostic`s in #16106. However, this also has the benefit of keeping the preview check on unsupported syntax errors in `check_path`, as suggested in https://github.com/astral-sh/ruff/pull/16429#discussion_r1974748024. All of the interesting changes are in the first commit. The second commit just renames variables like `diagnostics` to `messages`, and the third commit is a tiny import fix. I also updated the `ExpandedMessage::location` field name, which caused a few extra commits tidying up the playground code. I thought it was nicely symmetric with `end_location`, but I'm happy to revert that too. Test Plan -- Existing tests. I also tested the playground and server manually. |
||
|---|---|---|
| .. | ||
| api | ||
| knot | ||
| ruff | ||
| shared | ||
| .gitignore | ||
| .prettierignore | ||
| README.md | ||
| eslint.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
README.md
playground
In-browser playground for Ruff. Available https://play.ruff.rs/.
Getting started
Install the NPM dependencies with npm install, and run, and run the development server with
npm start --workspace ruff-playground or npm start --workspace knot-playground.
You may need to restart the server after making changes to Ruff or Red Knot to re-build the WASM
module.
To run the datastore, which is based
on Workers KV,
install the Wrangler CLI,
then run npx wrangler dev --local from the ./playground/api directory. Note that the datastore
is
only required to generate shareable URLs for code snippets. The development datastore does not
require Cloudflare authentication or login, but in turn only persists data locally.
Architecture
The playground is implemented as a single-page React application powered by Vite, with the editor experience itself powered by Monaco.
The playground stores state in localStorage, but supports persisting code snippets to
a persistent datastore based
on Workers KV
and exposed via
a Cloudflare Worker.
The playground design is originally based on Tailwind Play, with additional inspiration from the Biome Playground.
Known issues
Stack overflows
If you see stack overflows in the playground, build the WASM module in release mode:
npm run --workspace knot-playground build:wasm.