ruff/playground
Aria Desires e5818d89fd
[ty] Add "import ..." code-action for unresolved references (#21629)
## Summary

Originally I planned to feed this in as a `fix` but I realized that we
probably don't want to be trying to resolve import suggestions while
we're doing type inference. Thus I implemented this as a fallback when
there's no fixes on a diagnostic, which can use the full lsp machinery.

Fixes https://github.com/astral-sh/ty/issues/1552

## Test Plan

Works in the IDE, added some e2e tests.
2025-11-27 10:06:38 -05:00
..
api Update dependency uuid to v13 (#20714) 2025-10-06 08:25:48 +02:00
ruff Update dependency monaco-editor to ^0.54.0 (#21235) 2025-11-03 03:06:16 +00:00
shared [ty] Fix `None`, `True` and `False` highlighting in playground (#20994) 2025-10-20 19:25:08 +02:00
ty [ty] Add "import ..." code-action for unresolved references (#21629) 2025-11-27 10:06:38 -05:00
.gitignore Remove all `useEffect` usages (#12659) 2024-08-08 13:16:38 +02:00
.prettierignore Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
README.md [`docs`] Typo fix for playground (#18929) 2025-06-24 21:01:48 -04:00
eslint.config.mjs Red Knot Playground (#12681) 2025-03-18 17:17:11 +01:00
package-lock.json Update dependency pyodide to ^0.29.0 (#21236) 2025-11-03 03:23:24 +00:00
package.json Revert "Update NPM Development dependencies" (#19730) 2025-08-04 07:33:58 +00:00
tsconfig.json Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
tsconfig.node.json Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00

README.md

playground

In-browser playground for Ruff. Available https://play.ruff.rs/.

Getting started

Install the NPM dependencies with npm install, and run the development server with npm start --workspace ruff-playground or npm start --workspace ty-playground. You may need to restart the server after making changes to Ruff or ty 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 ty-playground build:wasm.