feat: add initial support web via wasm (#35)

Reviewed-on: #35
This commit was merged in pull request #35.
This commit is contained in:
2026-07-25 03:43:51 +00:00
parent 4b57a1d2a6
commit b518c729f6
57 changed files with 1550 additions and 1463 deletions

View File

@@ -9,9 +9,7 @@ common = { path = "../common" }
theme = { path = "../theme" }
gpui.workspace = true
smol.workspace = true
serde.workspace = true
serde_json.workspace = true
smallvec.workspace = true
anyhow.workspace = true
itertools.workspace = true
@@ -20,8 +18,10 @@ log.workspace = true
unicode-segmentation = "1.12.0"
uuid = "1.10"
regex = "1"
image = "0.25.1"
lsp-types = "0.97.0"
ropey = { version = "=2.0.0-beta.1", features = ["metric_lines_lf", "metric_utf16"] }
sum_tree = { git = "https://github.com/zed-industries/zed" }
tree-sitter = "0.26"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
smol.workspace = true

View File

@@ -2,15 +2,15 @@ use std::rc::Rc;
use gpui::prelude::FluentBuilder as _;
use gpui::{
div, relative, AnyElement, App, ClickEvent, Div, ElementId, Hsla, InteractiveElement,
IntoElement, ParentElement, RenderOnce, SharedString, Stateful,
StatefulInteractiveElement as _, StyleRefinement, Styled, Window,
AnyElement, App, ClickEvent, Div, ElementId, Hsla, InteractiveElement, IntoElement,
ParentElement, RenderOnce, SharedString, Stateful, StatefulInteractiveElement as _,
StyleRefinement, Styled, Window, div, relative,
};
use theme::ActiveTheme;
use crate::indicator::Indicator;
use crate::tooltip::Tooltip;
use crate::{h_flex, Disableable, Icon, IconName, Selectable, Sizable, Size, StyledExt};
use crate::{Disableable, Icon, IconName, Selectable, Sizable, Size, StyledExt, h_flex};
#[derive(Clone, Copy, PartialEq, Eq)]
pub struct ButtonCustomVariant {
@@ -617,7 +617,7 @@ impl ButtonVariant {
};
let fg = match self {
ButtonVariant::Primary => cx.theme().text_muted, // TODO: use a different color?
ButtonVariant::Primary => cx.theme().text_muted,
_ => cx.theme().text_muted,
};

View File

@@ -14,9 +14,9 @@ use super::folding::FoldRange;
use super::text_wrapper::{LineItem, WrapDisplayPoint};
use super::wrap_map::WrapMap;
use super::{BufferPoint, DisplayPoint};
use crate::input::Point as TreeSitterPoint;
use crate::input::display_map::WrapPoint;
use crate::input::rope_ext::RopeExt as _;
use crate::input::Point as TreeSitterPoint;
/// DisplayMap is the main interface for Editor/Input coordinate mapping.
///
@@ -269,10 +269,7 @@ impl DisplayMap {
/// Convert wrap display point to TreeSitterPoint (buffer line/col).
#[inline]
pub(crate) fn wrap_display_point_to_point(
&self,
point: WrapDisplayPoint,
) -> TreeSitterPoint {
pub(crate) fn wrap_display_point_to_point(&self, point: WrapDisplayPoint) -> TreeSitterPoint {
self.wrap_map.wrapper().display_point_to_point(point)
}

View File

@@ -9,7 +9,6 @@ use gpui::{
SharedString, StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task,
UniformListScrollHandle, Window, div, px, size, uniform_list,
};
use smol::Timer;
use theme::ActiveTheme;
use crate::actions::{Cancel, Confirm, SelectDown, SelectUp};
@@ -265,6 +264,7 @@ where
}
self.set_searching(true, window, cx);
let search = self.delegate.perform_search(&text, window, cx);
if self.rows_cache.len() > 0 {
@@ -273,6 +273,7 @@ where
self._set_selected_index(None, window, cx);
}
let executor = cx.background_executor().clone();
self._search_task = cx.spawn_in(window, async move |this, window| {
search.await;
@@ -282,7 +283,8 @@ where
});
// Always wait 100ms to avoid flicker
Timer::after(Duration::from_millis(100)).await;
executor.timer(Duration::from_millis(100)).await;
_ = this.update_in(window, |this, window, cx| {
this.set_searching(false, window, cx);
});