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_506900 | rust_dataset.txt | 506,900 | 512 | read(cx)
.snapshot(cx)
.excerpts()
.map(|excerpt| excerpt.context.start.buffer_id)
.collect::<Vec<_>>();
editor.fold_buffer(buffer_ids[1], cx);
});
cx.assert_excerpts_with_selections(indoc! {"
[EXCERPT]
ˇ[FOLDED]
[EXCERPT]
... |
rust_dataset_chunk_506901 | rust_dataset.txt | 506,901 | 512 | fn o(wow: i32) {
othˇ(wow)
oth(wow)
}
"
})
.await;
cx.simulate_shared_keystrokes("d ] }").await;
cx.shared_state().await.assert_eq(indoc! {
"fn o(wow: i32) {
otˇh
}
"
});
cx.shared_clipboard().await.assert_eq("(wow)\n oth(wow... |
rust_dataset_chunk_506902 | rust_dataset.txt | 506,902 | 512 | _state(indoc! {
"
first paragraph
ˇstill first
second paragraph
still second
third paragraph
"
})
.await;
cx.simulate_shared_keystrokes("y a p").await;
cx.shared_clipboard()
.await
.assert_eq("first paragraph\nstill first\n\n");
... |
rust_dataset_chunk_506903 | rust_dataset.txt | 506,903 | 512 | fn test_clipping_on_mode_change(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {
"
ˇverylongline
andsomelinebelow
"
},
Mode::Normal,
);
cx.simulate_keystrokes("v e");
cx.assert_state(
... |
rust_dataset_chunk_506904 | rust_dataset.txt | 506,904 | 512 | �>
"
},
Mode::VisualLine,
);
}
#[gpui::test]
async fn test_repeat_grouping_41735(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
// typically transaction gropuing is disabled in tests, but here we need to test it.
cx.update_buffer(|buff... |
rust_dataset_chunk_506905 | rust_dataset.txt | 506,905 | 512 | LineDownward)
// `x` - delete character into blackhole register
cx.update(|_, cx| {
cx.bind_keys([KeyBinding::new(
"g x",
workspace::SendKeystrokes("\" _ x".to_string()),
Some("VimControl"),
)])
});
cx.set_state("helˇlo", Mode::Normal);
cx.simula... |
rust_dataset_chunk_506906 | rust_dataset.txt | 506,906 | 512 | "{",
"FIX: With use_key_equivalents=false, {{ stays as {{"
);
// Same applies to }
let keystroke_close = Keystroke::parse("}").unwrap();
let mapped_close_bug = mapper.map_key_equivalent(keystroke_close.clone(), true);
assert_eq!(mapped_close_bug.key(), "Ø");
let mapped_close_fixed = ma... |
rust_dataset_chunk_506907 | rust_dataset.txt | 506,907 | 512 | .update_in(cx, |workspace, _, cx| {
workspace
.active_pane()
.read(cx)
.items()
.find_map(|item| item.downcast::<ProjectSearchView>())
.expect("Project search view should be active")
});
project_search::perform_project_search(&search_view, "Fi... |
rust_dataset_chunk_506908 | rust_dataset.txt | 506,908 | 512 | _lsp(EditorLspTestContext::new_html(cx).await, true)
}
pub async fn new_markdown_with_rust(cx: &mut gpui::TestAppContext) -> VimTestContext {
Self::init(cx);
Self::new_with_lsp(EditorLspTestContext::new_markdown_with_rust(cx).await, true)
}
pub async fn new_typescript(cx: &mut gpui::Te... |
rust_dataset_chunk_506909 | rust_dataset.txt | 506,909 | 512 | let mut vim_key_bindings =
settings::KeymapFile::load_asset_allow_partial_failure("keymaps/vim.json", cx)
.unwrap();
for key_binding in &mut vim_key_bindings {
key_binding.set_meta(settings::KeybindSource::Vim.meta());
}
... |
rust_dataset_chunk_506910 | rust_dataset.txt | 506,910 | 512 | }
pub fn disable_vim(&mut self) {
self.cx.update(|_, cx| {
SettingsStore::update_global(cx, |store, cx| {
store.update_user_settings(cx, |s| s.vim_mode = Some(false));
});
})
}
pub fn enable_helix(&mut self) {
self.cx.update(|_, cx| {
... |
rust_dataset_chunk_506911 | rust_dataset.txt | 506,911 | 512 | : &str,
initial_mode: Mode,
state_after: &str,
mode_after: Mode,
) {
self.set_state(initial_state, initial_mode);
self.cx.simulate_keystrokes(keystrokes);
self.cx.assert_editor_state(state_after);
assert_eq!(self.mode(), mode_after, "{}", self.assertion_contex... |
rust_dataset_chunk_506912 | rust_dataset.txt | 506,912 | 512 | movement::{self, FindRange},
};
use gpui::{
Action, App, AppContext, Axis, Context, Entity, EventEmitter, Focusable, KeyContext,
KeystrokeEvent, Render, Subscription, Task, WeakEntity, Window, actions,
};
use insert::{NormalBefore, TemporaryNormal};
use language::{CursorShape, Point, Selection, SelectionGoa... |
rust_dataset_chunk_506913 | rust_dataset.txt | 506,913 | 512 | ,
}
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
/// Selects the next object.
struct PushHelixNext {
around: bool,
}
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
/// Se... |
rust_dataset_chunk_506914 | rust_dataset.txt | 506,914 | 512 | Enter,
/// Selects inner text object.
InnerObject,
/// Maximizes the current pane.
MaximizePane,
/// Resets all pane sizes to default.
ResetPaneSizes,
/// Resizes the pane to the right.
ResizePaneRight,
/// Resizes the pane to the left.
Re... |
rust_dataset_chunk_506915 | rust_dataset.txt | 506,915 | 512 | SurroundReplace,
/// Deletes surrounding characters in Helix mode.
PushHelixSurroundDelete,
]
);
// in the workspace namespace so it's not filtered out when vim is disabled.
actions!(
workspace,
[
/// Toggles Vim mode on or off.
ToggleVimMode,
/// Toggles Helix mode ... |
rust_dataset_chunk_506916 | rust_dataset.txt | 506,916 | 512 | &Number, window, cx| {
let vim = workspace
.focused_pane(window, cx)
.read(cx)
.active_item()
.and_then(|item| item.act_as::<Editor>(cx))
.and_then(|editor| editor.read(cx).addon::<VimAddon>().cloned());
if let Some... |
rust_dataset_chunk_506917 | rust_dataset.txt | 506,917 | 512 | , theme.buffer_font_size(cx), 'm')
else {
return;
};
workspace.resize_pane(Axis::Horizontal, width.width * count, window, cx);
});
workspace.register_action(|workspace, _: &ResizePaneLeft, window, cx| {
let count = Vim::take_count(cx).unwr... |
rust_dataset_chunk_506918 | rust_dataset.txt | 506,918 | 512 | GoToTab, window, cx| {
let count = Vim::take_count(cx);
Vim::take_forced_motion(cx);
if let Some(tab_index) = count {
// <count>gt goes to tab <count> (1-based).
let zero_based_index = tab_index.saturating_sub(1);
window.dispatch_actio... |
rust_dataset_chunk_506919 | rust_dataset.txt | 506,919 | 512 | replacements: Vec<(Range<editor::Anchor>, String)>,
pub(crate) stored_visual_mode: Option<(Mode, Vec<bool>)>,
pub(crate) current_tx: Option<TransactionId>,
pub(crate) current_anchor: Option<Selection<Anchor>>,
pub(crate) helix_append_state: Option<HelixAppendState>,
pub(crate) undo_modes: HashMap... |
rust_dataset_chunk_506920 | rust_dataset.txt | 506,920 | 512 | initial_helix_mode, Mode::HelixNormal)
} else {
(initial_vim_mode, Mode::Normal)
};
cx.new(|cx| Vim {
mode,
last_mode,
temp_mode: false,
exit_temporary_mode: false,
operator_stack: Vec::new(),
replacements: Vec:... |
rust_dataset_chunk_506921 | rust_dataset.txt | 506,921 | 512 | _changed);
if !state_changed {
return;
}
if was_enabled {
Self::deactivate(editor, cx);
}
was_enabled = enabled;
if enabled {
Self::activate(editor, window, cx);
}
})
.deta... |
rust_dataset_chunk_506922 | rust_dataset.txt | 506,922 | 512 | PushForcedMotion, _, cx| {
Vim::globals(cx).forced_motion = true;
});
Vim::action(editor, cx, |vim, action: &PushObject, window, cx| {
vim.push_operator(
Operator::Object {
around: action.around,
},
... |
rust_dataset_chunk_506923 | rust_dataset.txt | 506,923 | 512 | .first_char,
},
window,
cx,
)
});
Vim::action(editor, cx, |vim, action: &PushLiteral, window, cx| {
vim.push_operator(
Operator::Literal {
prefix: action.prefi... |
rust_dataset_chunk_506924 | rust_dataset.txt | 506,924 | 512 | cx)
});
Vim::action(editor, cx, |vim, _: &PushUppercase, window, cx| {
vim.push_operator(Operator::Uppercase, window, cx)
});
Vim::action(editor, cx, |vim, _: &PushOppositeCase, window, cx| {
vim.push_operator(Operator::OppositeCase, win... |
rust_dataset_chunk_506925 | rust_dataset.txt | 506,925 | 512 | cx| {
vim.clear_operator(window, cx)
});
Vim::action(editor, cx, |vim, n: &Number, window, cx| {
vim.push_count_digit(n.0, window, cx);
});
Vim::action(editor, cx, |vim, _: &Tab, window, cx| {
vim.input_ignored(" ".into(), ... |
rust_dataset_chunk_506926 | rust_dataset.txt | 506,926 | 512 | {
vim.update_editor(cx, |_, editor, cx| editor.paste(&Paste, window, cx));
if vim.mode == Mode::HelixSelect {
vim.switch_mode(Mode::HelixNormal, true, window, cx);
}
}
},
... |
rust_dataset_chunk_506927 | rust_dataset.txt | 506,927 | 512 | editor(&self) -> Option<Entity<Editor>> {
self.editor.upgrade()
}
pub fn workspace(&self, window: &Window, cx: &App) -> Option<Entity<Workspace>> {
Workspace::for_window(window, cx)
}
pub fn pane(&self, window: &Window, cx: &Context<Self>) -> Option<Entity<Pane>> {
let pane = ... |
rust_dataset_chunk_506928 | rust_dataset.txt | 506,928 | 512 | );
}
operator @ Operator::HelixJump { .. } if keystroke_event.action.is_none() => {
let modifiers = keystroke_event.keystroke.modifiers;
let mut input = keystroke_event.keystroke.key.chars();
if !modifiers.co... |
rust_dataset_chunk_506929 | rust_dataset.txt | 506,929 | 512 | "\"".to_string()
} else {
"'".to_string()
};
vim.set_mark(mark, vec![*anchor], editor.buffer(), window, cx);
});
}
_ => {}
}
}
fn push_operator(&mut self, ... |
rust_dataset_chunk_506930 | rust_dataset.txt | 506,930 | 512 | _settings(window, cx);
if VimSettings::get_global(cx).toggle_relative_line_numbers
&& self.mode != self.last_mode
&& (self.mode == Mode::Insert || self.last_mode == Mode::Insert)
{
self.update_editor(cx, |vim, editor, cx| {
let is_relative = vim.mode ... |
rust_dataset_chunk_506931 | rust_dataset.txt | 506,931 | 512 | let tail = s.oldest_anchor().tail();
let head = s.newest_anchor().head();
s.select_anchor_ranges(vec![tail..head]);
} else if last_mode == Mode::Insert
&& prior_mode == Mode::VisualBlock
&& mode != Mode::VisualBlock
... |
rust_dataset_chunk_506932 | rust_dataset.txt | 506,932 | 512 | global_state.post_count.is_none() && global_state.pre_count.is_none() {
return None;
} else {
Some(
global_state.post_count.take().unwrap_or(1)
* global_state.pre_count.take().unwrap_or(1),
)
};
if global_state.dot_recordi... |
rust_dataset_chunk_506933 | rust_dataset.txt | 506,933 | 512 | }
}
self.editor_input_enabled()
}
pub fn editor_input_enabled(&self) -> bool {
match self.mode {
Mode::Insert => {
if let Some(operator) = self.operator_stack.last() {
!operator.is_waiting(self.mode)
} else {
... |
rust_dataset_chunk_506934 | rust_dataset.txt | 506,934 | 512 | selector key
// rather than a motion over a range, so they keep `operator_id`
// set (so `vim_operator == helix_next/previous` context must
// resolve) but must not use the `operator` mode, as that adds
// `VimControl` and the `vim_mode == operator` conte... |
rust_dataset_chunk_506935 | rust_dataset.txt | 506,935 | 512 | }
}
}
let Some(editor) = self.editor() else {
return;
};
let newest_selection_empty = editor.update(cx, |editor, cx| {
editor
.selections
.newest::<MultiBufferOffset>(&editor.display_snapshot(cx))
... |
rust_dataset_chunk_506936 | rust_dataset.txt | 506,936 | 512 | , cx| {
if vim.cursor_shape(cx) == CursorShape::Block {
editor.set_cursor_shape(CursorShape::Hollow, cx);
}
});
}
fn cursor_shape_changed(&mut self, _: &mut Window, cx: &mut Context<Self>) {
self.update_editor(cx, |vim, editor, cx| {
editor.se... |
rust_dataset_chunk_506937 | rust_dataset.txt | 506,937 | 512 | VisualLine => RecordedSelection::VisualLine {
rows: newest.end.row - newest.start.row,
},
Mode::VisualBlock => RecordedSelection::VisualBlock {
rows: newest.end.row.abs_diff(oldest.start.row),
... |
rust_dataset_chunk_506938 | rust_dataset.txt | 506,938 | 512 | ::globals(cx).post_count.unwrap_or(0);
Vim::globals(cx).post_count = Some(
post_count
.checked_mul(10)
.and_then(|post_count| post_count.checked_add(number))
.filter(|post_count| *post_count < isize::MAX as usize)
... |
rust_dataset_chunk_506939 | rust_dataset.txt | 506,939 | 512 | elix_jump_ui(
&mut self,
overlays: Vec<NavigationTargetOverlay>,
window: &mut Window,
cx: &mut Context<Self>,
) -> bool {
self.clear_helix_jump_ui(window, cx);
self.update_editor(cx, |_, editor, cx| {
editor.set_navigation_overlays(HELIX_JUMP_OVERLAY_KEY, ... |
rust_dataset_chunk_506940 | rust_dataset.txt | 506,940 | 512 | at the label instead of selecting the word.
s.select_anchor_ranges([candidate.range.start..candidate.range.start])
});
}
HelixJumpBehaviour::ExtendToWordStart => {
editor.change_selections(Default::default(), window, cx, |s| {
... |
rust_dataset_chunk_506941 | rust_dataset.txt | 506,941 | 512 | match self.mode {
Mode::VisualLine | Mode::VisualBlock | Mode::Visual | Mode::HelixSelect => {
self.update_editor(cx, |vim, editor, cx| {
let original_mode = vim.undo_modes.get(transaction_id);
editor.change_selections(SelectionEffects::no_scro... |
rust_dataset_chunk_506942 | rust_dataset.txt | 506,942 | 512 | (newest);
}
} else if self.mode == Mode::Normal && newest.start != newest.end {
if matches!(newest.goal, SelectionGoal::HorizontalRange { .. }) {
self.switch_mode(Mode::VisualBlock, false, window, cx);
} else {
self.switch_mode(Mode::Visual, fa... |
rust_dataset_chunk_506943 | rust_dataset.txt | 506,943 | 512 | self.pop_operator(window, cx);
self.push_operator(Operator::Sneak { first_char }, window, cx);
}
}
Some(Operator::SneakBackward { first_char }) => {
if let Some(first_char) = first_char {
if let Some(seco... |
rust_dataset_chunk_506944 | rust_dataset.txt | 506,944 | 512 | Mode::VisualLine | Mode::VisualBlock => {
self.add_surrounds(text, SurroundsType::Selection, window, cx);
self.clear_operator(window, cx);
}
_ => self.clear_operator(window, cx),
},
Some(Operator::ChangeSurrounds {
... |
rust_dataset_chunk_506945 | rust_dataset.txt | 506,945 | 512 | replaced_char: Some(ch),
},
window,
cx,
);
}
}
_ => self.clear_operator(window, cx),
},
Some(Operator::HelixSurroundDelete) => match se... |
rust_dataset_chunk_506946 | rust_dataset.txt | 506,946 | 512 | VimEditorSettingsState {
cursor_shape: self.cursor_shape(cx),
clip_at_line_ends: self.clip_at_line_ends(),
collapse_matches: !HelixModeSetting::get_global(cx).0 && !self.search.cmd_f_search,
input_enabled: self.editor_input_enabled(),
expects_character... |
rust_dataset_chunk_506947 | rust_dataset.txt | 506,947 | 512 | : CursorShapeSettings,
pub show_edit_predictions_in_normal_mode: bool,
}
/// Cursor shape configuration for insert mode.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum InsertModeCursorShape {
/// Inherit cursor shape from the editor's base cursor_shape setting.
/// This allows users to set their pre... |
rust_dataset_chunk_506948 | rust_dataset.txt | 506,948 | 512 | {
match mode {
ModeContent::Normal => Self::Normal,
ModeContent::Insert => Self::Insert,
}
}
}
impl Settings for VimSettings {
fn from_settings(content: &settings::SettingsContent) -> Self {
let vim = content.vim.clone().unwrap();
Self {
defa... |
rust_dataset_chunk_506949 | rust_dataset.txt | 506,949 | 512 | of the current selection.
SelectPrevious,
/// Selects the next match of the current selection.
SelectNextMatch,
/// Selects the previous match of the current selection.
SelectPreviousMatch,
/// Selects the next smaller syntax node.
SelectSmallerSyntaxNode,
... |
rust_dataset_chunk_506950 | rust_dataset.txt | 506,950 | 512 | Vim::action(editor, cx, Vim::select_next);
Vim::action(editor, cx, Vim::select_previous);
Vim::action(editor, cx, |vim, _: &SelectNextMatch, window, cx| {
vim.select_match(Direction::Next, window, cx);
});
Vim::action(editor, cx, |vim, _: &SelectPreviousMatch, window, cx| {
vim.select_m... |
rust_dataset_chunk_506951 | rust_dataset.txt | 506,951 | 512 | else {
return;
};
let marks = vim
.update_editor(cx, |vim, editor, cx| {
vim.get_mark("<", editor, window, cx)
.zip(vim.get_mark(">", editor, window, cx))
})
.flatten();
let Some((Mark::Local(start), Mark::Local... |
rust_dataset_chunk_506952 | rust_dataset.txt | 506,952 | 512 | ::Up { .. } | Motion::Down { .. });
vim.visual_block_motion(
is_up_or_down,
editor,
window,
cx,
&mut |map, point, goal| {
motion.move_point(map, point, goal, times, &text_layout_de... |
rust_dataset_chunk_506953 | rust_dataset.txt | 506,953 | 512 | = &s.display_snapshot();
let mut head = s.newest_anchor().head().to_display_point(map);
let mut tail = s.oldest_anchor().tail().to_display_point(map);
let mut head_x = map.x_for_display_point(head, &text_layout_details);
let mut tail_x = map.x_for_display_point(tail, &t... |
rust_dataset_chunk_506954 | rust_dataset.txt | 506,954 | 512 | f64::from(positions.end),
};
}
let mut selections = Vec::new();
let mut row = tail.row();
let going_up = tail.row() > head_row;
let direction = if going_up { -1 } else { 1 };
loop {
let laid_out_line = map.layout_... |
rust_dataset_chunk_506955 | rust_dataset.txt | 506,955 | 512 | ,
cx: &mut Context<Vim>,
) {
if let Some(Operator::Object { around }) = self.active_operator() {
self.pop_operator(window, cx);
let current_mode = self.mode;
let target_mode = object.target_visual_mode(current_mode, around);
if target_mode != current_m... |
rust_dataset_chunk_506956 | rust_dataset.txt | 506,956 | 512 | newline is included in its selection from the beginning.
if object == Object::Paragraph && range.start != range.end {
let row_of_selection_end_line = selection.end.to_point(map).row;
let new_selection_end = if map
... |
rust_dataset_chunk_506957 | rust_dataset.txt | 506,957 | 512 | );
}
fn visual_insert_first_non_white_space(
&mut self,
_: &VisualInsertFirstNonWhiteSpace,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.update_editor(cx, |_, editor, cx| {
editor.split_selection_into_lines(&Default::default(), window, cx);
... |
rust_dataset_chunk_506958 | rust_dataset.txt | 506,958 | 512 | = line_mode || editor.selections.line_mode();
editor.selections.set_line_mode(false);
editor.transact(window, cx, |editor, window, cx| {
editor.change_selections(Default::default(), window, cx, |s| {
s.move_with(&mut |map, selection| {
... |
rust_dataset_chunk_506959 | rust_dataset.txt | 506,959 | 512 | _ends(!vim.mode.is_helix(), cx);
editor.change_selections(Default::default(), window, cx, |s| {
s.move_with(&mut |map, selection| {
let mut cursor = selection.head().to_point(map);
if let Some(column) = original_columns.get(&selection.... |
rust_dataset_chunk_506960 | rust_dataset.txt | 506,960 | 512 | s.select_anchors(vec![s.first_anchor()])
}
});
});
self.switch_mode(Mode::Normal, true, window, cx);
}
pub(crate) fn visual_replace(
&mut self,
text: Arc<str>,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.stop_rec... |
rust_dataset_chunk_506961 | rust_dataset.txt | 506,961 | 512 | ..count {
if editor
.select_next(&Default::default(), window, cx)
.log_err()
.is_none()
{
break;
}
}
});
}
pub fn select_previous(
&mut self,
_: &S... |
rust_dataset_chunk_506962 | rust_dataset.txt | 506,962 | 512 | .update(cx, |pane, cx| {
if let Some(search_bar) = pane.toolbar().read(cx).item_of_type::<BufferSearchBar>() {
search_bar.update(cx, |search_bar, cx| {
search_bar.update_match_index(window, cx);
search_bar.select_match(direction, count, window, cx);
... |
rust_dataset_chunk_506963 | rust_dataset.txt | 506,963 | 512 | , _, cx| editor.pixel_position_of_cursor(cx));
// entering visual mode should select the character
// under cursor
cx.simulate_shared_keystrokes("v").await;
cx.shared_state()
.await
.assert_eq(indoc! { "The «qˇ»uick brown
fox jumps over
th... |
rust_dataset_chunk_506964 | rust_dataset.txt | 506,964 | 512 | _non_whitespace(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {
"«The quick brown
fox jumps over
the lazy dogˇ»"
},
Mode::Visual,
);
cx.simulate_... |
rust_dataset_chunk_506965 | rust_dataset.txt | 506,965 | 512 | ulate_shared_keystrokes("x").await;
cx.shared_state().await.assert_eq(indoc! {"
a
ˇb"});
// it should work at the end of the document
cx.set_shared_state(indoc! {"
a
b
ˇ"})
.await;
let cursor = cx.update_editor(|edi... |
rust_dataset_chunk_506966 | rust_dataset.txt | 506,966 | 512 | (cx).await;
cx.set_shared_state(indoc! {"
The quˇick brown
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("shift-v x").await;
cx.shared_state().await.assert_matches();
// Test pasting code copied on delet... |
rust_dataset_chunk_506967 | rust_dataset.txt | 506,967 | 512 | jumps o"});
cx.set_shared_state(indoc! {"
The quick brown
fox jumps over
the ˇlazy dog"})
.await;
cx.simulate_shared_keystrokes("v w j y").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick br... |
rust_dataset_chunk_506968 | rust_dataset.txt | 506,968 | 512 | the lazy dog"
})
.await;
cx.simulate_shared_keystrokes("ctrl-v").await;
cx.shared_state().await.assert_eq(indoc! {
"The «qˇ»uick brown
fox jumps over
the lazy dog"
});
cx.simulate_shared_keystrokes("2 down").await;
cx.shared_st... |
rust_dataset_chunk_506969 | rust_dataset.txt | 506,969 | 512 | _keystrokes("ctrl-v down down").await;
cx.shared_state().await.assert_eq(indoc! {
"The«ˇ q»uick
bro«ˇwn»
foxˇ
jumps over the
lazy dog
"
});
cx.simulate_shared_keystrokes("down").await;
cx.shared_state().await.assert... |
rust_dataset_chunk_506970 | rust_dataset.txt | 506,970 | 512 | ::test]
async fn test_visual_block_mode_down_right(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
The ˇquick brown
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_ke... |
rust_dataset_chunk_506971 | rust_dataset.txt | 506,971 | 512 | (cx).await;
cx.set_shared_state(indoc! {"
The quick brown
fox jˇumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("ctrl-v l l l l j").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
fox j«ump... |
rust_dataset_chunk_506972 | rust_dataset.txt | 506,972 | 512 | test_visual_block_insert_after_ctrl_d_scroll(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
let shared_state_lines = (1..=10)
.map(|line_number| format!("{line_number:02}"))
.collect::<Vec<_>>()
.join("\n");
let shared_s... |
rust_dataset_chunk_506973 | rust_dataset.txt | 506,973 | 512 | 34567890
"
})
.await;
cx.simulate_shared_keystrokes("ctrl-v 2 j").await;
cx.shared_state().await.assert_eq(indoc! {
"«1ˇ»23456789012345678901234567890123456789012345678901234567890
«1ˇ»234567890123456789012345678901234567890
«1ˇ»23456789012... |
rust_dataset_chunk_506974 | rust_dataset.txt | 506,974 | 512 | �»\n12345678901«2ˇ»34");
cx.set_shared_state("12345678901234\n123456789012ˇ34").await;
cx.simulate_shared_keystrokes("ctrl-v g g").await;
cx.shared_state()
.await
.assert_eq("123456789012«3ˇ»4\n123456789012«3ˇ»4");
cx.set_shared_state("ˇ12345678901234").await;
... |
rust_dataset_chunk_506975 | rust_dataset.txt | 506,975 | 512 | await.assert_eq(indoc! {
"{
{
« }ˇ»
}
{
}
"
});
cx.simulate_shared_keystrokes("a {").await;
cx.shared_state().await.assert_eq(indoc! {
"{
«{
}ˇ»
}
... |
rust_dataset_chunk_506976 | rust_dataset.txt | 506,976 | 512 | ˇaa aa aa aa");
cx.simulate_shared_keystrokes("g n").await;
cx.shared_state().await.assert_eq("aa «aaˇ» aa aa aa");
cx.simulate_shared_keystrokes("g n").await;
cx.shared_state().await.assert_eq("aa «aa aaˇ» aa aa");
cx.simulate_shared_keystrokes("escape d g n").await;
cx... |
rust_dataset_chunk_506977 | rust_dataset.txt | 506,977 | 512 | _state().await.assert_eq("aa ˇaa aa aa aa");
cx.simulate_shared_keystrokes("d g n").await;
cx.shared_state().await.assert_eq("aa ˇ aa aa aa");
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("aa ˇ aa aa");
cx.simulate_shared_keystrokes(".").await;
... |
rust_dataset_chunk_506978 | rust_dataset.txt | 506,978 | 512 | ystrokes(".").await;
cx.shared_state().await.assert_eq("aa ˇx aa aa aa");
}
#[gpui::test]
async fn test_visual_shift_d(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {
"The ˇquick brown
fox ju... |
rust_dataset_chunk_506979 | rust_dataset.txt | 506,979 | 512 | ().await.assert_eq(indoc! {
"«Thˇ»e quick brown"
});
cx.simulate_shared_keystrokes("g v").await;
cx.shared_state().await.assert_eq(indoc! {
"The «ˇquick» brown"
});
cx.simulate_shared_keystrokes("g v").await;
cx.shared_state().await.assert_eq(indoc... |
rust_dataset_chunk_506980 | rust_dataset.txt | 506,980 | 512 | .shared_state().await.assert_eq(indoc! {
"«The
quick
brown
fˇ»ox"
});
}
#[gpui::test]
async fn test_visual_syntax_sibling_selection(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
... |
rust_dataset_chunk_506981 | rust_dataset.txt | 506,981 | 512 | Error {}
#[derive(Debug, Eq, PartialEq)]
pub struct NoSenderError;
impl fmt::Display for NoSenderError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "sender was dropped")
}
}
impl std::error::Error for NoSenderError {}
--- FILE: zed/crates/watch/src/snapshot.rs ---
//! ... |
rust_dataset_chunk_506982 | rust_dataset.txt | 506,982 | 512 | change, even when the value is equal; slow receivers skip intermediate values.
pub fn channel<T>(value: T) -> (Sender<T>, Receiver<T>) {
let receiver = Receiver::constant(value);
let sender = Sender {
state: receiver.state.clone(),
};
(sender, receiver)
}
/// Publishes values to all receivers ... |
rust_dataset_chunk_506983 | rust_dataset.txt | 506,983 | 512 | Returns an owned snapshot and marks its version as seen.
///
/// The snapshot remains valid after further sends or after the channel is
/// dropped, and does not prevent either operation.
pub fn snapshot(&mut self) -> Snapshot<T> {
let snapshot = self.state.latest.load_full();
self.vers... |
rust_dataset_chunk_506984 | rust_dataset.txt | 506,984 | 512 | = &mut self.get_mut().receiver;
// Register before checking so a racing publication cannot go unnoticed.
receiver.waker.register(cx.waker());
// Observing closure must precede loading the value, so closure cannot
// hide a final publication that raced with this poll.
let closed ... |
rust_dataset_chunk_506985 | rust_dataset.txt | 506,985 | 512 | equal_values_are_distinct_publications() {
let (mut sender, mut receiver) = channel(7);
let (waker, _) = counting_waker();
assert_eq!(sender.send(7), Ok(()));
assert_eq!(poll_changed(&mut receiver, &waker), Poll::Ready(Ok(())));
assert_eq!(sender.send(7), Ok(()));
assert_eq!(poll_changed(&mut ... |
rust_dataset_chunk_506986 | rust_dataset.txt | 506,986 | 512 | drop(sender);
drop(receiver);
assert_eq!(*retained, NotClone(1));
assert_eq!(*latest, NotClone(2));
}
#[test]
fn send_without_receivers_still_stores_the_value() {
let (mut sender, receiver) = channel(1);
drop(receiver);
assert_eq!(sender.send(2), Err(NoReceiverError));
let mut receive... |
rust_dataset_chunk_506987 | rust_dataset.txt | 506,987 | 512 | (0);
let (first_waker, first_counter) = counting_waker();
let (second_waker, second_counter) = counting_waker();
{
let mut changed = Box::pin(receiver.changed());
assert_eq!(
changed
.as_mut()
.poll(&mut Context::from_waker(&first_waker)),
... |
rust_dataset_chunk_506988 | rust_dataset.txt | 506,988 | 512 | from_waker(&third_waker)),
Poll::Pending
);
assert_eq!(sender.send(1), Ok(()));
assert_eq!(first_counter.0.load(Ordering::SeqCst), 1);
assert_eq!(second_counter.0.load(Ordering::SeqCst), 1);
assert_eq!(third_counter.0.load(Ordering::SeqCst), 1);
}
#[test]
fn receiver_churn_removes_waker_en... |
rust_dataset_chunk_506989 | rust_dataset.txt | 506,989 | 512 | (Barrier::new(RECEIVER_COUNT + 1));
let (completed_sender, completed_receiver) = mpsc::channel();
for mut receiver in receivers {
let barrier = barrier.clone();
let completed_sender = completed_sender.clone();
thread::spawn(move || {
let (waker, _) = counting_waker();
... |
rust_dataset_chunk_506990 | rust_dataset.txt | 506,990 | 512 | delaying
//! publication, or channel synchronization must not block a thread. It atomically publishes
//! immutable snapshots. [`snapshot::Receiver::snapshot`] marks the captured
//! version as seen and returns an owned handle that can outlive the receiver.
//! Stable subscriptions suit this implementation better than... |
rust_dataset_chunk_506991 | rust_dataset.txt | 506,991 | 512 | (&self) -> Receiver<T> {
let version = self.state.read().version;
Receiver {
state: self.state.clone(),
version,
}
}
pub fn send(&mut self, value: T) -> Result<(), NoReceiverError> {
if let Some(state) = Arc::get_mut(&mut self.state) {
let sta... |
rust_dataset_chunk_506992 | rust_dataset.txt | 506,992 | 512 | urious
// wake by the executor), we need to remove it manually.
if let Some(pending_waker_id) = this.pending_waker_id.take() {
state.wakers.remove(&pending_waker_id);
}
// Register the waker for this future.
let waker_id = state.next_waker_id.... |
rust_dataset_chunk_506993 | rust_dataset.txt | 506,993 | 512 | async fn test_basic_watch() {
let (mut sender, mut receiver) = channel(0);
assert_eq!(sender.send(1), Ok(()));
assert_eq!(receiver.recv().await, Ok(1));
assert_eq!(sender.send(2), Ok(()));
assert_eq!(sender.send(3), Ok(()));
assert_eq!(receiver.recv().await, Ok(3));
... |
rust_dataset_chunk_506994 | rust_dataset.txt | 506,994 | 512 | _id);
let mut timeout = executor.simulate_random_delay().fuse();
let mut recv = pin!(rx.recv().fuse());
select_biased! {
_ = timeout => {
zlog::info!("{}: dropping recv future", receiver_id);
... |
rust_dataset_chunk_506995 | rust_dataset.txt | 506,995 | 512 | for CloudWebSearchProvider {
fn id(&self) -> WebSearchProviderId {
WebSearchProviderId(ZED_WEB_SEARCH_PROVIDER_ID.into())
}
fn search(&self, query: String, cx: &mut App) -> Task<Result<WebSearchResponse>> {
let state = self.state.read(cx);
let client = state.client.clone();
... |
rust_dataset_chunk_506996 | rust_dataset.txt | 506,996 | 512 | WebSearchProviderId, WebSearchRegistry};
pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
let registry = WebSearchRegistry::global(cx);
registry.update(cx, |registry, cx| {
register_web_search_providers(registry, client, user_store, cx);
});
}
fn register_web_search_... |
rust_dataset_chunk_506997 | rust_dataset.txt | 506,997 | 512 | WebSearchProvider {
fn id(&self) -> WebSearchProviderId;
fn search(&self, query: String, cx: &mut App) -> Task<Result<WebSearchResponse>>;
}
struct GlobalWebSearchRegistry(Entity<WebSearchRegistry>);
impl Global for GlobalWebSearchRegistry {}
#[derive(Default)]
pub struct WebSearchRegistry {
providers: ... |
rust_dataset_chunk_506998 | rust_dataset.txt | 506,998 | 512 | Vec<PendingBinding>,
cx: &App,
) -> Vec<PendingBindingRow> {
let mut rows = group_bindings(bindings)
.into_iter()
.map(|row| {
let formatted_text = text_for_keybinding_keystrokes(&row.keystrokes, cx);
(row, formatted_text)
})
.collect::<Vec<_>>();
ro... |
rust_dataset_chunk_506999 | rust_dataset.txt | 506,999 | 512 | .iter()
.filter(|binding| binding.remaining_keystrokes.len() > 1)
.count();
if longer_count > 1
&& let Some(first_keystroke) = bindings
.first()
.and_then(|binding| binding.remaining_keystrokes.first())
.cloned()
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.