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_506700 | rust_dataset.txt | 506,700 | 512 | "
})
.await;
cx.simulate_shared_keystrokes("/ a a").await;
cx.simulate_shared_keystrokes("enter").await;
cx.shared_state().await.assert_eq(indoc! {
"aa ˇaa aa"
});
cx.simulate_shared_keystrokes("left / a a").await;
cx.simulate_shared_keystro... |
rust_dataset_chunk_506701 | rust_dataset.txt | 506,701 | 512 | New"
});
}
#[gpui::test]
async fn test_replace_g(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {
"ˇaa aa aa aa
aa
aa"
})
.await;
cx.simulate_shared_keystro... |
rust_dataset_chunk_506702 | rust_dataset.txt | 506,702 | 512 | ystrokes("enter").await;
cx.shared_state().await.assert_eq(indoc! {
"ˇbb bb bb bb
aa
aa"
});
// With gdefault on, :s///g replaces only the first match.
cx.simulate_shared_keystrokes(": s / b b / c c / g").await;
cx.simulate_shared_keys... |
rust_dataset_chunk_506703 | rust_dataset.txt | 506,703 | 512 | "
},
Mode::Normal,
);
}
#[gpui::test]
async fn test_replace_with_range(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {
"ˇa
a
a
a
a
... |
rust_dataset_chunk_506704 | rust_dataset.txt | 506,704 | 512 | apple\nbanana\ncherry\n", Mode::Normal);
// Move cursor to line 2
cx.simulate_keystrokes("j");
cx.run_until_parked();
cx.assert_state("apple\nˇbanana\ncherry\n", Mode::Normal);
// Open search and type query for something that doesn't exist
cx.simulate_keystrokes("/ n o ... |
rust_dataset_chunk_506705 | rust_dataset.txt | 506,705 | 512 | .
// The cursor should be at the match location on line 3 (row 2).
cx.assert_state("hello world\nfoo bar\nhello ˇagain\n", Mode::Normal);
}
#[gpui::test]
async fn test_vim_search_respects_search_settings(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).awa... |
rust_dataset_chunk_506706 | rust_dataset.txt | 506,706 | 512 | ::{Editor, SelectionEffects, movement};
use gpui::{Context, Window, actions};
use language::Point;
actions!(
vim,
[
/// Substitutes characters in the current selection.
Substitute,
/// Substitutes the entire line.
SubstituteLine
]
);
pub(crate) fn register(editor: &mut Edit... |
rust_dataset_chunk_506707 | rust_dataset.txt | 506,707 | 512 | let Some((point, _)) = (Motion::FirstNonWhitespace {
display_lines: false,
})
.move_point(
map,
selection.start,
selection.goal,
... |
rust_dataset_chunk_506708 | rust_dataset.txt | 506,708 | 512 | end of line
cx.set_state(indoc! {"ˇabc\n"}, Mode::Normal);
cx.simulate_keystrokes("5 s x");
cx.assert_editor_state("xˇ\n");
// it handles multibyte characters
cx.set_state(indoc! {"ˇcàfé\n"}, Mode::Normal);
cx.simulate_keystrokes("4 s");
cx.assert_editor_state("... |
rust_dataset_chunk_506709 | rust_dataset.txt | 506,709 | 512 | Context::new(cx).await;
cx.simulate(
"shift-v c",
indoc! {"
The quˇick brown
fox jumps over
the lazy dog"},
)
.await
.assert_matches();
// Test pasting code copied on change
cx.simulate_shared_keystrokes("escape ... |
rust_dataset_chunk_506710 | rust_dataset.txt | 506,710 | 512 | oc! {"
The quick brown
oˇ
"});
// visual mode including newline
cx.set_shared_state(initial_state).await;
cx.simulate_shared_keystrokes("v $ shift-s o").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick brown
oˇ
... |
rust_dataset_chunk_506711 | rust_dataset.txt | 506,711 | 512 | }
pub fn toggle_comments_object(
&mut self,
object: Object,
around: bool,
times: Option<usize>,
window: &mut Window,
cx: &mut Context<Self>,
) {
self.stop_recording(cx);
self.update_editor(cx, |_, editor, cx| {
editor.transact(window,... |
rust_dataset_chunk_506712 | rust_dataset.txt | 506,712 | 512 | {
s.move_with(&mut |map, selection| {
let anchor = selection_starts.remove(&selection.id).unwrap();
selection.collapse_to(anchor.to_display_point(map), SelectionGoal::None);
});
});
});
});
}... |
rust_dataset_chunk_506713 | rust_dataset.txt | 506,713 | 512 | (window, cx, |editor, window, cx| {
editor.set_clip_at_line_ends(false, cx);
let mut original_positions: HashMap<_, _> = Default::default();
let mut kind = None;
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
... |
rust_dataset_chunk_506714 | rust_dataset.txt | 506,714 | 512 | |s| {
s.move_with(&mut |_, selection| {
let (head, goal) = start_positions.remove(&selection.id).unwrap();
selection.collapse_to(head, goal);
});
});
});
});
self.exit_temporary_normal(wi... |
rust_dataset_chunk_506715 | rust_dataset.txt | 506,715 | 512 | = false;
} else {
text.push('\n');
}
let initial_len = text.len();
let start_anchor = buffer.anchor_after(start);
let end_anchor = buffer.anchor_before(end);
ranges_to_highlight.push(start_anchor..end_a... |
rust_dataset_chunk_506716 | rust_dataset.txt | 506,716 | 512 | _buffer::MultiBufferRow;
use schemars::JsonSchema;
use serde::Deserialize;
use ui::Context;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Deserialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum Object {
Word { ignore_punctuation: bool },
Subword { ignore_punctuation: bool },
Sentence,
Para... |
rust_dataset_chunk_506717 | rust_dataset.txt | 506,717 | 512 | , JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_unknown_fields)]
struct AngleBrackets {
#[serde(default)]
opening: bool,
}
/// Operates on text within or around curly brackets `{}`.
#[derive(Clone, Deserialize, JsonSchema, PartialEq, Action)]
#[action(namespace = vim)]
#[serde(deny_un... |
rust_dataset_chunk_506718 | rust_dataset.txt | 506,718 | 512 | bool;
pub(crate) struct DelimiterRange {
pub(crate) open: Range<MultiBufferOffset>,
pub(crate) close: Range<MultiBufferOffset>,
}
impl DelimiterRange {
pub(crate) fn to_display_range(
&self,
map: &DisplaySnapshot,
around: bool,
) -> Range<DisplayPoint> {
if around {
... |
rust_dataset_chunk_506719 | rust_dataset.txt | 506,719 | 512 | the current pair;
// every other exact match expands to the enclosing pair.
if selects_around || (selects_inside && !around) {
return false;
}
}
is_surround_pair_delimiter(buffer, open, close)
};
let Some((open,... |
rust_dataset_chunk_506720 | rust_dataset.txt | 506,720 | 512 | snapshot.range_to_buffer_range::<MultiBufferOffset>(close.clone())?;
if is_valid_delimiter(buffer, buffer_open.start, buffer_close.start) {
Some((open, close))
} else {
None
}
})
});
if let Some(candidate)... |
rust_dataset_chunk_506721 | rust_dataset.txt | 506,721 | 512 | '[' | '{' | '<' | '|')
)
}
fn find_mini_quotes(
map: &DisplaySnapshot,
display_point: DisplayPoint,
around: bool,
) -> Option<Range<DisplayPoint>> {
find_mini_delimiters(map, display_point, around, &is_quote_delimiter)
}
fn find_mini_brackets(
map: &DisplaySnapshot,
display_point: Display... |
rust_dataset_chunk_506722 | rust_dataset.txt | 506,722 | 512 | );
Vim::action(editor, cx, |vim, _: &Tag, window, cx| {
vim.object(Object::Tag, window, cx)
});
Vim::action(editor, cx, |vim, _: &Sentence, window, cx| {
vim.object(Object::Sentence, window, cx)
});
Vim::action(editor, cx, |vim, _: &Paragraph, window, cx| {
vim.object(Obj... |
rust_dataset_chunk_506723 | rust_dataset.txt | 506,723 | 512 | , action: &CurlyBrackets, window, cx| {
vim.object_impl(Object::CurlyBrackets, action.opening, window, cx)
});
Vim::action(editor, cx, |vim, action: &AngleBrackets, window, cx| {
vim.object_impl(Object::AngleBrackets, action.opening, window, cx)
});
Vim::action(editor, cx, |vim, _: &Vert... |
rust_dataset_chunk_506724 | rust_dataset.txt | 506,724 | 512 | Select => {
self.visual_object(object, count, window, cx)
}
Mode::Insert | Mode::Replace => {
// Shouldn't execute a text object in insert mode. Ignoring
}
}
}
}
impl Object {
pub fn is_multiline(self) -> bool {
match self {
... |
rust_dataset_chunk_506725 | rust_dataset.txt | 506,725 | 512 | Object::BackQuotes
| Object::DoubleQuotes => {
if current_mode == Mode::VisualBlock {
Mode::VisualBlock
} else {
Mode::Visual
}
}
Object::Parentheses
| Object::AnyBrackets
... |
rust_dataset_chunk_506726 | rust_dataset.txt | 506,726 | 512 | ', '`')
}
Object::AnyQuotes => {
let cursor_offset = relative_to.to_offset(map, Bias::Left);
// Find innermost range directly without collecting all ranges
let mut innermost = None;
let mut min_size = usize::MAX;
/... |
rust_dataset_chunk_506727 | rust_dataset.txt | 506,727 | 512 | around)
}
Object::AnyBrackets => {
let cursor_offset = relative_to.to_offset(map, Bias::Left);
// Find innermost enclosing bracket range
let mut innermost = None;
let mut min_size = usize::MAX;
for &SurroundPair {... |
rust_dataset_chunk_506728 | rust_dataset.txt | 506,728 | 512 | self.is_multiline(), '<', '>')
}
Object::Method => text_object(
map,
relative_to,
if around {
TextObject::AroundFunction
} else {
TextObject::InsideFunction
},
),
... |
rust_dataset_chunk_506729 | rust_dataset.txt | 506,729 | 512 | left, right| classifier.kind(left) != classifier.kind(right),
);
let mut is_boundary = |left: char, right: char| classifier.kind(left) != classifier.kind(right);
for _ in 1..times {
let kind_at_end = map
.buffer_chars_at(end.to_offset(map, Bias::Right))
.next()
... |
rust_dataset_chunk_506730 | rust_dataset.txt | 506,730 | 512 | _word_start = classifier.kind(left) != classifier.kind(right);
is_word_start || is_subword_start(left, right, "._-")
},
)
};
let end = movement::find_boundary(
map,
relative_to,
FindRange::SingleLine,
&mut |left, right| {
let is_wo... |
rust_dataset_chunk_506731 | rust_dataset.txt | 506,731 | 512 | = last_child_node {
if cur_node.child_count() >= 2 {
let first_child = cur_node.child(0);
let last_child = cur_node.child(cur_node.child_count() - 1);
if let (Some(first_child), Some(last_child)) = (first_child, last_child) {
... |
rust_dataset_chunk_506732 | rust_dataset.txt | 506,732 | 512 | unctuation);
let in_word = map
.buffer_chars_at(offset)
.next()
.map(|(c, _)| !classifier.is_whitespace(c))
.unwrap_or(false);
if in_word {
around_containing_word(map, relative_to, ignore_punctuation, times)
} else {
around_next_word(map, relative_to, ignore_... |
rust_dataset_chunk_506733 | rust_dataset.txt | 506,733 | 512 | (map, Bias::Left))
.take_while(|(ch, offset)| {
offset < &range.start.to_offset(map, Bias::Left) && ch.is_whitespace()
})
.count()
> 0;
if is_first_word {
// For first word on line, trim indentation
let mut expanded = expan... |
rust_dataset_chunk_506734 | rust_dataset.txt | 506,734 | 512 | DisplaySnapshot,
relative_to: DisplayPoint,
target: TextObject,
) -> Option<Range<DisplayPoint>> {
let snapshot = &map.buffer_snapshot();
let offset = relative_to.to_offset(map, Bias::Left);
let results =
snapshot.map_excerpt_ranges(offset..offset, |buffer, _excerpt_range, buffer_range| {
... |
rust_dataset_chunk_506735 | rust_dataset.txt | 506,735 | 512 | _snapshot();
let offset = relative_to.to_offset(map, Bias::Left);
fn comma_delimited_range_at(
buffer: &BufferSnapshot,
mut offset: BufferOffset,
include_comma: bool,
) -> Option<Range<BufferOffset>> {
offset += buffer
.chars_at(offset)
.take_while(|c... |
rust_dataset_chunk_506736 | rust_dataset.txt | 506,736 | 512 | () {
let prev = cursor.node();
if prev.start_byte() < open_bracket.end {
start = open_bracket.end;
break;
} else if prev.kind() == "," {
if needs_surrounding_comma {
start = prev.start_byte();
ne... |
rust_dataset_chunk_506737 | rust_dataset.txt | 506,737 | 512 | break;
}
start_row = prev_row;
}
// Loop forwards until we find a non-blank line with less indent
let mut end_row = row;
let max_rows = map.buffer_snapshot().max_row().0;
for next_row in (row + 1)..=max_rows {
let indent = map.line_indent_for_buffer_row(MultiBufferRow(next_... |
rust_dataset_chunk_506738 | rust_dataset.txt | 506,738 | 512 | _sentence_end(map, end) {
break;
}
}
let mut range = start.unwrap_or(previous_end).to_display_point(map)..end.to_display_point(map);
if around {
range = expand_to_include_whitespace(map, range, false);
}
Some(range)
}
fn is_possible_sentence_start(character: char) -> b... |
rust_dataset_chunk_506739 | rust_dataset.txt | 506,739 | 512 | || !stop_at_newline {
range.end = offset + char.len_utf8();
whitespace_included = true;
}
} else {
// Found non whitespace. Quit out.
break;
}
}
if !whitespace_included {
for (char, point) in map.reverse_buffer_chars_a... |
rust_dataset_chunk_506740 | rust_dataset.txt | 506,740 | 512 | .row != 0 {
let previous_paragraph_last_line_start =
Point::new(paragraph_start_buffer_point.row - 1, 0).to_display_point(map);
paragraph_start = start_of_paragraph(map, previous_paragraph_last_line_start);
}
} else {
... |
rust_dataset_chunk_506741 | rust_dataset.txt | 506,741 | 512 | return Point::new(
previous_row,
map.buffer_snapshot().line_len(MultiBufferRow(previous_row)),
)
.to_display_point(map);
}
}
map.max_point()
}
pub fn surrounding_markers(
map: &DisplaySnapshot,
relative_to: DisplayPoint,
around: bool... |
rust_dataset_chunk_506742 | rust_dataset.txt | 506,742 | 512 | ;
}
}
before_ch = ch;
}
}
let mut opening = opening?;
let mut matched_opens = 0;
let mut closing = None;
before_ch = match movement::chars_before(map, opening.end).next() {
Some((ch, _)) => ch,
_ => '\0',
};
for (ch, range) i... |
rust_dataset_chunk_506743 | rust_dataset.txt | 506,743 | 512 | , offset) in map.reverse_buffer_chars_at(end_offset) {
if !ch.is_whitespace() {
last_non_ws = Some(offset + ch.len_utf8());
break;
}
}
if let Some(start) = first_non_ws {
opening.end = start;
}
... |
rust_dataset_chunk_506744 | rust_dataset.txt | 506,744 | 512 | .await
.assert_matches();
}
#[gpui::test]
async fn test_delete_word_object(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.simulate_at_each_offset("d i w", WORD_LOCATIONS)
.await
.assert_matches();
cx.sim... |
rust_dataset_chunk_506745 | rust_dataset.txt | 506,745 | 512 | ").await;
cx.shared_state().await.assert_matches();
cx.set_shared_state("ˇone two three four").await;
cx.simulate_shared_keystrokes("d 2 a w").await;
cx.shared_state().await.assert_matches();
// WORD (shift-w) ignores punctuation
cx.set_shared_state("ˇone-two three-four... |
rust_dataset_chunk_506746 | rust_dataset.txt | 506,746 | 512 | _shared_state("ˇone\ntwo\nthree").await;
cx.simulate_shared_keystrokes("2 d i w").await;
cx.shared_state().await.assert_matches();
cx.set_shared_state("one ˇtwo\nthree four").await;
cx.simulate_shared_keystrokes("2 d a w").await;
cx.shared_state().await.assert_matches();
}
... |
rust_dataset_chunk_506747 | rust_dataset.txt | 506,747 | 512 | mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
for paragraph_example in PARAGRAPH_EXAMPLES {
cx.simulate_at_each_offset("c i p", paragraph_example)
.await
.assert_matches();
cx.simulate_at_each_offset("c a p", par... |
rust_dataset_chunk_506748 | rust_dataset.txt | 506,748 | 512 | when soft wrap is enabled and line length is ˇlimited making it span multiple display lines.
ˇSecond paragraph that is also quite long and will definitely wrap under soft wrap conditions and ˇshould be handled correctly.
ˇThird paragraph with additional long text content that will also wrap w... |
rust_dataset_chunk_506749 | rust_dataset.txt | 506,749 | 512 | AppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
const WRAPPING_EXAMPLE: &str = indoc! {"
ˇFirst paragraph with very long text that will wrap when soft wrap is enabled and line length is ˇlimited making it span multiple display lines.
ˇSecond paragraph that is... |
rust_dataset_chunk_506750 | rust_dataset.txt | 506,750 | 512 | _at_each_offset(&format!("c a {end}"), &marked_string)
.await
.assert_matches();
}
}
#[gpui::test]
async fn test_singleline_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_share... |
rust_dataset_chunk_506751 | rust_dataset.txt | 506,751 | 512 | v a \"").await;
cx.shared_state().await.assert_eq(indoc! {
"hello «\"world\" ˇ»
goodbye"
});
}
#[gpui::test]
async fn test_multiline_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.s... |
rust_dataset_chunk_506752 | rust_dataset.txt | 506,752 | 512 | a == \"\" {
return true
}
return falseˇ»
}"
},
Mode::Visual,
);
cx.set_state(
indoc! {
"func empty(a string) bool {
if a == \"\" {
... |
rust_dataset_chunk_506753 | rust_dataset.txt | 506,753 | 512 | boop() {
baz(|| { bar(ˇ|j, k| { })})
}"
},
Mode::Normal,
);
cx.simulate_keystrokes("v a |");
cx.assert_state(
indoc! {"
fn boop() {
baz(|| { bar(«|j, k| ˇ»{ })})
}"
},
... |
rust_dataset_chunk_506754 | rust_dataset.txt | 506,754 | 512 | cx.set_state("let a = [test::call(ˇ), 300];", Mode::Normal);
cx.simulate_keystrokes("c i a");
cx.assert_state("let a = [ˇ, 300];", Mode::Insert);
cx.set_state(
"let a = vec![Vec::new(), vecˇ![test::call(), 300]];",
Mode::Normal,
);
cx.simulate_key... |
rust_dataset_chunk_506755 | rust_dataset.txt | 506,755 | 512 | true;
«fn boop() {
hello();
world()ˇ»
}
"},
Mode::Visual,
);
// Around indent (include line above & below)
cx.set_state(
indoc! {"
const ABOVE: str = true;
... |
rust_dataset_chunk_506756 | rust_dataset.txt | 506,756 | 512 | "'first'ˇ'second'",
Mode::Insert,
),
// Single quotes
(
"c i q",
"Thisˇ is a 'quote' example.",
"This is a 'ˇ' example.",
Mode::Insert,
),
(
"c a q",
... |
rust_dataset_chunk_506757 | rust_dataset.txt | 506,757 | 512 | (
"c i q",
"This is a `qˇuote` example.",
"This is a `ˇ` example.",
Mode::Insert,
),
(
"c a q",
"This is a `qˇuote` example.",
"This is a ˇexample.",
Mode::... |
rust_dataset_chunk_506758 | rust_dataset.txt | 506,758 | 512 | back quote
("d i q", "this is a `qˇuote example.", Mode::Normal), // Missing closing back quote
("d a q", "this is a `qˇuote example.", Mode::Normal), // Missing closing back quote
];
for (keystrokes, initial_state, mode) in INVALID_CASES {
cx.set_state(initial_stat... |
rust_dataset_chunk_506759 | rust_dataset.txt | 506,759 | 512 | ote'\" example.",
"This is a \"ˇ\" example.", // Not supported by Tree-sitter queries for now
Mode::Insert,
),
(
"c a q",
"This is a \"simple 'qˇuote'\" example.",
"This is a ˇ example.", // Not supported by Tree-sit... |
rust_dataset_chunk_506760 | rust_dataset.txt | 506,760 | 512 | .", // same mini.ai plugin behavior
Mode::Insert,
),
(
"d i q",
"This is a `qˇuote` example.",
"This is a `ˇ` example.",
Mode::Normal,
),
(
"d a q",
"This is a ... |
rust_dataset_chunk_506761 | rust_dataset.txt | 506,761 | 512 | ˇuote example.", Mode::Normal), // Missing closing back quote
];
for (keystrokes, initial_state, mode) in INVALID_CASES {
cx.set_state(initial_state, Mode::Normal);
cx.buffer(|buffer, _| buffer.parsing_idle()).await;
cx.simulate_keystrokes(keystrokes);
cx... |
rust_dataset_chunk_506762 | rust_dataset.txt | 506,762 | 512 | ,
),
(
"d i b",
"This is a (qˇuote) example.",
"This is a (ˇ) example.",
Mode::Normal,
),
(
"d a b",
"This is a (qˇuote) example.",
"This is a ˇ example.",
... |
rust_dataset_chunk_506763 | rust_dataset.txt | 506,763 | 512 |
("c a b", "this is a (qˇuote example.", Mode::Normal), // Missing closing bracket
("d i b", "this is a (qˇuote example.", Mode::Normal), // Missing closing bracket
("d a b", "this is a (qˇuote example.", Mode::Normal), // Missing closing bracket
("c i b", "this is a [qˇu... |
rust_dataset_chunk_506764 | rust_dataset.txt | 506,764 | 512 | // Same behavior as mini.ai plugin
(
"c i b",
indoc! {"
{
{
ˇprint('hello')
}
}
"},
indoc! {"
{
... |
rust_dataset_chunk_506765 | rust_dataset.txt | 506,765 | 512 | Mode::Insert,
),
(
"c a b",
"This is a (qˇuote) example.",
"This is a ˇ example.",
Mode::Insert,
),
(
"d i b",
"This is a (qˇuote) example.",
"T... |
rust_dataset_chunk_506766 | rust_dataset.txt | 506,766 | 512 | cx.assert_state(expected_state, *expected_mode);
}
const INVALID_CASES: &[(&str, &str, Mode)] = &[
("c i b", "this is a (qˇuote example.", Mode::Normal), // Missing closing bracket
("c a b", "this is a (qˇuote example.", Mode::Normal), // Missing closing bracket
... |
rust_dataset_chunk_506767 | rust_dataset.txt | 506,767 | 512 | so we can later use it when simulating
// keystrokes.
cx.update(|_, cx| {
cx.bind_keys([KeyBinding::new("b", MiniBrackets, None)]);
});
let (editor, cx) = cx.add_window_view(|window, cx| {
let multi_buffer = MultiBuffer::build_multi(
[
... |
rust_dataset_chunk_506768 | rust_dataset.txt | 506,768 | 512 | �} example
"
});
}
#[gpui::test]
async fn test_minibrackets_trailing_space(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state("(trailingˇ whitespace )")
.await;
cx.simulate_shared_keystro... |
rust_dataset_chunk_506769 | rust_dataset.txt | 506,769 | 512 | ˇ>hi!</b><b>hello!</b></body>",
Mode::Normal,
);
cx.simulate_keystrokes("v a t");
cx.assert_state(
"<html><head></head><body>«<b>hi!</b>ˇ»<b>hello!</b></body>",
Mode::Visual,
);
cx.simulate_keystrokes("i t");
cx.assert_state(
... |
rust_dataset_chunk_506770 | rust_dataset.txt | 506,770 | 512 | board().await.assert_eq("const ");
cx.set_shared_state(" ˇconst f = (x: unknown) => {")
.await;
cx.simulate_shared_keystrokes("d a w").await;
cx.shared_state()
.await
.assert_eq(" ˇf = (x: unknown) => {");
cx.shared_clipboard().await.assert_eq("... |
rust_dataset_chunk_506771 | rust_dataset.txt | 506,771 | 512 | Normal,
);
cx.simulate_keystrokes("v a f");
cx.assert_state(
indoc! {"
(«() => {
console.log(1);
}ˇ»)();
"},
Mode::VisualLine,
);
cx.set_state(
indoc! {"
const foo... |
rust_dataset_chunk_506772 | rust_dataset.txt | 506,772 | 512 | VisualLine,
);
cx.set_state(
indoc! {"
const add = (a, b) => a + bˇ;
"},
Mode::Normal,
);
cx.simulate_keystrokes("v a f");
cx.assert_state(
indoc! {"
«const add = (a, b) => a + b;ˇ»
"},
... |
rust_dataset_chunk_506773 | rust_dataset.txt | 506,773 | 512 | ={«() => console.log("clicked")ˇ»}>Hello world!</div>
</div>
);
};
"#},
Mode::VisualLine,
);
cx.set_state(
indoc! {r#"
export const MyComponent = () => {
return (
... |
rust_dataset_chunk_506774 | rust_dataset.txt | 506,774 | 512 | <div onClick={() => {
console.log("cliˇcked");
}}>Hello world!</div>
</div>
);
};
"#},
Mode::Normal,
);
cx.simulate_keystrokes("v a f");
cx.assert_sta... |
rust_dataset_chunk_506775 | rust_dataset.txt | 506,775 | 512 | ("foo_bar_ˇ", Mode::Insert);
cx.set_state("fooˇBarBaz", Mode::Normal);
cx.simulate_keystrokes("c i w");
cx.assert_state("fooˇBaz", Mode::Insert);
cx.set_state("ˇfooBarBaz", Mode::Normal);
cx.simulate_keystrokes("c i w");
cx.assert_state("ˇBarBaz", Mode::Insert);
... |
rust_dataset_chunk_506776 | rust_dataset.txt | 506,776 | 512 | , ToPoint,
display_map::ToDisplayPoint,
};
use gpui::{ClipboardEntry, Context, Window, actions};
use language::{Point, SelectionGoal};
use std::ops::Range;
use std::sync::Arc;
actions!(
vim,
[
/// Toggles replace mode.
ToggleReplace,
/// Undoes the last replacement.
UndoRepl... |
rust_dataset_chunk_506777 | rust_dataset.txt | 506,777 | 512 | _range.clone(), current_text));
(replace_range, text.clone())
})
.collect::<Vec<_>>();
editor.edit_with_block_indent(edits.clone(), Vec::new(), cx);
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {... |
rust_dataset_chunk_506778 | rust_dataset.txt | 506,778 | 512 | mut Window,
cx: &mut Context<Self>,
) {
self.stop_recording(cx);
self.update_editor(cx, |vim, editor, cx| {
editor.set_clip_at_line_ends(false, cx);
let mut selection = editor
.selections
.newest_display(&editor.display_snapshot(cx));
... |
rust_dataset_chunk_506779 | rust_dataset.txt | 506,779 | 512 | ,
);
let start = snapshot
.buffer_snapshot()
.anchor_before(selection.start.to_point(&snapshot));
let end = snapshot
.buffer_snapshot()
.anchor_before(selection.end.to_point(&snapshot));
let new_range = start... |
rust_dataset_chunk_506780 | rust_dataset.txt | 506,780 | 512 | None);
});
})
}
} else {
let ranges = [new_range];
editor.highlight_background(
HighlightKey::VimExchange,
&ranges,
|_, theme| theme.colors().editor_document_highlight_read_background,
... |
rust_dataset_chunk_506781 | rust_dataset.txt | 506,781 | 512 | oc! {"
The quick browˇn
fox jumps over
the lazy dog."})
.await;
cx.simulate_shared_keystrokes("shift-r O n e").await;
cx.shared_state().await.assert_eq(indoc! {"
The quick browOneˇ
fox jumps over
the lazy dog."});
... |
rust_dataset_chunk_506782 | rust_dataset.txt | 506,782 | 512 | ˇ-lo\n");
cx.set_shared_state("ˇhello\n").await;
cx.simulate_shared_keystrokes("3 shift-r a b c escape")
.await;
cx.shared_state().await.assert_eq("abcabcabˇc\n");
}
#[gpui::test]
async fn test_replace_mode_repeat(cx: &mut gpui::TestAppContext) {
let mut cx: Neo... |
rust_dataset_chunk_506783 | rust_dataset.txt | 506,783 | 512 | cx.simulate_keystrokes("shift-r 1 2 3 4");
cx.assert_state("1234ˇ234ˇbc", Mode::Replace);
assert_eq!(cx.mode(), Mode::Replace);
cx.simulate_keystrokes("backspace backspace backspace backspace backspace");
cx.assert_state("ˇabˇcabcabc", Mode::Replace);
}
#[gpui::test]
async ... |
rust_dataset_chunk_506784 | rust_dataset.txt | 506,784 | 512 | );
}
#[gpui::test]
async fn test_clear_exchange_clears_operator(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
cx.set_state("ˇirrelevant", Mode::Normal);
cx.simulate_keystrokes("c x c");
assert_eq!(cx.active_operator(), None);
}
... |
rust_dataset_chunk_506785 | rust_dataset.txt | 506,785 | 512 | Action)]
#[action(namespace = vim)]
pub(crate) struct Rewrap {
pub line_length: Option<usize>,
}
pub(crate) fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim::action(editor, cx, |vim, action: &Rewrap, window, cx| {
vim.record_current_action(cx);
Vim::take_count(cx);
Vim::ta... |
rust_dataset_chunk_506786 | rust_dataset.txt | 506,786 | 512 | : true,
..Default::default()
},
cx,
);
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.move_with(&mut |map, selection| {
let anchor = selection_starts.r... |
rust_dataset_chunk_506787 | rust_dataset.txt | 506,787 | 512 | ()
.await
.assert_eq("« hello\n ˇ» world\n");
}
}
--- FILE: zed/crates/vim/src/state.rs ---
use crate::command::command_interceptor;
use crate::motion::MotionKind;
use crate::normal::repeat::Replayer;
use crate::surrounds::SurroundsType;
use crate::{ToggleMarksView, ToggleRegistersVie... |
rust_dataset_chunk_506788 | rust_dataset.txt | 506,788 | 512 | Formatter<'_>) -> std::fmt::Result {
match self {
Mode::Normal => write!(f, "NORMAL"),
Mode::Insert => write!(f, "INSERT"),
Mode::Replace => write!(f, "REPLACE"),
Mode::Visual => write!(f, "VISUAL"),
Mode::VisualLine => write!(f, "VISUAL LINE"),
... |
rust_dataset_chunk_506789 | rust_dataset.txt | 506,789 | 512 | {
line: bool,
},
Indent,
Outdent,
AutoIndent,
Rewrap,
ShellCommand,
Lowercase,
Uppercase,
OppositeCase,
Rot13,
Rot47,
Digraph {
first_char: Option<char>,
},
Literal {
prefix: Option<String>,
},
Register,
RecordRegister,
Rep... |
rust_dataset_chunk_506790 | rust_dataset.txt | 506,790 | 512 | => Register {
text: value.text().to_owned().into(),
clipboard_selections: value.metadata_json::<Vec<ClipboardSelection>>(),
},
None => Register::default(),
}
}
}
impl From<String> for Register {
fn from(text: String) -> Self {
Register {
... |
rust_dataset_chunk_506791 | rust_dataset.txt | 506,791 | 512 | _marks: HashMap<Arc<Path>, HashMap<String, Vec<Point>>>,
global_marks: HashMap<String, MarkLocation>,
_subscription: Subscription,
}
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum MarkLocation {
Buffer(EntityId),
Path(Arc<Path>),
}
pub enum Mark {
Local(Vec<Anchor>),
Buffer(EntityId, Vec<Anc... |
rust_dataset_chunk_506792 | rust_dataset.txt | 506,792 | 512 | ))
.ok()
})
.detach();
}
fn loaded(
&mut self,
marks: Vec<SerializedMark>,
global_mark_paths: Vec<(String, Arc<Path>)>,
cx: &mut Context<Self>,
) {
let Some(project) = self.project(cx) else {
return;
};
for... |
rust_dataset_chunk_506793 | rust_dataset.txt | 506,793 | 512 | )
}
fn serialize_buffer_marks(
&mut self,
path: Arc<Path>,
buffer: &Entity<Buffer>,
cx: &mut Context<Self>,
) {
let new_points: HashMap<String, Vec<Point>> = if let Some(anchors) =
self.buffer_marks.get(&buffer.read(cx).remote_id())
{
... |
rust_dataset_chunk_506794 | rust_dataset.txt | 506,794 | 512 | mut Context<Self>,
) {
if let MarkLocation::Buffer(entity_id) = old_path
&& let Some(old_marks) = self.multibuffer_marks.remove(&entity_id)
{
let buffer_marks = old_marks
.into_iter()
.map(|(k, v)| {
(
... |
rust_dataset_chunk_506795 | rust_dataset.txt | 506,795 | 512 | cx)
{
this.rename_buffer(old_path, new_path, &buffer, cx)
}
}
_ => {}
});
let on_release = cx.observe_release(buffer_handle, |this, buffer, _| {
this.watched_buffers.remove(&buffer.remote_id());
this.bu... |
rust_dataset_chunk_506796 | rust_dataset.txt | 506,796 | 512 | self.serialize_buffer_marks(abs_path, &buffer, cx)
}
pub fn get_mark(
&self,
name: &str,
multi_buffer: &Entity<MultiBuffer>,
cx: &App,
) -> Option<Mark> {
let target = self.global_marks.get(name);
if !self.is_global_mark(name) || target.is_some_and(|... |
rust_dataset_chunk_506797 | rust_dataset.txt | 506,797 | 512 | Location::Path(path) => path.clone(),
}
} else {
self.multibuffer_marks
.get_mut(&multi_buffer.entity_id())
.map(|m| m.remove(&mark_name));
if let Some(singleton) = multi_buffer.read(cx).as_singleton() {
let buffer_id = singlet... |
rust_dataset_chunk_506798 | rust_dataset.txt | 506,798 | 512 | multi_workspace
.update(cx, |multi_workspace, _, cx| {
for workspace in multi_workspace.workspaces() {
workspace.update(cx, |workspace, cx| {
Vim::update_global... |
rust_dataset_chunk_506799 | rust_dataset.txt | 506,799 | 512 | cx.write_to_primary(content.into());
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
cx.write_to_clipboard(content.into());
}
'"' => {
self.registers.insert('"', content.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.