webview: Add inspector feature to enable WebView developer tools (#1564)

This commit is contained in:
ihavecoke 2025-11-12 11:11:18 +08:00 committed by GitHub
parent a185d8ed24
commit 838fd6411a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 9 deletions

View file

@ -1,32 +1,38 @@
[package]
name = "story"
edition = "2024"
name = "story"
publish = false
version = "0.4.0-preview1"
[features]
inspector = ["gpui-component/inspector"]
[dependencies]
anyhow.workspace = true
gpui.workspace = true
gpui-component = { workspace = true, features = ["webview", "tree-sitter-languages"] }
gpui-component = { workspace = true, features = [
"tree-sitter-languages",
"webview",
] }
reqwest_client = { path = "../reqwest_client" }
autocorrect = "2.14.2"
chrono = "0.4"
color-lsp = "0.2.0"
fake = { version = "2.10.0", features = ["dummy"] }
itertools = "0.14.0"
lsp-types.workspace = true
rand = "0.8"
raw-window-handle = { version = "0.6", features = ["std"] }
regex = "1"
smol.workspace = true
rust-embed = { version = "8.7.2", features = ["interpolate-folder-path"] }
serde = "1"
serde_json = "1"
unindent = "0.2.3"
smol.workspace = true
tracing.workspace = true
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
tree-sitter-navi = "0.2.2"
itertools = "0.14.0"
lsp-types.workspace = true
autocorrect = "2.14.2"
color-lsp = "0.2.0"
unindent = "0.2.3"
[target.'cfg(target_os = "linux")'.dependencies]
gtk = { version = "0.18" }

View file

@ -44,6 +44,9 @@ impl WebViewStory {
let webview = cx.new(|cx| {
let builder = wry::WebViewBuilder::new();
#[cfg(any(debug_assertions, feature = "inspector"))]
let builder = builder.with_devtools(true);
#[cfg(not(any(
target_os = "windows",
target_os = "macos",

View file

@ -16,8 +16,9 @@ doctest = false
[features]
decimal = ["dep:rust_decimal"]
inspector = ["gpui/inspector"]
inspector = ["gpui/inspector", "wry/devtools"]
webview = ["dep:wry"]
# For syntax highlighting in Markdown and CodeEditor.
tree-sitter-languages = [
"dep:tree-sitter-bash",