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_506800 | rust_dataset.txt | 506,800 | 512 | '=' => None,
'+' => cx.read_from_clipboard().map(|item| item.into()),
'*' => {
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
{
cx.read_from_primary().map(|item| item.into())
}
#[cfg(not(any(target_os =... |
rust_dataset_chunk_506801 | rust_dataset.txt | 506,801 | 512 | }
}
pub fn observe_insertion(&mut self, text: &Arc<str>, range_to_replace: Option<Range<isize>>) {
if self.ignore_current_insertion {
self.ignore_current_insertion = false;
return;
}
if self.dot_recording {
self.recording_actions.push(ReplayableActio... |
rust_dataset_chunk_506802 | rust_dataset.txt | 506,802 | 512 | ,
pub cmd_f_search: bool,
pub prior_selections: Vec<Range<Anchor>>,
pub prior_operator: Option<Operator>,
pub prior_mode: Mode,
pub helix_select: bool,
pub _dismiss_subscription: Option<gpui::Subscription>,
}
impl Operator {
pub fn id(&self) -> &'static str {
match self {
... |
rust_dataset_chunk_506803 | rust_dataset.txt | 506,803 | 512 | ixPrevious { .. } => "helix_previous",
Operator::HelixJump { .. } => "gw",
Operator::HelixSurroundAdd => "helix_ms",
Operator::HelixSurroundReplace { .. } => "helix_mr",
Operator::HelixSurroundDelete => "helix_md",
}
}
pub fn status(&self) -> String {
... |
rust_dataset_chunk_506804 | rust_dataset.txt | 506,804 | 512 | (_), ..
}
| Operator::DeleteSurrounds
| Operator::HelixJump { .. } => true,
Operator::Change
| Operator::Delete
| Operator::Yank
| Operator::Rewrap
| Operator::Indent
| Operator::Outdent
| Operator::A... |
rust_dataset_chunk_506805 | rust_dataset.txt | 506,805 | 512 | akBackward { .. }
| Operator::Mark
| Operator::Digraph { .. }
| Operator::Literal { .. }
| Operator::AddSurrounds { .. }
| Operator::ChangeSurrounds { .. }
| Operator::Jump { .. }
| Operator::Register
| Operator::RecordRegis... |
rust_dataset_chunk_506806 | rust_dataset.txt | 506,806 | 512 | .char_indices() {
if ix > 100 {
break;
}
let replace = match c {
'\t' => Some("\\t".to_string()),
'\n' => Some("\\n".to_string()),
'\r' => Some("\\r".to_string()),
c if is_invisible(c) => {
... |
rust_dataset_chunk_506807 | rust_dataset.txt | 506,807 | 512 | cx));
workspace.toggle_modal(window, cx, move |window, cx| {
RegistersView::new(editor, window, cx)
});
}
fn new(
editor: Option<Entity<Editor>>,
window: &mut Window,
cx: &mut Context<Picker<RegistersViewDelegate>>,
) -> Picker<RegistersViewDelegate> {
... |
rust_dataset_chunk_506808 | rust_dataset.txt | 506,808 | 512 | }
}
struct MarksMatch {
name: String,
position: Point,
info: MarksMatchInfo,
}
pub struct MarksViewDelegate {
selected_index: usize,
matches: Vec<MarksMatch>,
point_column_width: usize,
workspace: WeakEntity<Workspace>,
}
impl PickerDelegate for MarksViewDelegate {
type ListItem = Di... |
rust_dataset_chunk_506809 | rust_dataset.txt | 506,809 | 512 | ::new(
position.row,
snapshot.line_len(MultiBufferRow(position.row)),
),
LanguageAwareStyling {
tree_sitter: true,
diagnosti... |
rust_dataset_chunk_506810 | rust_dataset.txt | 506,810 | 512 | MarkLocation::Path(path) => {
if let Some(&position) = marks_state
.serialized_marks
.get(path.as_ref())
.and_then(|map| map.get(name))
.and_then(|points| points.f... |
rust_dataset_chunk_506811 | rust_dataset.txt | 506,811 | 512 | _match = self.matches.get(ix)?;
let mut left_output = String::new();
let mut left_runs = Vec::new();
left_output.push('`');
left_output.push_str(&mark_match.name);
left_runs.push((
0..left_output.len(),
HighlightStyle::color(cx.theme().colors().text_accen... |
rust_dataset_chunk_506812 | rust_dataset.txt | 506,812 | 512 | (&text_style, right_runs),
),
)
}
}
pub struct MarksView {}
impl MarksView {
fn register(workspace: &mut Workspace, _window: Option<&mut Window>) {
workspace.register_action(|workspace, _: &ToggleMarksView, window, cx| {
Self::toggle(workspace, window, cx);
... |
rust_dataset_chunk_506813 | rust_dataset.txt | 506,813 | 512 | OR REPLACE INTO vim_marks
(workspace_id, mark_name, path, value)
VALUES
(?, ?, ?, ?)
))?;
for (mark_name, value) in marks {
let pairs: Vec<(u32, u32)> = value
.into_iter()
.map(|point... |
rust_dataset_chunk_506814 | rust_dataset.txt | 506,814 | 512 | ) -> Result<Vec<(String, Arc<Path>)>> {
self.select_bound(sql!(
SELECT mark_name, path FROM vim_global_marks_paths
WHERE workspace_id = ?
))?(workspace_id)
}
pub(crate) async fn delete_global_marks_path(
&self,
workspace_id: WorkspaceId,
mark_name: S... |
rust_dataset_chunk_506815 | rust_dataset.txt | 506,815 | 512 | '"'),
SurroundPair::new('\'', '\''),
SurroundPair::new('`', '`'),
SurroundPair::new('|', '|'),
];
/// Bracket-only pairs for AnyBrackets matching.
pub const BRACKET_PAIRS: &[SurroundPair] = &[
SurroundPair::new('(', ')'),
SurroundPair::new('[', ']'),
SurroundPair::new('{', '}'),
SurroundPa... |
rust_dataset_chunk_506816 | rust_dataset.txt | 506,816 | 512 | if let Motion::CurrentLine = motion {
range.start = motion::first_non_whitespace(
&display_map,
false,
range.sta... |
rust_dataset_chunk_506817 | rust_dataset.txt | 506,817 | 512 | _pair.to_object() else {
return;
};
let pair = surround_pair.to_bracket_pair();
let surround = pair.end != *text;
self.update_editor(cx, |_, editor, cx| {
editor.transact(window, cx, |editor, window, cx| {
editor.set_clip_at_line_ends(false, cx);
... |
rust_dataset_chunk_506818 | rust_dataset.txt | 506,818 | 512 | _offsets.next() {
if ch.to_string() == pair.end {
let mut start = offset;
let end = start + 1usize;
if surround
&& let Some((next_ch, _)) = reverse_chars_and_of... |
rust_dataset_chunk_506819 | rust_dataset.txt | 506,819 | 512 | MultiBufferOffset)> =
Vec::new();
let snapshot = display_map.buffer_snapshot();
for anchors in &bracket_anchors {
let Some((open_anchor, close_anchor)) = anchors else {
continue;
... |
rust_dataset_chunk_506820 | rust_dataset.txt | 506,820 | 512 | });
});
});
}
}
/// **Only intended for use by the `cs` (change surrounds) operator.**
///
/// For each cursor, checks whether it is surrounded by a valid bracket pair for the given
/// object. Moves each cursor to the opening bracket of its found pair, and retu... |
rust_dataset_chunk_506821 | rust_dataset.txt | 506,821 | 512 | _)| ch.to_string() == pair.start)
.map(|(_, offset)| offset);
let close_offset = display_map
.reverse_buffer_chars_at(range_end)
.find(|(ch, _)| ch.to_string() == pair.end)
.map(|(_, ... |
rust_dataset_chunk_506822 | rust_dataset.txt | 506,822 | 512 | let display_map = editor.display_snapshot(cx);
let selections = editor.selections.all_adjusted_display(&display_map);
// Even if there's multiple cursors, we'll simply rely on the first one
// to understand what bracket pair to map to. I believe we could, if
/... |
rust_dataset_chunk_506823 | rust_dataset.txt | 506,823 | 512 | = object.range(&display_map, selection, true, None)?;
let start_offset = range.start.to_offset(&display_map, Bias::Left);
let (pair_char, _) = display_map.buffer_chars_at(start_offset).next()?;
literal_surround_pair(pair_char)
})
.ok()
... |
rust_dataset_chunk_506824 | rust_dataset.txt | 506,824 | 512 | : text.to_string(),
close: true,
surround: true,
newline: false,
})
}
/// Resolve a character to its surround pair using Helix semantics (no Vim aliases).
/// Returns None only for 'm' (match nearest). Unknown chars map to symmetric pairs.
pub fn surround_pair_for_char_helix... |
rust_dataset_chunk_506825 | rust_dataset.txt | 506,825 | 512 | jumps over
the lazy dog."},
Mode::Normal,
);
// test add surrounds with motion
cx.set_state(
indoc! {"
The quˇick brown
fox jumps over
the lazy dog."},
Mode::Normal,
);
cx.simulate_keystrokes("y... |
rust_dataset_chunk_506826 | rust_dataset.txt | 506,826 | 512 | the lazy dog."},
Mode::Normal,
);
cx.set_state(
indoc! {"
The quˇick brown•
fox jumps over
the lazy dog."},
Mode::Normal,
);
cx.simulate_keystrokes("y s s {");
cx.assert_state(
in... |
rust_dataset_chunk_506827 | rust_dataset.txt | 506,827 | 512 | ˇ{ quick } brown
fox jumps over
the lazy dog."},
Mode::Normal,
);
// test add surrounds not with around
cx.set_state(
indoc! {"
The quˇick brown
fox jumps over
the lazy dog."},
Mode::Normal,
... |
rust_dataset_chunk_506828 | rust_dataset.txt | 506,828 | 512 | fox jumps over
'
the lazy dog."},
Mode::Normal,
);
}
#[gpui::test]
async fn test_delete_surrounds(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
// test delete surround
cx.set_state(
indoc!... |
rust_dataset_chunk_506829 | rust_dataset.txt | 506,829 | 512 | �zy] dog."},
Mode::Normal,
);
cx.simulate_keystrokes("d s ]");
cx.assert_state(
indoc! {"
The ˇquick brown
fox jumps over
the ˇlazy dog."},
Mode::Normal,
);
// test multi cursor delete surrounds with around
... |
rust_dataset_chunk_506830 | rust_dataset.txt | 506,830 | 512 | Normal,
);
}
#[gpui::test]
async fn test_change_surrounds(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {"
The {quˇick} brown
fox jumps over
the lazy dog."},
Mode::... |
rust_dataset_chunk_506831 | rust_dataset.txt | 506,831 | 512 | ] dog."},
Mode::Normal,
);
cx.simulate_keystrokes("c s [ '");
cx.assert_state(
indoc! {"
The {quick} brown
fox jumps over
the ˇ'lazy' dog."},
Mode::Normal,
);
// test change nesting surrounds
cx.set_... |
rust_dataset_chunk_506832 | rust_dataset.txt | 506,832 | 512 | "
' ˇstr '
some example text here
ˇ' str '
"},
Mode::Normal,
);
cx.simulate_keystrokes("c s ' \"");
cx.assert_state(
indoc! {"
ˇ\" str \"
some example text here
ˇ\" str \"
"},
... |
rust_dataset_chunk_506833 | rust_dataset.txt | 506,833 | 512 | rokes("c s b {");
cx.assert_state(indoc! {"ˇ{ bracketed }"}, Mode::Normal);
cx.set_state(indoc! {"<braˇcketed>"}, Mode::Normal);
cx.simulate_keystrokes("c s b [");
cx.assert_state(indoc! {"ˇ[ bracketed ]"}, Mode::Normal);
cx.set_state(indoc! {"(braˇcketed)"}, Mode::Normal);
... |
rust_dataset_chunk_506834 | rust_dataset.txt | 506,834 | 512 | { bracketed }"}, Mode::Normal);
cx.set_state(indoc! {"<braˇcketed>"}, Mode::Normal);
cx.simulate_keystrokes("c s b [");
cx.assert_state(indoc! {"ˇ[ bracketed ]"}, Mode::Normal);
cx.set_state(indoc! {"(braˇcketed)"}, Mode::Normal);
cx.simulate_keystrokes("c s b [");
cx.a... |
rust_dataset_chunk_506835 | rust_dataset.txt | 506,835 | 512 | (indoc! {"ˇ` str `"}, Mode::Normal);
}
#[gpui::test]
async fn test_change_surrounds_mini_quotes(cx: &mut gpui::TestAppContext) {
// NOTE: needs TypeScript test cx to recognize single/backquotes
let mut cx = VimTestContext::new_typescript(cx).await;
// Update keybindings so that u... |
rust_dataset_chunk_506836 | rust_dataset.txt | 506,836 | 512 | quote to bracket adds one more space when the opening
// bracket is used, does not affect whitespace when the closing bracket
// is used.
cx.set_state(indoc! {"' ˇa '"}, Mode::Normal);
cx.simulate_keystrokes("c s ' {");
cx.assert_state(indoc! {"ˇ{ a }"}, Mode::Normal);
... |
rust_dataset_chunk_506837 | rust_dataset.txt | 506,837 | 512 | cx.simulate_keystrokes("c s } ]");
cx.assert_state(indoc! {"ˇ[ a ]"}, Mode::Normal);
}
#[gpui::test]
async fn test_surrounds(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state(
indoc! {"
The quˇick brown
... |
rust_dataset_chunk_506838 | rust_dataset.txt | 506,838 | 512 | ˇ{quick} brown
fox jumps over
the lazy dog."},
Mode::Normal,
);
cx.set_state(
indoc! {"
The quˇick brown
fox jumps over
the lazy dog."},
Mode::Normal,
);
cx.simulate_keystrokes("y s i w a");
... |
rust_dataset_chunk_506839 | rust_dataset.txt | 506,839 | 512 | .simulate_keystrokes("c s < b");
cx.assert_state(
indoc! {"
The ˇ(quick) brown
fox jumps over
the lazy dog."},
Mode::Normal,
);
cx.set_state(
indoc! {"
The (quˇick) brown
fox jumps over
t... |
rust_dataset_chunk_506840 | rust_dataset.txt | 506,840 | 512 | fox jumps over
the lazy dog."},
Mode::Normal,
);
cx.simulate_keystrokes("d s a");
cx.assert_state(
indoc! {"
The ˇquick brown
fox jumps over
the lazy dog."},
Mode::Normal,
);
}
#[test]
fn te... |
rust_dataset_chunk_506841 | rust_dataset.txt | 506,841 | 512 | struct NeovimBackedTestContext {
pub(crate) cx: VimTestContext,
pub(crate) neovim: NeovimConnection,
last_set_state: Option<String>,
recent_keystrokes: Vec<String>,
}
#[derive(Default)]
pub struct SharedState {
neovim: String,
editor: String,
initial: String,
neovim_mode: Mode,
ed... |
rust_dataset_chunk_506842 | rust_dataset.txt | 506,842 | 512 | state: SharedState,
}
impl SharedClipboard {
#[track_caller]
pub fn assert_eq(&self, expected: &str) {
if expected == self.neovim && self.neovim == self.editor {
return;
}
let message = if expected != self.neovim {
"Test is incorrect (currently expected != neov... |
rust_dataset_chunk_506843 | rust_dataset.txt | 506,843 | 512 | .name()
.expect("thread is not named")
.split(':')
.next_back()
.unwrap()
.to_string();
Self {
cx: VimTestContext::new_html(cx).await,
neovim: NeovimConnection::new(test_name).await,
last_set_state: None... |
rust_dataset_chunk_506844 | rust_dataset.txt | 506,844 | 512 | split(':')
.next_back()
.unwrap()
.to_string();
Self {
cx: VimTestContext::new_tsx(cx).await,
neovim: NeovimConnection::new(test_name).await,
last_set_state: None,
recent_keystrokes: Default::default(),
}
}
pub... |
rust_dataset_chunk_506845 | rust_dataset.txt | 506,845 | 512 | scrolling behavior
self.neovim.set_option(&format!("scrolloff={}", 3)).await;
// +2 to account for the vim command UI at the bottom.
self.neovim.set_option(&format!("lines={}", rows + 2)).await;
let (line_height, visible_line_count) = self.update_editor(|editor, window, cx| {
... |
rust_dataset_chunk_506846 | rust_dataset.txt | 506,846 | 512 | _string()),
recent_keystrokes: self.recent_keystrokes.join(" "),
}
}
#[must_use]
pub async fn simulate_at_each_offset(
&mut self,
keystrokes: &str,
marked_positions: &str,
) -> SharedState {
let (unmarked_text, cursor_offsets) = marked_text_offsets(ma... |
rust_dataset_chunk_506847 | rust_dataset.txt | 506,847 | 512 | Error,
};
#[cfg(feature = "neovim")]
use parking_lot::ReentrantMutex;
use serde::{Deserialize, Serialize};
#[cfg(feature = "neovim")]
use tokio::{
process::{Child, ChildStdin, Command},
task::JoinHandle,
};
use crate::state::Mode;
use collections::VecDeque;
// Neovim doesn't like to be started simultaneously ... |
rust_dataset_chunk_506848 | rust_dataset.txt | 506,848 | 512 | 1000 test runs you run out of swap file names)
.arg("-n")
// disable writing files (just in case)
.arg("-m"),
handler,
)
.await
.expect("Could not connect to neovim process");
nvim.ui_attach(100,... |
rust_dataset_chunk_506849 | rust_dataset.txt | 506,849 | 512 | special { ">" } else { "" };
let key = format!("{start}{shift}{ctrl}{alt}{cmd}{}{end}", keystroke.key);
self.data
.push_back(NeovimData::Key(keystroke_text.to_string()));
self.nvim
.input(&key)
.await
.expect("Could not input keystroke");
}
... |
rust_dataset_chunk_506850 | rust_dataset.txt | 506,850 | 512 | _empty() {
self.nvim
.input("v")
.await
.expect("could not enter visual mode");
let cursor = selection.end;
nvim_window
.set_cursor((cursor.row as i64 + 1, cursor.column as i64))
.await
.... |
rust_dataset_chunk_506851 | rust_dataset.txt | 506,851 | 512 | imData::Exec {
command: value.to_string(),
})
}
#[cfg(not(feature = "neovim"))]
pub async fn exec(&mut self, value: &str) {
if let Some(NeovimData::Get { .. }) = self.data.front() {
self.data.pop_front();
};
assert_eq!(
self.data.pop_front... |
rust_dataset_chunk_506852 | rust_dataset.txt | 506,852 | 512 | = self.read_position("echo line('.')").await - 1;
let mut cursor_col = self.read_position("echo col('.')").await - 1;
let mut selection_row = self.read_position("echo line('v')").await - 1;
let mut selection_col = self.read_position("echo col('v')").await - 1;
let total_rows = self.read... |
rust_dataset_chunk_506853 | rust_dataset.txt | 506,853 | 512 | 32 {
""
} else {
lines[(row - top) as usize]
};
let line_len = self
.read_position(format!("echo strlen(getline({}))", row + 1).as_str())
.await;
... |
rust_dataset_chunk_506854 | rust_dataset.txt | 506,854 | 512 | -record with --features=neovim");
}
}
fn test_data_path(test_case_id: &str) -> PathBuf {
let mut data_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
data_path.push("test_data");
data_path.push(format!("{}.json", test_case_id));
data_path
}
#[cfg(not(feature =... |
rust_dataset_chunk_506855 | rust_dataset.txt | 506,855 | 512 | derive(Clone)]
struct NvimHandler {}
#[cfg(feature = "neovim")]
#[async_trait]
impl Handler for NvimHandler {
type Writer = nvim_rs::compat::tokio::Compat<ChildStdin>;
async fn handle_request(
&self,
_event_name: String,
_arguments: Vec<Value>,
_neovim: Neovim<Self::Writer>,
... |
rust_dataset_chunk_506856 | rust_dataset.txt | 506,856 | 512 | if c == '\n' {
position.row += 1;
position.column = 0;
} else {
position.column += len_utf8 as u32;
}
}
byte_range
})
.collect::<Vec<_>>();
util::test::generate_marked_text(text, &byt... |
rust_dataset_chunk_506857 | rust_dataset.txt | 506,857 | 512 | mut cx = VimTestContext::new(cx, true).await;
cx.update_editor(|_, window, _| window.activate_window());
cx.run_until_parked();
for temporary_normal in [false, true] {
let expected_mode = if temporary_normal {
Mode::Insert
} else {
Mode::Normal
};
fo... |
rust_dataset_chunk_506858 | rust_dataset.txt | 506,858 | 512 | cx.simulate_shared_keystrokes("i").await;
cx.shared_state().await.assert_matches();
cx.simulate_shared_keystrokes("shift-t e s t space t e s t escape 0 d w")
.await;
cx.shared_state().await.assert_matches();
cx.assert_editor_state("ˇtest");
}
#[perf]
#[gpui::test]
async fn test_toggle_through_... |
rust_dataset_chunk_506859 | rust_dataset.txt | 506,859 | 512 | _testing(
vec![(
Point::new(0, 1)..Point::new(0, 4),
vec![Point::new(0, 7)..Point::new(0, 10)],
)],
cx,
)
.expect("linked edit ranges should be set");
});
cx.simulate_keystrokes("x");
cx.assert_e... |
rust_dataset_chunk_506860 | rust_dataset.txt | 506,860 | 512 | x).await;
cx.set_state("<diˇv></div>", Mode::Normal);
cx.update_editor(|editor, _window, cx| {
editor
.set_linked_edit_ranges_for_testing(
vec![(
Point::new(0, 1)..Point::new(0, 4),
vec![Point::new(0, 7)..Point::new(0, 10)],
... |
rust_dataset_chunk_506861 | rust_dataset.txt | 506,861 | 512 | _state("The quick brown fox ju«ˇmps» over the lazy dog");
// Ctrl-[ should behave like Esc
cx.simulate_keystrokes("ctrl-[");
cx.assert_editor_state("The quick brown fox juˇmps over the lazy dog");
}
#[perf]
#[gpui::test]
async fn test_buffer_search(cx: &mut gpui::TestAppContext) {
let mut cx = VimTest... |
rust_dataset_chunk_506862 | rust_dataset.txt | 506,862 | 512 | ");
}
#[perf]
#[gpui::test]
async fn test_end_of_line_with_times(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
// goes to current line end
cx.set_state(indoc! {"ˇaa\nbb\ncc"}, Mode::Normal);
cx.simulate_keystrokes("$");
cx.assert_editor_state("aˇa\nbb\ncc");
... |
rust_dataset_chunk_506863 | rust_dataset.txt | 506,863 | 512 | cx.simulate_keystrokes("> 2 j");
cx.assert_editor_state(" ˇaa\n bb\n cc\n");
cx.set_state("aa\nbb\nˇcc\n", Mode::Normal);
cx.simulate_keystrokes("> 2 k");
cx.assert_editor_state(" aa\n bb\n ˇcc\n");
// works with repeat
cx.set_state("a\nb\nccˇc\n", Mode::Normal);
cx.simu... |
rust_dataset_chunk_506864 | rust_dataset.txt | 506,864 | 512 | | {
cx.bind_keys([KeyBinding::new(
"j j",
SwitchToNormalMode,
Some("vim_mode == insert"),
)]);
});
cx.set_state("hello worldˇ\n", Mode::Insert);
cx.simulate_keystrokes("j j");
cx.assert_state("hello worldˇ\n", Mode::Normal);
cx.simulate_keystrokes... |
rust_dataset_chunk_506865 | rust_dataset.txt | 506,865 | 512 | Bar>()
.expect("Buffer search bar should be deployed")
});
cx.update_entity(search_bar, |bar, _, cx| {
assert_eq!(bar.query(cx), "cc");
});
cx.update_editor(|editor, window, cx| {
let highlights = editor.all_text_background_highlights(window, cx);
assert_eq!(3, high... |
rust_dataset_chunk_506866 | rust_dataset.txt | 506,866 | 512 | cx.assert_state(
indoc! { r#"
<div><a class="bg-«redˇ»"></a></div>
"#
},
Mode::Visual,
)
}
#[perf]
#[gpui::test]
async fn test_join_lines(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
ˇo... |
rust_dataset_chunk_506867 | rust_dataset.txt | 506,867 | 512 | one
twothreefourˇfive
six
"});
}
#[perf]
#[gpui::test]
async fn test_join_lines_rust_dereference(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
for dereference in ["*value.get()", "* value.get()"] {
let initial = formatdoc! {"
ˇle... |
rust_dataset_chunk_506868 | rust_dataset.txt | 506,868 | 512 | k g shift-j",
] {
cx.assert_binding_normal(keystrokes, &initial, &joined);
}
for keystrokes in [
"3 g shift-j",
"v 2 j g shift-j",
"shift-v 2 j g shift-j",
"2 j v 2 k g shift-j",
"2 j shift-v 2 k g shift-j",
] {
... |
rust_dataset_chunk_506869 | rust_dataset.txt | 506,869 | 512 | cx.shared_state().await.assert_eq(indoc! {"
ˇtwelve char twelve char
twelve char
"});
cx.simulate_shared_keystrokes("g $").await;
cx.shared_state().await.assert_eq(indoc! {"
twelve charˇ twelve char
twelve char
"});
cx.simulate_shared_keystrokes("$").await;
c... |
rust_dataset_chunk_506870 | rust_dataset.txt | 506,870 | 512 | oc! {"
twelve char
ˇo
twelve char twelve char
twelve char
"});
// line wraps as:
// fourteen ch
// ar
// fourteen ch
// ar
cx.set_shared_state(indoc! { "
fourteen chaˇr
fourteen char
"})
.await;
cx.simulate_shared_keystrokes("... |
rust_dataset_chunk_506871 | rust_dataset.txt | 506,871 | 512 | ystrokes("down y y").await;
cx.shared_clipboard()
.await
.assert_eq(" barp()\n bazp()\n");
// re-open
cx.simulate_shared_keystrokes("z o").await;
cx.shared_state().await.assert_eq(indoc! {"
fn boop() {
ˇ barp()
bazp()
}
"});
}
#[perf]
#[gpui::te... |
rust_dataset_chunk_506872 | rust_dataset.txt | 506,872 | 512 | fn test_zero(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
The quˇick brown
fox jumps over
the lazy dog"})
.await;
cx.simulate_shared_keystrokes("0").await;
cx.shared_state().await.assert_eq(indoc! {... |
rust_dataset_chunk_506873 | rust_dataset.txt | 506,873 | 512 | 789012😃😃"
})
.await;
cx.simulate_shared_keystrokes("j").await;
cx.shared_state().await.assert_eq(indoc! {"
123456789012aaaa
123456789012😃ˇ😃"
});
cx.set_shared_state(indoc! {"
123456789012aaaaˇaaaaaaaa123456789012
wow
123456789012😃😃😃😃😃😃1234567890... |
rust_dataset_chunk_506874 | rust_dataset.txt | 506,874 | 512 | ::new(cx, true).await;
cx.set_state(
indoc! {"
defmodule Test do
def test(a, ˇ[_, _] = b), do: IO.puts('hi')
end
"},
Mode::Normal,
);
cx.simulate_keystrokes("g a");
cx.assert_state(
indoc! {"
defmodule Test do
def test(a, «[ˇ»_... |
rust_dataset_chunk_506875 | rust_dataset.txt | 506,875 | 512 | �one ˇone ˇone", Mode::Normal);
cx.simulate_keystrokes("i j");
cx.simulate_keystrokes("k");
cx.assert_state("ˇjkone ˇjkone ˇjkone", Mode::Insert);
assert_pending_input(&mut cx, "«jk»one «jk»one «jk»one");
cx.simulate_keystrokes("o j k");
cx.assert_state("jkoˇjkone jkoˇjkone jkoˇjkone", Mode::Ins... |
rust_dataset_chunk_506876 | rust_dataset.txt | 506,876 | 512 | (Duration::from_millis(500));
cx.run_until_parked();
cx.assert_state("ˇjhello", Mode::Insert);
cx.update_editor(|editor, window, cx| {
let snapshot = editor.snapshot(window, cx);
let highlights = editor
.text_highlights(editor::HighlightKey::PendingInput, cx)
.unwrap(... |
rust_dataset_chunk_506877 | rust_dataset.txt | 506,877 | 512 | f o ; , w").await;
cx.shared_state()
.await
.assert_eq("hello hello\nhello hellˇo");
cx.set_shared_state("ˇhello hello\nhello hello").await;
cx.simulate_shared_keystrokes("f o ; , i").await;
cx.shared_state()
.await
.assert_eq("hellˇo hello\nhello hello");
}
#[perf]
#[g... |
rust_dataset_chunk_506878 | rust_dataset.txt | 506,878 | 512 | {
let binding = editor.context_menu().borrow();
let Some(CodeContextMenu::Completions(menu)) = binding.as_ref() else {
panic!("Should have completions menu open");
};
assert_eq!(menu.scroll_handle_aside.offset().y, initial_offset);
});
// The `ctrl-d` shortcut shou... |
rust_dataset_chunk_506879 | rust_dataset.txt | 506,879 | 512 | .clone()),
lsp::TextEdit::new(tgt_range, params.new_name),
],
)]
.into(),
),
..Default::default()
}))
});
cx.simulate_keystrokes("c d");
prepare_request.next().await.u... |
rust_dataset_chunk_506880 | rust_dataset.txt | 506,880 | 512 | mut cx = VimTestContext::new_typescript(cx).await;
cx.set_state("const before = 2; console.log(beforˇe)", Mode::Normal);
let def_range = cx.lsp_range("const «beforeˇ» = 2; console.log(before)");
let mut go_to_request =
cx.set_request_handler::<lsp::request::GotoDefinition, _, _>(move |url, _, _| a... |
rust_dataset_chunk_506881 | rust_dataset.txt | 506,881 | 512 | cx.update(|_, cx| {
cx.bind_keys([KeyBinding::new(
"g w",
workspace::SendKeystrokes(": j o i n space l i n e s enter".to_string()),
None,
)])
});
cx.set_state("ˇ1234\n56789", Mode::Normal);
cx.simulate_keystrokes("g w");
cx.assert_state("1234ˇ 56789",... |
rust_dataset_chunk_506882 | rust_dataset.txt | 506,882 | 512 | _keystrokes("u").await;
cx.shared_state().await.assert_eq("hello ˇquoel world");
cx.set_shared_state("hello quˇoel world").await;
cx.simulate_shared_keystrokes("v i w ~ u").await;
cx.shared_state().await.assert_eq("hello ˇquoel world");
cx.set_shared_state("\nhello quˇoel world\n").await;
cx.s... |
rust_dataset_chunk_506883 | rust_dataset.txt | 506,883 | 512 | ˇ; }", Mode::Normal);
cx.simulate_keystroke("i");
cx.simulate_keystroke("2");
cx.assert_state("fn main() { let a = 2ˇ; }", Mode::Insert);
cx.simulate_keystroke(".");
let completion_item = lsp::CompletionItem {
text_edit: Some(lsp::CompletionTextEdit::Edit(lsp::TextEdit {
range:... |
rust_dataset_chunk_506884 | rust_dataset.txt | 506,884 | 512 | );
cx.set_state("fn main() { let a = ˇ }", Mode::Normal);
cx.simulate_keystroke("i");
cx.set_state("fn main() { let a = ˇ }", Mode::Insert);
cx.simulate_keystroke("2");
cx.simulate_keystroke(";");
cx.assert_state("fn main() { let a = 2;ˇ }", Mode::Insert);
cx.simulate_keystroke("escape")... |
rust_dataset_chunk_506885 | rust_dataset.txt | 506,885 | 512 | _, _| {
let task_completion_item = closure_completion_item.clone();
async move {
Ok(Some(lsp::CompletionResponse::Array(vec![
task_completion_item,
])))
}
});
request.next().await;
cx.condition(|editor, _| editor.context_menu_visible())
... |
rust_dataset_chunk_506886 | rust_dataset.txt | 506,886 | 512 | ("one tˇwo three four");
cx.simulate_mouse_down(click_pos, MouseButton::Left, Modifiers::none());
cx.run_until_parked();
cx.simulate_mouse_move(drag_left, MouseButton::Left, Modifiers::none());
cx.run_until_parked();
cx.assert_state("«ˇone t»wo three four", Mode::Visual);
cx.simulate_mouse_mo... |
rust_dataset_chunk_506887 | rust_dataset.txt | 506,887 | 512 | ("v j escape k k").await;
cx.simulate_shared_keystrokes("' <").await;
cx.shared_state().await.assert_eq(indoc! {"
Line one
Line two
ˇLine three
Line four
Line five
"});
cx.simulate_shared_keystrokes("` <").await;
cx.shared_state().await.assert_eq(indoc! {"
... |
rust_dataset_chunk_506888 | rust_dataset.txt | 506,888 | 512 | });
cx.simulate_shared_keystrokes("` ^").await;
cx.shared_state().await.assert_eq(indoc! {"
Line one
Line two
Line three
Straight thingˇ four
Line five
"
});
cx.simulate_shared_keystrokes("k a ! escape k g i ?").await;
cx.shared_state().await.assert_... |
rust_dataset_chunk_506889 | rust_dataset.txt | 506,889 | 512 | Normal,
);
// works in visual line mode
cx.simulate_keystrokes("shift-v j g c");
cx.assert_state(
indoc! {"
// ˇone
two
three
"},
Mode::Normal,
);
// works with count
cx.simulate_keystrokes("g c 2 j");
cx.assert_state(
ind... |
rust_dataset_chunk_506890 | rust_dataset.txt | 506,890 | 512 | "
/* ˇone
two */
three
"},
Mode::Normal,
);
// works in visual mode and restores the cursor to the selection start
cx.set_state(
indoc! {"
«oneˇ»
two
three
"},
Mode::Visual,
);
cx.simulate_keystrokes("g b");
... |
rust_dataset_chunk_506891 | rust_dataset.txt | 506,891 | 512 | AppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.update(|_window, cx| {
cx.bind_keys([
KeyBinding::new(
"s",
PushSneak { first_char: None },
Some("vim_mode == normal"),
),
KeyBinding::new(
... |
rust_dataset_chunk_506892 | rust_dataset.txt | 506,892 | 512 | ("-").await;
cx.shared_state().await.assert_matches();
cx.simulate_shared_keystrokes("+").await;
cx.shared_state().await.assert_matches();
}
#[perf]
#[gpui::test]
async fn test_command_alias(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.update_global(|store: ... |
rust_dataset_chunk_506893 | rust_dataset.txt | 506,893 | 512 | {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.update(|_, cx| {
cx.bind_keys([
KeyBinding::new(
"p i n",
workspace::SendKeystrokes("📌".to_string()),
Some("vim_mode == insert"),
),
KeyBinding::new(
... |
rust_dataset_chunk_506894 | rust_dataset.txt | 506,894 | 512 | ovim.exec("noremap x \"_x").await;
cx.neovim.exec("map y 2x").await;
cx.set_shared_state("ˇhello").await;
cx.simulate_shared_keystrokes("d l").await;
cx.shared_clipboard().await.assert_eq("h");
cx.simulate_shared_keystrokes("y").await;
cx.shared_clipboard().await.assert_eq("h");
cx.shared_s... |
rust_dataset_chunk_506895 | rust_dataset.txt | 506,895 | 512 | ystrokes(".").await;
cx.simulate_shared_keystrokes(".").await;
cx.simulate_shared_keystrokes(".").await;
cx.shared_state().await.assert_eq("ˇhello world");
}
#[perf]
#[gpui::test]
async fn test_blackhole_register(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
... |
rust_dataset_chunk_506896 | rust_dataset.txt | 506,896 | 512 | hello_world();
ˇ}"
})
.await;
cx.simulate_shared_keystrokes("(").await;
cx.shared_state().await.assert_eq(indoc! {
"ˇ{
hello_world();
}"
});
cx.set_shared_state(indoc! {
"Hello! World..?
\tHello! World... ˇ"
})
.await;
cx.simulat... |
rust_dataset_chunk_506897 | rust_dataset.txt | 506,897 | 512 | cx.shared_state().await.assert_eq("ˇllllllworld.");
cx.simulate_shared_keystrokes("ctrl-o v f w d").await;
cx.shared_state().await.assert_eq("ˇorld.");
}
#[perf]
#[gpui::test]
async fn test_ctrl_o_position(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set... |
rust_dataset_chunk_506898 | rust_dataset.txt | 506,898 | 512 | window, cx);
let buffer_ids = multi_buffer
.read(cx)
.snapshot(cx)
.excerpts()
.map(|excerpt| excerpt.context.start.buffer_id)
.collect::<Vec<_>>();
// fold all but the second buffer, so that we test navigating between two
// adjacent... |
rust_dataset_chunk_506899 | rust_dataset.txt | 506,899 | 512 | FOLDED]
[EXCERPT]
aaa
bbb
[EXCERPT]
[FOLDED]
[EXCERPT]
ˇ[FOLDED]
"
});
cx.simulate_keystroke("k");
cx.assert_excerpts_with_selections(indoc! {"
[EXCERPT]
[FOLDED]
[EXCERPT]
aaa
bbb
[EXCERPT]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.