26 Commits
Author SHA1 Message Date
Alex Waygood 29c3a12911 Update Monaco and its DOMPurify dependency (#29527)
The playgrounds declared Monaco 0.56.0, which pins DOMPurify 3.4.8. That
version is affected by
[GHSA-55q2-fjhq-7xh7](https://github.com/advisories/GHSA-55q2-fjhq-7xh7).
Update Monaco to 0.57.0, which pins DOMPurify 3.4.15 and is outside the
advisory's affected range.

This security update is only partial: DOMPurify 3.4.15 is affected by
[GHSA-p98j-92pf-mc4p](https://github.com/advisories/GHSA-p98j-92pf-mc4p)
and
[GHSA-6688-9rhm-gjv2](https://github.com/advisories/GHSA-6688-9rhm-gjv2),
which list 3.4.16 as a patched version. It is also affected by
[GHSA-c6gr-qvv4-5v3f](https://github.com/cure53/DOMPurify/security/advisories/GHSA-c6gr-qvv4-5v3f),
[GHSA-mrv2-3pqr-j5jr](https://github.com/cure53/DOMPurify/security/advisories/GHSA-mrv2-3pqr-j5jr),
and
[GHSA-cg2g-xh64-v4q7](https://github.com/cure53/DOMPurify/security/advisories/GHSA-cg2g-xh64-v4q7),
which list 3.4.17 as a patched version. Monaco 0.57.0 is the latest
release and still pins DOMPurify 3.4.15.

The `@monaco-editor/react` loader defaults to a CDN build of Monaco
0.52.2, which bundles DOMPurify 3.1.7. Bundle the installed Monaco
package and its editor and JSON workers, so the browser uses the
installed version instead of the CDN build.

Codex's analysis is that Renovate's missing [support for targeted
updates of transitive dependencies in
`package-lock.json`](https://github.com/renovatebot/renovate/issues/46379)
may explain why it did not open a security update for the vulnerable
DOMPurify version.

Split from #29518.
2026-10-20 14:55:35 -07:00
Micha Reiser 3070999871 Use Oxlint for playground linting (#27995) 2026-08-24 20:05:27 +01:00
renovate[bot] c1e3133523 Update dependency monaco-editor to ^0.56.0 (#27290) 2026-07-29 08:44:37 +02:00
Alex Waygood 5fe182951f Make playground diagnostic links clickable (#26104)
## Summary

Diagnostic detail messages in the playground are currently rendered as
plain text, so embedded URLs cannot be opened directly. Render HTTP and
HTTPS URLs as links that open in a new tab while preserving the
surrounding diagnostic text.

## Test plan



https://github.com/user-attachments/assets/8fa25446-ba30-41ee-a04a-5cc60c212a1c
2026-06-17 17:47:33 +01:00
Alex WaygoodandMicha Reiser 26777f3c63 Render primary-diagnostic secondary annotations in the Ruff and ty playgrounds (#25875)
## Summary

This is a followup PR to https://github.com/astral-sh/ruff/pull/25490.
That PR added support for rendering subdiagnostics in the ty playground,
but omitted support for rendering secondary annotations attached
directly to a primary diagnostic.

This change:

- exposes primary-diagnostic secondary annotations through `ty_wasm`
- renders them in the diagnostics panel and Monaco hover information
- makes annotation locations navigable, including cross-file jumps

## Test plan

Both videos use [this playground
gist](https://play.ty.dev/1789f663-d4d1-46df-9c58-a965b9bf88c0).

### Before (`main`)


https://github.com/user-attachments/assets/e9b53694-fe8d-40cf-8784-f5f5e8a947a3

### After


https://github.com/user-attachments/assets/9b352c1d-57cc-4cb4-ab7a-38d738e30f07

### Ruff playground screenshot

<img width="1280" height="720" alt="image"
src="https://github.com/user-attachments/assets/c86bc532-4272-40fb-8bc4-f7aafac6a63f"
/>

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2026-06-15 14:55:38 +01:00
GiGaGonandMicha Reiser f83d66918f [ty] Make playground header say ty and add docs href (#24759)
## Summary

Fixes astral-sh/ty#2672

Also includes adding the href to the ty docs to the logo.

New look:

<img width="186" height="121" alt="image"
src="https://github.com/user-attachments/assets/a24a08dc-bced-4fad-87c0-d0a614d7d4b0"
/>

Done by hand in an [SVG
editor](https://yqnn.github.io/svg-path-editor/#P=M_64_10_H_37_V_0_H_5_V_10_H_0_V_35_H_5_V_54_C_5_59_10_64_16_64_H_64_V_40_H_37_V_35_H_54_C_59_35_64_30_64_24_V_10_Z_M_99_10_H_104_V_0_H_133_V_54_C_133_59_128_64_122_64_h_-53_V_40_H_101_V_35_H_79_C_74_35_69_30_69_24_V_0_H_99_Z),
so I'm not very confident in how the y looks. If anyone else knows the
process/font for how the other logos were made I would be happy to
change it.

## Test Plan

N/A playground change. Was tested locally by editing the HTML on the
playground page to match the new changes.

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2026-05-11 11:23:23 +00:00
Micha Reiser 038cf9e9ef Simplify the playground's markdown template (#24924) 2026-04-29 11:47:29 +02:00
Rob Hand 801cc9e210 [ty] Improve .toml support in the ty playground (#23476) 2026-03-17 08:54:23 +01:00
Rob HandandMicha Reiser 08a3a224b2 [ty] Add Download button to ty playground which creates a zip export (#23478)
Co-authored-by: Micha Reiser <micha@reiser.io>
2026-03-13 12:18:10 +00:00
Rob HandandMicha Reiser 2e70459fd6 [ty] Add a Copy Markdown button to playground (#23002)
Co-authored-by: Micha Reiser <micha@reiser.io>
2026-03-13 10:52:23 +00:00
renovate[bot]andMicha Reiser f8f4ca8fbc Update dependency react-resizable-panels to v4 (#22279)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-12-30 11:04:25 +01:00
mahiroandMicha Reiser 85af715880 Fix playground Share button showing "Copied!" before clipboard copy completes (#21942)
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-12-17 12:16:01 +01:00
Micha Reiser 0520d11a66 [ty] Fix None, True and False highlighting in playground (#20994) 2025-10-20 19:25:08 +02:00
Micha Reiser 3926dd8424 [ty] Add semantic token provider to playground (#19232) 2025-07-10 07:50:28 +02:00
GiGaGon 170ccd80b4 [playground] Add ruff logo docs link to Header.tsx (#18947) 2025-06-26 08:54:45 +02:00
Micha Reiser 5d93d619f3 Use git-commit as ty playground version instead of 0.0.0 (#18314) 2025-05-26 11:55:11 +00:00
Carl MeyerandMicha Reiser 7b253100f8 switch the playground repo button to ty repo (#18228)
Co-authored-by: Micha Reiser <micha@reiser.io>
2025-05-21 06:35:13 +00:00
renovate[bot] 405544cc8f Update dependency react-resizable-panels to v3 (#18185)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-05-19 06:29:31 +00:00
Micha Reiser 9000eb3bfd Update favicon and URL for playground (#17860) 2025-05-06 10:51:45 +02:00
Micha Reiser 3dd6d0a422 [playground] Add Reset button (#17236)
## Summary

Add a *Reset* button to both Ruff's and Red Knot's playground that
resets the playground to its initial state.

Closes https://github.com/astral-sh/ruff/issues/17195

## Test Plan



https://github.com/user-attachments/assets/753cca19-155a-44b1-89ba-76744487a55d


https://github.com/user-attachments/assets/7d19f04c-70f4-4d9e-b745-0486cb1d4993
2025-04-06 17:09:56 +00:00
Micha Reiser 6b02c39321 [red-knot] Incorporate recent ruff server improvements into red knot's LSP (#17044) 2025-03-28 18:39:18 +00:00
Micha Reiser 43ca85a351 [red-knot] Add run panel (#17002)
## Summary

This PR adds a new secondary panel to the red knot playground that
allows running the python code (current file) with
[pyodide](https://pyodide.org/en/stable/index.html) (currently Python
3.12 only).



## Test Plan


https://github.com/user-attachments/assets/7bda8ef7-19fb-4c2f-8e62-8e49a1416be1
2025-03-26 21:32:07 +00:00
Micha Reiser f5cdf23545 [red-knot] Add settings support to playground (#16929)
## Summary

This PR extends the Red Knot playground by adding configuration support
by adding a `knot.json` file.

<img width="1679" alt="Screenshot 2025-03-23 at 21 12 16"
src="https://github.com/user-attachments/assets/81ff1588-a07a-4847-97d8-61250aa2feda"
/>
2025-03-24 01:38:48 +00:00
Micha Reiser a9f5dddbaa [playground] Use cursor for clickable elements (#16833) 2025-03-18 18:06:00 +01:00
Micha Reiser c027979851 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~~
2025-03-18 17:17:11 +01:00
Micha Reiser ded9c69888 [playground] Extract shared components (#16819)
## Summary
Extract components that can be shared with the Red Knot playground.

## Test Plan

`npm start`
2025-03-18 08:43:47 +01:00