lsp: Fix 'Start with Hello World!' panic in SlintPad#11419
Open
lsp: Fix 'Start with Hello World!' panic in SlintPad#11419
Conversation
…anic Reproduces #11416: clicking the "Start with Hello World!" code lens on an empty buffer panics the wasm LSP because the slint/populate handler calls tokio::task::spawn_local outside of a LocalSet.
8dc3a68 to
0c24847
Compare
ogoffart
approved these changes
Apr 17, 2026
Member
ogoffart
left a comment
There was a problem hiding this comment.
The way i've done it before would be to just call
crate::spawn_local(...) and have one implementation in wasm_main.rs and one in main.rs. But i get that this is conflicting with leon's change to put the lsp in a library with several runner.
ogoffart
reviewed
Apr 17, 2026
Member
ogoffart
left a comment
There was a problem hiding this comment.
I like you started to use disallowed-methods
The slint/populate command handler called tokio::task::spawn_local, which panics in the wasm LSP because no tokio LocalSet is installed there (only native's main loop sets one up). Introduce a `common::spawn_local` wrapper that routes to `wasm_bindgen_futures::spawn_local` on wasm and `tokio::task::spawn_local` on native, and forbid bare `tokio::task::spawn_local` in the lsp crate via a clippy.toml disallowed-methods entry plus a crate-local `#![deny(clippy::disallowed_methods)]` on the entry points. Fixes #11416.
c7e9fac to
72d4e07
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The slint/populate command handler called tokio::task::spawn_local, which
panics in the wasm LSP because no tokio LocalSet is installed there (only
native's main loop sets one up).
Introduce a
common::spawn_localwrapper that routes towasm_bindgen_futures::spawn_localon wasm andtokio::task::spawn_localon native, and forbid bare
tokio::task::spawn_localin the lsp crate viaa clippy.toml disallowed-methods entry plus a crate-local
#![deny(clippy::disallowed_methods)]on the entry points.Fixes #11416.