Skip to content

Playground v2: multi-file CodeMirror editor, fls diagnostics, real bug fixes - #196

Merged
omdxp merged 10 commits into
mainfrom
playground-v2-lsp-editor
Oct 6, 2026
Merged

omdxp merged 10 commits into
mainfrom
playground-v2-lsp-editor

Conversation

@omdxp

@omdxp omdxp commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Fixed a real compiler regression: async main's shadow-renamed C entry point got a bogus conflicting prototype, breaking every async fun main() program (native, not just the website).
  • Fixed the runnable code block's cursor-desync bug (manual resize let the overlay and textarea drift apart) and replaced the "Runnable Example" title bars with a floating hover toolbar, a line-number gutter, and auto-growing height.
  • Fixed edited-code compile errors silently falling through to a generic "no backend" message instead of showing the real C compiler output.
  • The Playground's wasm modules now load eagerly on page idle instead of the first click, with content-hash cache-busting per release.
  • Consolidated the Playground from a flat list of per-sample run blocks into one multi-file project: a real file tree (add/rename-entry/delete), CodeMirror 6 editing with Fun syntax highlighting, and a compile pipeline that mounts every project file so cross-file imports resolve.
  • The Playground editor now uses this project's own Fun Web/Fun Web Light color theme instead of CodeMirror's generic default.
  • Wired real fls language server features into the editor, all through a generalized, protocol-agnostic wasm entry point (wasm_fls_main.fn replays any sequence of raw LSP messages, reload-per-call - see docs/platforms.md for why not a persistent server):
    • Diagnostics, debounced, theme-aware, falls back silently on any failure.
    • Hover - a symbol's signature on mouseover.
    • Completion - real suggestions from fls's own analysis of the open document.
    • Signature help - a call's parameter list while typing inside its parens.
    • Goto-definition - Cmd/Ctrl+click (or F12/Alt-D), including across project files.
  • Audited the docs' runnable example corpus for staleness; found none beyond intentional non-standalone fragments and error-demonstration snippets.

Test plan

  • fun test . - 56/56 test files pass (native rebuild with the async-main fix and the generalized fls wasm entry point)
  • scripts/run_examples.sh - no new failures (2 pre-existing environmental flakes: local OpenSSL arch mismatch, documented BitInt flake)
  • vscode extension smoke test - 9/9 pass (1 skipped, no VS Code host available)
  • Every examples/advanced/async_*/channel_async_composed.fn example compiles and runs correctly with the async-main fix
  • Real production build (vite build) served under /fun/ with real COI headers - multi-file sample run, new-file creation, and live diagnostics all verified end to end, zero console errors, zero failed requests
  • Both light and dark themes verified for the new editor, lint gutter, diagnostic underlines, and the Fun Web/Fun Web Light syntax colors
  • Hover, completion, signature help, and both same-file and cross-file goto-definition each verified with real wasm fls round trips in a real browser (not assumed from the response shape)

omdxp added 10 commits October 6, 2026 08:27
Compared the C-shadowed name against literal "main" instead of the
real Fun-level name, so it never matched and emitted a bogus prototype.
Resize let the overlay and textarea drift apart, misplacing the
caret. Auto-growing grid overlap, line numbers, floating toolbar.
The clang-rejected throw wasn't a FunCompileError, so it fell through
to the generic no-backend message instead of showing what failed.
Warms both modules on page idle instead of the first Run click, and
hashes the frontend artifact so a new release busts stale caches.
…ror block

Real file tree, CodeMirror 6 editing, and a compile pipeline that
mounts every project file so cross-file imports resolve.
pub handle(), and a settable ImportCache.parallel_preload (the fork
pool can't start in a browser sandbox) so a non-stdio embedder works.
Debounced CodeMirror linter backed by the new wasm_fls_main module,
themed for both light and dark, plus the matching prebake/CI step.
Protocol-agnostic now - a JSON array of raw message bodies in, every
response/notification out, instead of hardcoded to didOpen alone.
CodeMirror was using its own generic default style instead of this
project's actual fun-web-color-theme.json/fun-web-light colors.
… help

Real fls features now, not just diagnostics. Also fixes lint tooltip
CSS that never matched since CodeMirror mounts tooltips on body.
@omdxp
omdxp merged commit b4ff623 into main Oct 6, 2026
4 checks passed
@omdxp
omdxp deleted the playground-v2-lsp-editor branch October 6, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant