id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_507000 | rust_dataset.txt | 507,000 | 512 | : &mut Window,
cx: &mut App,
) -> Pixels {
Self::keybinding(keystrokes, cx)
.into_any_element()
.layout_as_root(
size(AvailableSpace::MaxContent, AvailableSpace::MaxContent),
window,
cx,
)
.width
}
... |
rust_dataset_chunk_507001 | rust_dataset.txt | 507,001 | 512 | .map(|text| Self::label_width(text, window, cx))
.fold(px(0.), Pixels::max);
// `px_2` on both sides, the `gap_2` between columns, and the panel's 1px borders.
let horizontal_chrome = rems(1.5).to_pixels(rem_size) + px(2.);
let key_column_limit = (self.max_width - horizon... |
rust_dataset_chunk_507002 | rust_dataset.txt | 507,002 | 512 | key_column_width,
cx,
)),
)
.child(
Label::new(HEADER_LABEL)
.size(LabelSize::Small)
.color(Color::Muted)
.sing... |
rust_dataset_chunk_507003 | rust_dataset.txt | 507,003 | 512 | _vim_style(cx: &mut TestAppContext) {
let cx = cx.add_empty_window();
cx.update(|window, cx| {
// Toggle Vim notation on and back off to catch stale formatting after a mode change.
for vim_mode in [false, true, false] {
ui::KeyBinding::set_vim_mode(cx, vim_mode);
... |
rust_dataset_chunk_507004 | rust_dataset.txt | 507,004 | 512 | rokes.as_ref(), std::slice::from_ref(&keystroke));
assert_eq!(row.is_group, grouped);
#[cfg(target_os = "windows")]
assert_eq!(
text_for_keybinding_keystrokes(&row.keystrokes, cx),
"Ctrl-Shift-4"
);
}
}
#[test]
fn test_... |
rust_dataset_chunk_507005 | rust_dataset.txt | 507,005 | 512 | ::parse("Workspace")
.expect("valid context")
.into(),
),
true,
None,
cx,
)
.expect("user binding with key equivalents")
.with_meta(Keyb... |
rust_dataset_chunk_507006 | rust_dataset.txt | 507,006 | 512 | // These default macOS chords both follow cmd-k. Key-label length takes
// precedence over alphabetical key order: "Z" comes before "Command-Left".
let rows = prepare_pending_bindings(
vec![
binding_after_first_keystroke("cmd-k cmd-left", "workspace::ActivatePaneLeft"),
... |
rust_dataset_chunk_507007 | rust_dataset.txt | 507,007 | 512 | (&second.remaining_keystrokes, cx),
);
if reverse {
bindings.reverse();
}
let rows = prepare_pending_bindings(bindings, cx);
let mut action_names = rows
.iter()
.map(|row| row.action_name.as_ref())
... |
rust_dataset_chunk_507008 | rust_dataset.txt | 507,008 | 512 | roke("cmd-k z b", "theme_selector::Toggle"),
],
cx,
);
assert_eq!(
rows.iter()
.map(|row| (
row.keystrokes.to_vec(),
row.action_name.as_ref(),
row.is_group,
))
... |
rust_dataset_chunk_507009 | rust_dataset.txt | 507,009 | 512 | -k").expect("valid keystroke"),
Keystroke::parse("cmd-s").expect("valid keystroke"),
];
let (matches, _) = keymap.bindings_for_input(&input, &contexts);
let first_match = matches.first().expect("matching binding");
assert_eq!(
first_match.action().name(),
... |
rust_dataset_chunk_507010 | rust_dataset.txt | 507,010 | 512 | vim_mode_setting::{HelixModeSetting, VimModeSetting};
use workspace::{HideStatusItem, StatusBarSettings, StatusItemView, item::ItemHandle};
use crate::{
ShowPendingBindings, bindings_for_pending_input, map_pending_keystrokes,
pending_bindings::{PendingBindingRow, PendingBindings, prepare_pending_bindings},
... |
rust_dataset_chunk_507011 | rust_dataset.txt | 507,011 | 512 | _over = false;
this.popover.visible = false;
this.popover.opened_by_keyboard = false;
this.popover.hide_task.take();
}
if this.refresh_render_state(window, cx) {
cx.notify();
}
... |
rust_dataset_chunk_507012 | rust_dataset.txt | 507,012 | 512 | = self.pending_input_generation.wrapping_add(1);
self.render_state = Some(Rc::new(IndicatorRenderState {
keystrokes: keystrokes.into(),
pending_input_generation: self.pending_input_generation,
bindings: bindings.into(),
timeout: pending_input.timeout().map(|timeo... |
rust_dataset_chunk_507013 | rust_dataset.txt | 507,013 | 512 | , |this, window, cx| {
this.popover.hide_task.take();
if this.popover.is_pointer_over() {
return;
}
this.popover.visible = false;
window.set_pending_input_timeout_paused(&cx.entity(), false, cx);... |
rust_dataset_chunk_507014 | rust_dataset.txt | 507,014 | 512 | });
}
let button = ButtonLike::new("pending-keystrokes-indicator")
.on_click(|_, window, cx| {
window.dispatch_action(zed_actions::dev::OpenKeyContextView.boxed_clone(), cx);
})
.when_some(render_state.timeout.as_ref(), |button, timeout| {
... |
rust_dataset_chunk_507015 | rust_dataset.txt | 507,015 | 512 | .child(
div()
.id("pending-keystrokes-popover")
.debug_selector(|| "PENDING_KEYSTROKES_POPOVER".into())
.pb_2()
.occlude()
.on_hover(cx.listener(|this, poi... |
rust_dataset_chunk_507016 | rust_dataset.txt | 507,016 | 512 | ::*;
use command_palette::humanize_action_name;
use gpui::{
Bounds, Entity, FocusHandle, InputHandler, KeyBinding, KeyDownEvent, Keystroke, Modifiers,
Pixels, PlatformInput, Point, TestAppContext, UTF16Selection, VisualTestContext, actions,
canvas, point,
};
actions!(
pe... |
rust_dataset_chunk_507017 | rust_dataset.txt | 507,017 | 512 | App,
) -> Option<UTF16Selection> {
None
}
fn marked_text_range(&mut self, _: &mut Window, _: &mut App) -> Option<Range<usize>> {
None
}
fn text_for_range(
&mut self,
_: Range<usize>,
_: &mut Option<Range<usize>>,
... |
rust_dataset_chunk_507018 | rust_dataset.txt | 507,018 | 512 | .map(|keystroke| {
keystroke.inner().unparse(gpui::OperatingSystem::Mac)
})
.collect(),
binding.action_name.to_string(),
)
})
.... |
rust_dataset_chunk_507019 | rust_dataset.txt | 507,019 | 512 | popover_bounds = cx
.debug_bounds("PENDING_KEYSTROKES_POPOVER")
.expect("rendered pending keystrokes popover");
cx.simulate_mouse_move(popover_bounds.center(), None, Modifiers::none());
}
fn move_pointer_outside(cx: &mut VisualTestContext) {
let outside = cx.update(|win... |
rust_dataset_chunk_507020 | rust_dataset.txt | 507,020 | 512 | .child(canvas(
|_, _, _| {},
move |_, _, window, cx| {
window.handle_input(&focus_handle, TestInputHandler(input_text), cx);
},
))
})
.on_action(|_: &ShorterBinding, _,... |
rust_dataset_chunk_507021 | rust_dataset.txt | 507,021 | 512 | counted_bindings(["j k"])
.into_iter()
.chain([binding("ctrl-alt-a", ShowPendingBindings)]),
);
let text = Rc::new(RefCell::new(String::new()));
cx.update(|window, cx| {
window
.root::<TestVie... |
rust_dataset_chunk_507022 | rust_dataset.txt | 507,022 | 512 | let (_, action_count, cx) = setup_indicator_test(
cx,
counted_bindings(["ctrl-b alt-/"])
.into_iter()
.chain([binding("alt-/", gpui::NoAction)]),
);
cx.simulate_keystrokes("ctrl-b alt-/");
cx.run_until_parked();
assert_eq!(action_c... |
rust_dataset_chunk_507023 | rust_dataset.txt | 507,023 | 512 | );
move_pointer_outside(cx);
cx.simulate_keystrokes("alt-/");
advance_past_pending_timeout(cx);
assert!(popover_rendered(cx));
assert_eq!(action_count.get(), 0);
// The popover follows the chord as it advances, keeping the timeout paused.
cx.simulate_keystrokes("... |
rust_dataset_chunk_507024 | rust_dataset.txt | 507,024 | 512 | keystroke| keystroke.unparse(gpui::OperatingSystem::Mac))
.collect::<Vec<_>>(),
["ctrl-b"]
);
assert_eq!(window_timeout_paused(cx), Some(true));
assert!(indicator.read_with(cx, |indicator, _| indicator.popover.opened_by_keyboard));
advance_past_pending_timeou... |
rust_dataset_chunk_507025 | rust_dataset.txt | 507,025 | 512 | );
}
#[gpui::test]
fn test_keyboard_popover_can_use_a_standalone_modifier_shortcut(cx: &mut TestAppContext) {
let (indicator, action_count, cx) = setup_indicator_test(
cx,
counted_bindings(["ctrl-b", "ctrl-b h"])
.into_iter()
.chain([binding("... |
rust_dataset_chunk_507026 | rust_dataset.txt | 507,026 | 512 | , _, cx) = setup_indicator_test(cx, timed_bindings());
cx.simulate_keystrokes("ctrl-b alt-/");
cx.run_until_parked();
assert!(second_indicator.read_with(cx, |indicator, _| indicator.popover.visible));
first_indicator.read_with(cx, |indicator, _| {
assert!(indicator.render_st... |
rust_dataset_chunk_507027 | rust_dataset.txt | 507,027 | 512 | // so this is the only case that relies on the popover.
let (indicator, _, cx) = setup_indicator_test(
cx,
[
binding("ctrl-b h", ShorterBinding),
binding("ctrl-b h j", LongerBinding),
],
);
cx.simulate_keystrokes("ctrl-b alt-/... |
rust_dataset_chunk_507028 | rust_dataset.txt | 507,028 | 512 | alt-/");
cx.run_until_parked();
assert!(!popover_rendered(cx));
// Re-enabling the popover mid-chord makes the shortcut work again.
cx.simulate_keystrokes("ctrl-b");
set_user_settings(cx, "{}");
cx.simulate_keystrokes("alt-/");
cx.run... |
rust_dataset_chunk_507029 | rust_dataset.txt | 507,029 | 512 | ", ShorterBinding, Some("PendingKeystrokesIndicatorTest")),
KeyBinding::new("g j", LongerBinding, Some("PendingKeystrokesIndicatorTest")),
],
);
cx.simulate_keystrokes("g");
cx.run_until_parked();
cx.update(|window, _| {
let pending_keystrokes = ... |
rust_dataset_chunk_507030 | rust_dataset.txt | 507,030 | 512 | .expect("pending input timeout");
assert!(timeout.is_paused());
});
move_pointer_outside(cx);
cx.run_until_parked();
cx.update(|window, _| {
let timeout = window
.pending_input()
.and_then(|pending_input| pending_input.timeout())
... |
rust_dataset_chunk_507031 | rust_dataset.txt | 507,031 | 512 | (cx: &mut TestAppContext) {
let (indicator, _, cx) = setup_indicator_test(cx, nested_timed_bindings());
start_pending_input_and_hover_indicator(cx);
move_pointer_over_popover(cx);
let handoff_render_state = indicator
.read_with(cx, |indicator, _| indicator_snapshot(indicator... |
rust_dataset_chunk_507032 | rust_dataset.txt | 507,032 | 512 | #[gpui::test]
fn test_hover_pauses_timeout_when_untimed_input_becomes_timed(cx: &mut TestAppContext) {
let (indicator, _, cx) =
setup_indicator_test(cx, nested_timed_bindings().into_iter().skip(1));
start_pending_input_and_hover_indicator(cx);
move_pointer_over_popover(cx);
... |
rust_dataset_chunk_507033 | rust_dataset.txt | 507,033 | 512 | initial prefix has no timeout. Pressing h creates one
// because ctrl-b h is both a complete binding and a prefix of ctrl-b h j.
assert_chord_progress_dismisses_popover(cx, nested_timed_bindings().into_iter().skip(1));
}
fn assert_chord_progress_dismisses_popover(
cx: &mut TestAppConte... |
rust_dataset_chunk_507034 | rust_dataset.txt | 507,034 | 512 | TestAppContext) {
let (indicator, _, cx) = setup_indicator_test(cx, nested_timed_bindings());
start_popover_dismissal(cx);
cx.executor().advance_clock(Duration::from_millis(100));
cx.run_until_parked();
// Trigger notifications without changing the pending keys. They must neit... |
rust_dataset_chunk_507035 | rust_dataset.txt | 507,035 | 512 | ui::test]
fn test_disabling_indicator_releases_timeout_pause(cx: &mut TestAppContext) {
let (indicator, _, cx) = setup_indicator_test(cx, timed_bindings());
cx.simulate_keystrokes("ctrl-b");
cx.run_until_parked();
let indicator_bounds = cx
.debug_bounds("PENDING_KEYSTROK... |
rust_dataset_chunk_507036 | rust_dataset.txt | 507,036 | 512 | .
let snapshot = indicator
.read_with(cx, |indicator, _| {
assert!(
indicator
.render_state()
.expect("pending input")
.timeout
.is_none()
);
... |
rust_dataset_chunk_507037 | rust_dataset.txt | 507,037 | 512 | {
// Keep focus where it currently is
let focus_handle = window.focused(cx).unwrap_or(cx.focus_handle());
let handle = cx.weak_entity();
let mut this = Self {
_workspace: workspace,
focus_handle: focus_handle.clone(),
scroll_handle: ScrollHandle::new... |
rust_dataset_chunk_507038 | rust_dataset.txt | 507,038 | 512 | (px(0.));
let margin_bottom = px(16.);
let bottom_offset = margin_bottom + status_height;
div()
.id("which-key-buffer-panel-scroll")
.occlude()
.absolute()
.bottom(bottom_offset)
.right(px(16.))
.min_w(px(220.))
... |
rust_dataset_chunk_507039 | rust_dataset.txt | 507,039 | 512 | rokes: &[Keystroke],
) -> Vec<PendingBinding> {
collect_bindings_for_pending_input(window, pending_keystrokes, |_| true)
}
pub(crate) fn bindings_for_which_key(
window: &Window,
pending_keystrokes: &[Keystroke],
) -> Vec<PendingBinding> {
collect_bindings_for_pending_input(window, pending_keystrokes, |... |
rust_dataset_chunk_507040 | rust_dataset.txt | 507,040 | 512 | ;
};
let mut timer = None;
cx.observe_pending_input(window, move |multi_workspace, window, cx| {
if window.pending_input_keystrokes().is_none() {
multi_workspace.set_pending_bindings_popup(None, cx);
timer.take();
return;
}
... |
rust_dataset_chunk_507041 | rust_dataset.txt | 507,041 | 512 | s
.split(' ')
.map(|keystroke_str| Keystroke::parse(keystroke_str))
.collect();
keystrokes.ok()
})
.collect()
});
#[cfg(test)]
mod tests {
use std::cell::Cell;
use collections::HashMap;
use gpui::{
BorrowAppContext, Context, Entity, EventEmitter... |
rust_dataset_chunk_507042 | rust_dataset.txt | 507,042 | 512 | ");
}
let expected_display_text = if cfg!(target_os = "windows") {
"Ctrl-Shift-2"
} else if cfg!(any(target_os = "linux", target_os = "freebsd")) {
"Ctrl-@"
} else {
"Control-@"
};
assert_eq!(
ui::text_for_keybinding_keystr... |
rust_dataset_chunk_507043 | rust_dataset.txt | 507,043 | 512 | settings");
});
cx.bind_keys([KeyBinding::new("ctrl-k ctrl-x", TestChordAction, None)]);
app_state
});
let project = project::Project::test(app_state.fs.clone(), [], cx).await;
cx.add_window_view(|window, cx| MultiWorkspace::test_new(project.clone(), window, ... |
rust_dataset_chunk_507044 | rust_dataset.txt | 507,044 | 512 | async fn test_keystroke_without_pending_chord_does_not_notify(cx: &mut TestAppContext) {
let (multi_workspace, cx) = init_workspace_test(cx).await;
let notify_count = std::rc::Rc::new(Cell::new(0));
let _subscription = cx.update(|_, cx| {
let notify_count = notify_count.clone();
... |
rust_dataset_chunk_507045 | rust_dataset.txt | 507,045 | 512 | {
metadata.push('.');
metadata.push_str(build_id);
}
if let Some(sha) = &commit_sha {
metadata.push('.');
metadata.push_str(sha);
}
format!("{pkg_version}+{metadata}")
}
const ICON_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../zed/resources/windows");
const MANI... |
rust_dataset_chunk_507046 | rust_dataset.txt | 507,046 | 512 | r#"#pragma code_page(65001)
1 ICON "{icon_escaped}"
{manifest_line}
1 VERSIONINFO
FILEVERSION {file_version}
PRODUCTVERSION {file_version}
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
... |
rust_dataset_chunk_507047 | rust_dataset.txt | 507,047 | 512 | }
}
impl Render for ActiveFileName {
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
if !StatusBarSettings::get_global(cx).show_active_file {
return Empty.into_any_element();
}
let Some(project_path) = self.project_path.clone() else ... |
rust_dataset_chunk_507048 | rust_dataset.txt | 507,048 | 512 | StyleRefinement, Styled, Subscription, WeakEntity, Window, deferred, div,
px,
};
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore, TerminalDockPosition};
use std::sync::Arc;
use ui::{
ContextMenu, CountBadge, Divider, DividerColor, IconButton, Tooltip, prelude::*,
right_click_men... |
rust_dataset_chunk_507049 | rust_dataset.txt | 507,049 | 512 | ,
_flexible: bool,
_window: &mut Window,
_cx: &mut Context<Self>,
) {
}
fn icon(&self, window: &Window, cx: &App) -> Option<ui::IconName>;
fn icon_tooltip(&self, window: &Window, cx: &App) -> Option<&'static str>;
fn toggle_action(&self) -> Box<dyn Action>;
fn icon_label(... |
rust_dataset_chunk_507050 | rust_dataset.txt | 507,050 | 512 | bool, window: &mut Window, cx: &mut App);
fn set_active(&self, active: bool, window: &mut Window, cx: &mut App);
fn remote_id(&self) -> Option<proto::PanelId>;
fn pane(&self, cx: &App) -> Option<Entity<Pane>>;
fn default_size(&self, window: &Window, cx: &App) -> Pixels;
fn min_size(&self, window: &... |
rust_dataset_chunk_507051 | rust_dataset.txt | 507,051 | 512 | 1)
.unwrap_or(DockPosition::Left);
self.set_position(next_position, window, cx);
}
}
impl<T> PanelHandle for Entity<T>
where
T: Panel,
{
fn panel_id(&self) -> EntityId {
Entity::entity_id(self)
}
fn persistent_name(&self) -> &'static str {
T::persistent_name()
... |
rust_dataset_chunk_507052 | rust_dataset.txt | 507,052 | 512 | , cx: &mut App) {
self.update(cx, |this, cx| this.size_state_changed(window, cx))
}
fn supports_flexible_size(&self, cx: &App) -> bool {
self.read(cx).supports_flexible_size()
}
fn has_flexible_size(&self, window: &Window, cx: &App) -> bool {
self.read(cx).has_flexible_size(win... |
rust_dataset_chunk_507053 | rust_dataset.txt | 507,053 | 512 | Dock {
position: DockPosition,
panel_entries: Vec<PanelEntry>,
workspace: WeakEntity<Workspace>,
is_open: bool,
active_panel_index: Option<usize>,
focus_handle: FocusHandle,
restoration: DockRestoreState,
zoom_layer_open: bool,
modal_layer: Entity<ModalLayer>,
_subscriptions: [S... |
rust_dataset_chunk_507054 | rust_dataset.txt | 507,054 | 512 | ::Right => Axis::Horizontal,
Self::Bottom => Axis::Vertical,
}
}
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct PanelSizeState {
pub size: Option<Pixels>,
#[serde(default)]
pub flex: Option<f32>,
}
struct PanelEntry {
panel: Arc<dyn Panel... |
rust_dataset_chunk_507055 | rust_dataset.txt | 507,055 | 512 | ::ZoomChanged) {
let is_zoomed = workspace.read(cx).zoomed.is_some();
dock.zoom_layer_open = is_zoomed;
}
});
Self {
position,
workspace: workspace.downgrade(),
panel_entries: Default::default... |
rust_dataset_chunk_507056 | rust_dataset.txt | 507,056 | 512 | .find_map(|entry| entry.panel.to_any().downcast().ok())
}
pub fn panel_index_for_type<T: Panel>(&self) -> Option<usize> {
self.panel_entries
.iter()
.position(|entry| entry.panel.to_any().downcast::<T>().is_ok())
}
pub fn panel_index_for_persistent_name(&sel... |
rust_dataset_chunk_507057 | rust_dataset.txt | 507,057 | 512 | _panel) = self.active_panel_entry() {
active_panel.panel.set_active(open, window, cx);
}
cx.notify();
}
}
pub fn set_panel_zoomed(
&mut self,
panel: &AnyView,
zoomed: bool,
window: &mut Window,
cx: &mut Context<Self>,
... |
rust_dataset_chunk_507058 | rust_dataset.txt | 507,058 | 512 | .visible_panel()
.is_some_and(|active_panel| active_panel.panel_id() == panel_id);
let size_state = this
.panel_entries
.iter()
.find(|entry| entry.panel.panel_id() == panel_id)
... |
rust_dataset_chunk_507059 | rust_dataset.txt | 507,059 | 512 | ).contains_focused(window, cx)
{
window.focus(&panel.read(cx).activation_focus_handle(cx), cx);
}
workspace
.update(cx, |workspace, cx| {
workspace.zoomed = Som... |
rust_dataset_chunk_507060 | rust_dataset.txt | 507,060 | 512 | _state,
_subscriptions: subscriptions,
},
);
self.replay_pending_serialized_state(window, cx);
if panel.read(cx).starts_open(window, cx) {
self.activate_panel_internal(index, window, cx);
self.set_open_internal(true, window, cx);
}
... |
rust_dataset_chunk_507061 | rust_dataset.txt | 507,061 | 512 | }
self.set_open_internal(serialized.visible, window, cx);
}
pub(crate) fn finish_restoration(&mut self) {
self.restoration = DockRestoreState::Finished;
}
pub fn remove_panel<T: Panel>(
&mut self,
panel: &Entity<T>,
window: &mut Window,
cx: &mut Context... |
rust_dataset_chunk_507062 | rust_dataset.txt | 507,062 | 512 | _entry.panel)
}
fn visible_entry(&self) -> Option<&PanelEntry> {
if self.is_open {
self.active_panel_entry()
} else {
None
}
}
pub fn zoomed_panel(&self, window: &Window, cx: &App) -> Option<Arc<dyn PanelHandle>> {
let entry = self.visible_entry(... |
rust_dataset_chunk_507063 | rust_dataset.txt | 507,063 | 512 | mut self,
panel: &dyn PanelHandle,
size_state: PanelSizeState,
cx: &mut Context<Self>,
) -> bool {
if let Some(entry) = self
.panel_entries
.iter_mut()
.find(|entry| entry.panel.panel_id() == panel.panel_id())
{
entry.size_state... |
rust_dataset_chunk_507064 | rust_dataset.txt | 507,064 | 512 | }
/// Resizes the active panel and, when this dock is included in
/// `resize_all_panels_in_dock`, all panels using the same sizing mode.
pub fn resize_panel_sizes(
&mut self,
size: Option<Pixels>,
flex: Option<f32>,
window: &mut Window,
cx: &mut Context<Self>,
... |
rust_dataset_chunk_507065 | rust_dataset.txt | 507,065 | 512 | };
panel_uses_flexible_width(self.position, active_entry.panel.as_ref(), window, cx)
};
let mut size_states_to_persist = Vec::new();
for entry in &mut self.panel_entries {
if panel_uses_flexible_width(self.position, entry.panel.as_ref(), window, cx)
== ac... |
rust_dataset_chunk_507066 | rust_dataset.txt | 507,066 | 512 | cx: &App,
) -> Option<PanelSizeState> {
let workspace_id = workspace
.database_id()
.map(|id| i64::from(id).to_string())
.or(workspace.session_id())?;
let kvp = KeyValueStore::global(cx);
let scope = kvp.scoped(PANEL_SIZE_STATE_KEY);
scope
... |
rust_dataset_chunk_507067 | rust_dataset.txt | 507,067 | 512 | left(-RESIZE_HANDLE_SIZE / 2.)
.h_full()
.w(RESIZE_HANDLE_SIZE)
.cursor_col_resize(),
),
}
};
div()
.id("dock-panel")
.key_context(dispatch_con... |
rust_dataset_chunk_507068 | rust_dataset.txt | 507,068 | 512 | dock.is_open;
let dock_position = dock.position;
let (menu_anchor, menu_attach) = match dock.position {
DockPosition::Left => (Anchor::BottomLeft, Anchor::TopLeft),
DockPosition::Bottom | DockPosition::Right => (Anchor::BottomRight, Anchor::TopRight),
};
let do... |
rust_dataset_chunk_507069 | rust_dataset.txt | 507,069 | 512 | ,
None,
move |window, cx| {
if !is_current {
panel.set_position(position, window, cx);
... |
rust_dataset_chunk_507070 | rust_dataset.txt | 507,070 | 512 | ed_clone();
move |_, window, cx| {
window.focus(&focus_handle, cx);
window.dispatch_action(action.boxed_clone(), cx)
}
})
... |
rust_dataset_chunk_507071 | rust_dataset.txt | 507,071 | 512 | pub activation_focus_handle: Option<FocusHandle>,
pub default_size: Pixels,
pub flexible: bool,
pub activation_priority: u32,
}
actions!(test_only, [ToggleTestPanel]);
impl EventEmitter<PanelEvent> for TestPanel {}
impl TestPanel {
pub fn new(position: DockPosition, ac... |
rust_dataset_chunk_507072 | rust_dataset.txt | 507,072 | 512 | self.position = position;
cx.update_global::<SettingsStore, _>(|_, _| {});
}
fn default_size(&self, _window: &Window, _: &App) -> Pixels {
self.default_size
}
fn initial_size_state(&self, _window: &Window, _: &App) -> PanelSizeState {
Pan... |
rust_dataset_chunk_507073 | rust_dataset.txt | 507,073 | 512 | window and element to be focused
handles: Option<(AnyWindowHandle, FocusHandle)>,
// The debounced task which will do the focusing
_debounce_task: Option<Task<()>>,
}
impl Global for FfmState {}
pub trait FocusFollowsMouse<E: Focusable>: StatefulInteractiveElement {
fn focus_follows_mouse(
se... |
rust_dataset_chunk_507074 | rust_dataset.txt | 507,074 | 512 | ;
use ui::{App, Context};
use util::{ResultExt, paths::PathExt};
use crate::{
NewWindow, SerializedWorkspaceLocation, WorkspaceId, path_list::PathList,
persistence::WorkspaceDb,
};
pub fn init(fs: Arc<dyn Fs>, cx: &mut App) {
let manager = cx.new(|_| HistoryManager::new());
HistoryManager::set_global(... |
rust_dataset_chunk_507075 | rust_dataset.txt | 507,075 | 512 | e.id == id) {
self.history.remove(pos);
}
self.history.push(entry);
self.update_jump_list(cx);
}
pub fn delete_history(&mut self, id: WorkspaceId, cx: &mut Context<'_, HistoryManager>) {
let Some(pos) = self.history.iter().position(|e| e.id == id) else {
... |
rust_dataset_chunk_507076 | rust_dataset.txt | 507,076 | 512 | h_flex, v_flex,
};
use zed_actions::workspace::OpenWithSystem;
use crate::{Item, ItemNavHistory, Workspace};
/// A view to display when a certain buffer/image/other item fails to open.
pub struct InvalidItemView {
/// Which path was attempted to open.
pub abs_path: Arc<Path>,
/// An error message, happen... |
rust_dataset_chunk_507077 | rust_dataset.txt | 507,077 | 512 | = parent;
detail -= 1;
} else {
break;
}
}
let path = if detail > 0 {
path
} else {
path.strip_prefix(prefix).unwrap_or(path)
};
SharedString::new(path.to_string_lossy())
}
fn active_proje... |
rust_dataset_chunk_507078 | rust_dataset.txt | 507,078 | 512 | )
}),
),
)
}
}
--- FILE: zed/crates/workspace/src/item.rs ---
use crate::{
CollaboratorId, DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory,
SerializableItemRegistry, ToolbarItemLocation, ViewId, Workspace, W... |
rust_dataset_chunk_507079 | rust_dataset.txt | 507,079 | 512 | bool,
pub enable_preview_multibuffer_from_code_navigation: bool,
pub enable_preview_file_from_code_navigation: bool,
pub enable_keep_preview_on_code_navigation: bool,
}
impl Settings for ItemSettings {
fn from_settings(content: &settings::SettingsContent) -> Self {
let tabs = content.tabs.as_r... |
rust_dataset_chunk_507080 | rust_dataset.txt | 507,080 | 512 | fn text_color(&self) -> Color {
if self.deemphasized {
if self.selected {
Color::Muted
} else {
Color::Hidden
}
} else if self.selected {
Color::Default
} else {
Color::Muted
}
}
}
pub enum ... |
rust_dataset_chunk_507081 | rust_dataset.txt | 507,081 | 512 | , _window: &mut Window, _: &mut Context<Self>) {}
fn discarded(&self, _project: Entity<Project>, _window: &mut Window, _cx: &mut Context<Self>) {}
fn on_removed(&self, _cx: &mut Context<Self>) {}
fn workspace_deactivated(&mut self, _window: &mut Window, _: &mut Context<Self>) {}
fn pane_changed(&mut sel... |
rust_dataset_chunk_507082 | rust_dataset.txt | 507,082 | 512 | (&self, _: &App) -> bool {
false
}
fn capability(&self, _: &App) -> Capability {
Capability::ReadWrite
}
fn read_only_toggle_buffer(&self, _: &App) -> Option<Entity<Buffer>> {
None
}
fn has_deleted_file(&self, _: &App) -> bool {
false
}
fn has_conflict(&... |
rust_dataset_chunk_507083 | rust_dataset.txt | 507,083 | 512 | breadcrumb.
fn breadcrumb_prefix(
&self,
_window: &mut Window,
_cx: &mut Context<Self>,
) -> Option<gpui::AnyElement> {
None
}
fn added_to_workspace(
&mut self,
_workspace: &mut Workspace,
_window: &mut Window,
_cx: &mut Context<Self>,
... |
rust_dataset_chunk_507084 | rust_dataset.txt | 507,084 | 512 | bool;
}
pub trait SerializableItemHandle: ItemHandle {
fn serialized_item_kind(&self) -> &'static str;
fn serialize(
&self,
workspace: &mut Workspace,
closing: bool,
cx: &mut App,
) -> Option<Task<Result<()>>>;
fn should_serialize(&self, event: &dyn Any, cx: &App) -> bo... |
rust_dataset_chunk_507085 | rust_dataset.txt | 507,085 | 512 | cx: &App) -> Option<ProjectPath>;
fn project_entry_ids(&self, cx: &App) -> SmallVec<[ProjectEntryId; 3]>;
fn project_paths(&self, cx: &App) -> SmallVec<[ProjectPath; 3]>;
fn project_item_model_ids(&self, cx: &App) -> SmallVec<[EntityId; 3]>;
fn for_each_project_item(
&self,
_: &App,
... |
rust_dataset_chunk_507086 | rust_dataset.txt | 507,086 | 512 | cx: &mut App,
) -> Task<Result<()>>;
fn save_as(
&self,
project: Entity<Project>,
path: ProjectPath,
window: &mut Window,
cx: &mut App,
) -> Task<Result<()>>;
fn reload(
&self,
project: Entity<Project>,
window: &mut Window,
... |
rust_dataset_chunk_507087 | rust_dataset.txt | 507,087 | 512 | App) -> bool {
let is_deleted = self.project_entry_ids(cx).is_empty();
self.is_dirty(cx) && !self.has_conflict(cx) && self.can_save(cx) && !is_deleted
}
}
pub trait WeakItemHandle: Send + Sync {
fn id(&self) -> EntityId;
fn boxed_clone(&self) -> Box<dyn WeakItemHandle>;
fn upgrade(&self... |
rust_dataset_chunk_507088 | rust_dataset.txt | 507,088 | 512 | {
self.read(cx).tab_tooltip_content(cx)
}
fn tab_tooltip_text(&self, cx: &App) -> Option<SharedString> {
self.read(cx).tab_tooltip_text(cx)
}
fn dragged_tab_content(
&self,
params: TabContentParams,
window: &Window,
cx: &App,
) -> AnyElement {
... |
rust_dataset_chunk_507089 | rust_dataset.txt | 507,089 | 512 | }
fn buffer_kind(&self, cx: &App) -> ItemBufferKind {
self.read(cx).buffer_kind(cx)
}
fn boxed_clone(&self) -> Box<dyn ItemHandle> {
Box::new(self.clone())
}
fn can_split(&self, cx: &App) -> bool {
self.read(cx).can_split()
}
fn clone_on_split(
&self,
... |
rust_dataset_chunk_507090 | rust_dataset.txt | 507,090 | 512 | ) = self.to_followable_item_handle(cx) {
let is_project_item = item.is_project_item(window, cx);
let item = item.downgrade();
send_follower_updates = Some(cx.spawn_in(window, {
let pending_update = pending_update.clone();
async mov... |
rust_dataset_chunk_507091 | rust_dataset.txt | 507,091 | 512 | _update_proto(
event,
&mut pending_update.borrow_mut(),
window,
cx,
);
pending_update_tx... |
rust_dataset_chunk_507092 | rust_dataset.txt | 507,092 | 512 | cx| {
Pane::autosave_item(
&item,
workspace.project().clone(),
window,
cx,
... |
rust_dataset_chunk_507093 | rust_dataset.txt | 507,093 | 512 | mut Window, cx: &mut App) {
self.update(cx, |this, cx| this.deactivated(window, cx));
}
fn on_removed(&self, cx: &mut App) {
self.update(cx, |item, cx| item.on_removed(cx));
}
fn workspace_deactivated(&self, window: &mut Window, cx: &mut App) {
self.update(cx, |this, cx| this.w... |
rust_dataset_chunk_507094 | rust_dataset.txt | 507,094 | 512 | mut Window,
cx: &mut App,
) -> Task<Result<()>> {
self.update(cx, |item, cx| item.save(options, project, window, cx))
}
fn save_as(
&self,
project: Entity<Project>,
path: ProjectPath,
window: &mut Window,
cx: &mut App,
) -> Task<anyhow::Result<()>... |
rust_dataset_chunk_507095 | rust_dataset.txt | 507,095 | 512 | (cx).pixel_position_of_cursor(cx)
}
fn downgrade_item(&self) -> Box<dyn WeakItemHandle> {
Box::new(self.downgrade())
}
fn to_serializable_item_handle(&self, cx: &App) -> Option<Box<dyn SerializableItemHandle>> {
SerializableItemRegistry::view_to_serializable_item_handle(self.to_any_vie... |
rust_dataset_chunk_507096 | rust_dataset.txt | 507,096 | 512 | Box::new(self.clone())
}
fn upgrade(&self) -> Option<Box<dyn ItemHandle>> {
self.upgrade().map(|v| Box::new(v) as Box<dyn ItemHandle>)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ProjectItemKind(pub &'static str);
pub trait ProjectItem: Item {
type Item... |
rust_dataset_chunk_507097 | rust_dataset.txt | 507,097 | 512 | ::update_view::Variant,
window: &mut Window,
cx: &mut Context<Self>,
) -> Task<Result<()>>;
fn is_project_item(&self, window: &Window, cx: &App) -> bool;
fn set_leader_id(
&mut self,
leader_peer_id: Option<CollaboratorId>,
window: &mut Window,
cx: &mut Context... |
rust_dataset_chunk_507098 | rust_dataset.txt | 507,098 | 512 | remote_id(&self, client: &Arc<Client>, _: &mut Window, cx: &mut App) -> Option<ViewId> {
self.read(cx).remote_id().or_else(|| {
client.peer_id().map(|creator| ViewId {
creator: CollaboratorId::PeerId(creator),
id: self.item_id().as_u64(),
})
})
... |
rust_dataset_chunk_507099 | rust_dataset.txt | 507,099 | 512 | existing.to_any_view().downcast::<T>().ok()?;
self.read(cx).dedup(existing.read(cx), window, cx)
}
fn update_agent_location(&self, location: language::Anchor, window: &mut Window, cx: &mut App) {
self.update(cx, |this, cx| {
this.update_agent_location(location, window, cx)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.