mirror of
https://github.com/astral-sh/ruff
synced 2026-01-20 21:10:48 -05:00
Red Knot Playground (#12681)
## Summary This PR adds a playground for Red Knot [Screencast from 2024-08-14 10-33-54.webm](https://github.com/user-attachments/assets/ae81d85f-74a3-4ba6-bb61-4a871b622f05) Sharing does work 😆 I just forgot to start wrangler. It supports: * Multiple files * Showing the AST * Showing the tokens * Sharing * Persistence to local storage Future extensions: * Configuration support: The `pyproject.toml` would *just* be another file. * Showing type information on hover ## Blockers ~~Salsa uses `catch_unwind` to break cycles, which Red Knot uses extensively when inferring types in the standard library. However, WASM (at least `wasm32-unknown-unknown`) doesn't support `catch_unwind` today, so the playground always crashes when the type inference encounters a cycle.~~ ~~I created a discussion in the [salsa zulip](https://salsa.zulipchat.com/#narrow/stream/333573-salsa-3.2E0/topic/WASM.20support) to see if it would be possible to **not** use catch unwind to break cycles.~~ ~~[Rust tracking issue for WASM catch unwind support](https://github.com/rust-lang/rust/issues/118168)~~ ~~I tried to build the WASM with the nightly compiler option but ran into problems because wasm-bindgen doesn't support WASM-exceptions. We could try to write the binding code by hand.~~ ~~Another alternative is to use `wasm32-unknown-emscripten` but it's rather painful to build~~
This commit is contained in:
5
.github/workflows/ci.yaml
vendored
5
.github/workflows/ci.yaml
vendored
@@ -736,10 +736,9 @@ jobs:
|
||||
- name: "Install Node dependencies"
|
||||
run: npm ci
|
||||
working-directory: playground
|
||||
- name: "Build Ruff playground"
|
||||
run: npm run dev:build --workspace ruff-playground
|
||||
- name: "Build playgrounds"
|
||||
run: npm run dev:wasm
|
||||
working-directory: playground
|
||||
# Requires a build for ruff_wasm to exist
|
||||
- name: "Run TypeScript checks"
|
||||
run: npm run check
|
||||
working-directory: playground
|
||||
|
||||
6
.github/workflows/publish-playground.yml
vendored
6
.github/workflows/publish-playground.yml
vendored
@@ -38,12 +38,12 @@ jobs:
|
||||
- name: "Install Node dependencies"
|
||||
run: npm ci
|
||||
working-directory: playground
|
||||
- name: "Build Ruff playground"
|
||||
run: npm run build --workspace ruff-playground
|
||||
working-directory: playground
|
||||
- name: "Run TypeScript checks"
|
||||
run: npm run check
|
||||
working-directory: playground
|
||||
- name: "Build Ruff playground"
|
||||
run: npm run build --workspace ruff-playground
|
||||
working-directory: playground
|
||||
- name: "Deploy to Cloudflare Pages"
|
||||
if: ${{ env.CF_API_TOKEN_EXISTS == 'true' }}
|
||||
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1
|
||||
|
||||
Reference in New Issue
Block a user