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_506200 | rust_dataset.txt | 506,200 | 512 | ];
}
}
truncate_to_byte_limit(s, max_bytes)
}
#[test]
fn test_truncate_lines_to_byte_limit() {
let text = "Line 1\nLine 2\nLine 3\nLine 4";
// Limit that includes all lines
assert_eq!(truncate_lines_to_byte_limit(text, 100), text);
// Exactly the first line
assert_eq!(truncate_li... |
rust_dataset_chunk_506201 | rust_dataset.txt | 506,201 | 512 | ZED_ALLOW_ROOT` environment variable.
#[cfg(unix)]
pub fn prevent_root_execution() {
let is_root = nix::unistd::geteuid().is_root();
let allow_root = std::env::var("ZED_ALLOW_ROOT").is_ok_and(|val| val == "true");
if is_root && !allow_root {
eprintln!(
"\
Error: Running Zed as root or v... |
rust_dataset_chunk_506202 | rust_dataset.txt | 506,202 | 512 | 4,
n => n as usize,
};
let mut buffer = Vec::with_capacity(buflen);
let mut pwd: std::mem::MaybeUninit<libc::passwd> = std::mem::MaybeUninit::uninit();
let mut result: *mut libc::passwd = std::ptr::null_mut();
let uid = unsafe { libc::getuid() };
let status = unsafe {
libc::get... |
rust_dataset_chunk_506203 | rust_dataset.txt | 506,203 | 512 | .file_name()
.and_then(|s| s.to_str())
.and_then(|n| n.strip_suffix(" (deleted)"))
{
// Might have been deleted during update; let's use the new binary if there is one.
zed_path.set_file_name(truncated);
}
zed_path
.try_shell_safe(shell_kind)
... |
rust_dataset_chunk_506204 | rust_dataset.txt | 506,204 | 512 | // such as direnv, asdf, mise, ... to adjust the PATH. These tools often hook
// into shell's `cd` command (and hooks) to manipulate env.
// We do this so that we get the env a user would have when spawning a shell
// in home directory.
for (name, value) in shell_env::capture(get_system_shell(), &[]... |
rust_dataset_chunk_506205 | rust_dataset.txt | 506,205 | 512 | ) = target.get_mut(&key) {
merge_json_lenient_value_into(value, target);
} else {
target.insert(key, value);
}
}
}
(serde_json_lenient::Value::Array(source), serde_json_lenient::Value::Array(target)) => {
fo... |
rust_dataset_chunk_506206 | rust_dataset.txt | 506,206 | 512 | let Some(target) = target_object.get_mut(&key) {
merge_non_null_json_value_into(value, target);
} else if !value.is_null() {
target_object.insert(key, value);
}
}
} else if !source.is_null() {
*target = source
}
}
pub fn expanded_and_wrap... |
rust_dataset_chunk_506207 | rust_dataset.txt | 506,207 | 512 | let value = (start + after_offset) % wrap_length;
after_offset += 1;
Some(value)
} else if before_offset <= additional_before {
let value = (start + wrap_length - before_offset) % wrap_length;
before_offset += 1;
Some(value)
} else ... |
rust_dataset_chunk_506208 | rust_dataset.txt | 506,208 | 512 | 1).into()),
}
}
}
}
#[cfg(any(test, feature = "test-support"))]
pub use rng::RandomCharIter;
/// Get an embedded file as a string.
pub fn asset_str<A: rust_embed::RustEmbed>(path: &str) -> Cow<'static, str> {
match A::get(path).expect(path).data {
Cow::Borrowed(bytes) => Cow::Borro... |
rust_dataset_chunk_506209 | rust_dataset.txt | 506,209 | 512 | .as_deref()
}
/// Re-exports that back [`fs_embed!`] so a caller only needs to depend on `util`,
/// not on `rust_embed` directly (the macro's dependency is an implementation
/// detail). Hidden from the public API.
#[doc(hidden)]
pub mod __rust_embed {
pub use rust_embed::{EmbeddedFile, Filenames, Metadata, Rust... |
rust_dataset_chunk_506210 | rust_dataset.txt | 506,210 | 512 | new(includes, excludes);
if !matcher.is_path_included(file_path) {
return None;
}
let root = dev_repo_root()
.expect("dev asset loading requires running from within the checkout")
.join(root_relative);
rust_embed::utils::read_file_from_fs(&root.join(file_path)).ok()
}
#[cfg(feat... |
rust_dataset_chunk_506211 | rust_dataset.txt | 506,211 | 512 | arms are interchangeable at call sites.
#[cfg(debug_assertions)]
impl $name {
pub fn get(
file_path: &str,
) -> ::core::option::Option<$crate::__rust_embed::EmbeddedFile> {
$crate::__fs_embed_get(
$root_relative,
... |
rust_dataset_chunk_506212 | rust_dataset.txt | 506,212 | 512 | build-time path into that arm would point at the
/// wrong checkout from another worktree and is rejected by corgi, whose sandbox
/// requires checkout-independent output.
///
/// ```ignore
/// util::fs_embed! {
/// pub struct Assets,
/// crate_relative = "../../assets",
/// root_relative = "assets",
/// ... |
rust_dataset_chunk_506213 | rust_dataset.txt | 506,213 | 512 | -insensitive.
///
/// This is useful for turning regular alphanumerically sorted sequences as `1-abc, 10, 11-def, .., 2, 21-abc`
/// into `1-abc, 2, 10, 11-def, .., 21-abc`
#[derive(Debug, PartialEq, Eq)]
pub struct NumericPrefixWithSuffix<'a>(Option<u64>, &'a str);
impl<'a> NumericPrefixWithSuffix<'a> {
pub fn fr... |
rust_dataset_chunk_506214 | rust_dataset.txt | 506,214 | 512 | "👋!" will return false.
pub fn word_consists_of_emojis(s: &str) -> bool {
let mut prev_end = 0;
for capture in emoji_regex().find_iter(s) {
if capture.start() != prev_end {
return false;
}
prev_end = capture.end();
}
prev_end == s.len()
}
/// Similar to `str::split... |
rust_dataset_chunk_506215 | rust_dataset.txt | 506,215 | 512 | name| name.ends_with(".toml")),
"iter should filter files excluded by the globs, got {inherent_names:?}"
);
let trait_names: Vec<_> =
<FsEmbedTestAssets as crate::__rust_embed::RustEmbed>::iter().collect();
assert_eq!(inherent_names, trait_names);
let file = FsE... |
rust_dataset_chunk_506216 | rust_dataset.txt | 506,216 | 512 | 8, 1, 0], 5, |a, b| b.cmp(a));
assert_eq!(vec, &[21, 17, 13, 8, 1]);
extend_sorted(&mut vec, vec![101, 19, 17, 8, 2], 8, |a, b| b.cmp(a));
assert_eq!(vec, &[101, 21, 19, 17, 13, 8, 2, 1]);
extend_sorted(&mut vec, vec![1000, 19, 17, 9, 5], 8, |a, b| b.cmp(a));
assert_eq!(vec, &[... |
rust_dataset_chunk_506217 | rust_dataset.txt | 506,217 | 512 | _function()?;
Some(())
});
assert_eq!(foo, None);
}
#[test]
fn test_truncate_and_trailoff() {
assert_eq!(truncate_and_trailoff("", 5), "");
assert_eq!(truncate_and_trailoff("aaaaaa", 7), "aaaaaa");
assert_eq!(truncate_and_trailoff("aaaaaa", 6), "aaaaaa")... |
rust_dataset_chunk_506218 | rust_dataset.txt | 506,218 | 512 | _numeric_prefixed_str(target),
NumericPrefixWithSuffix(Some(1), "_2ab")
);
let target = "1.2";
assert_eq!(
NumericPrefixWithSuffix::from_numeric_prefixed_str(target),
NumericPrefixWithSuffix(Some(1), ".2")
);
let target = "1.2_a";
ass... |
rust_dataset_chunk_506219 | rust_dataset.txt | 506,219 | 512 | 1
Line 2
Line 3"#;
assert_eq!(
truncate_lines_and_trailoff(text, 2),
r#"Line 1
…"#
);
assert_eq!(
truncate_lines_and_trailoff(text, 3),
r#"Line 1
Line 2
…"#
);
assert_eq!(
truncate_lines_and_trailoff(text, 4),
... |
rust_dataset_chunk_506220 | rust_dataset.txt | 506,220 | 512 | >>()
);
// Both start and end wrap
assert_eq!(
expanded_and_wrapped_usize_range(3..5, 4, 4, 8).collect::<Vec<usize>>(),
(0..8).collect::<Vec<usize>>()
);
}
#[test]
fn test_wrapped_usize_outward_from() {
// No wrapping
assert_eq!(
... |
rust_dataset_chunk_506221 | rust_dataset.txt | 506,221 | 512 | ..2, "hi"));
let input = "héllo🦀world";
let result = split_str_with_ranges(input, &|c| c == '🦀');
assert_eq!(result.len(), 2);
assert_eq!(result[0], (0..6, "héllo")); // 'é' is 2 bytes
assert_eq!(result[1], (10..15, "world")); // '🦀' is 4 bytes
}
#[test]
fn test... |
rust_dataset_chunk_506222 | rust_dataset.txt | 506,222 | 512 | ": "kept" },
"inserted": { "z": true },
},
})
);
}
#[test]
fn test_union_json_values() {
use serde_json::json;
let mut target = json!({
"unchanged": 1,
"replaced_scalar": "old",
"unioned_array": ["s... |
rust_dataset_chunk_506223 | rust_dataset.txt | 506,223 | 512 | : &App) -> bool {
Self::try_get(cx)
.map(|helix_mode| helix_mode.0)
.unwrap_or(false)
}
}
impl Settings for HelixModeSetting {
fn from_settings(content: &SettingsContent) -> Self {
Self(content.helix_mode.unwrap())
}
}
--- FILE: zed/crates/vim/src/change_list.rs --... |
rust_dataset_chunk_506224 | rust_dataset.txt | 506,224 | 512 | _display(&display_map);
let buffer = editor.buffer().clone();
let pop_state = editor
.change_list
.last()
.map(|previous| {
previous.len() == selections.len()
&& previous.iter().enumerate().all(|(ix, p)|... |
rust_dataset_chunk_506225 | rust_dataset.txt | 506,225 | 512 | ("g ;").await;
cx.assert_state(
indoc! {
"22
1ˇ1
33"
},
Mode::Normal,
);
cx.simulate_shared_keystrokes("g ,").await;
cx.assert_state(
indoc! {
"2ˇ2
11
33"
... |
rust_dataset_chunk_506226 | rust_dataset.txt | 506,226 | 512 |
three foˇur"});
}
#[gpui::test]
async fn test_dot_mark(cx: &mut gpui::TestAppContext) {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {
"one two
three fˇr"})
.await;
cx.simulate_shared_keystrokes("i o escape k ` ... |
rust_dataset_chunk_506227 | rust_dataset.txt | 506,227 | 512 | ::Rewrap,
state::{Mark, Mode},
visual::VisualDeleteLine,
};
/// Goes to the specified line number in the editor.
#[derive(Clone, Debug, PartialEq, Action)]
#[action(namespace = vim, no_json, no_register)]
pub struct GoToLine {
range: CommandRange,
}
/// Yanks (copies) text based on the specified range.
#[... |
rust_dataset_chunk_506228 | rust_dataset.txt | 506,228 | 512 | Number(true)),
(None, VimOption::RelativeNumber(false)),
(Some("rnu"), VimOption::RelativeNumber(true)),
(Some("nornu"), VimOption::RelativeNumber(false)),
(None, VimOption::IgnoreCase(true)),
(None, VimOption::IgnoreCase(false)),
(Some("ic"), VimO... |
rust_dataset_chunk_506229 | rust_dataset.txt | 506,229 | 512 | Option::RelativeNumber(false) => "norelativenumber",
VimOption::IgnoreCase(true) => "ignorecase",
VimOption::IgnoreCase(false) => "noignorecase",
VimOption::GDefault(true) => "gdefault",
VimOption::GDefault(false) => "nogdefault",
}
}
}
/// Sets vim options a... |
rust_dataset_chunk_506230 | rust_dataset.txt | 506,230 | 512 | (&*other.0)
}
}
impl Clone for WrappedAction {
fn clone(&self) -> Self {
Self(self.0.boxed_clone())
}
}
impl Deref for WrappedAction {
type Target = dyn Action;
fn deref(&self) -> &dyn Action {
&*self.0
}
}
pub fn register(editor: &mut Editor, cx: &mut Context<Vim>) {
Vim:... |
rust_dataset_chunk_506231 | rust_dataset.txt | 506,231 | 512 | cx, |_, _: &ArgumentRequired, window, cx| {
let _ = window.prompt(
gpui::PromptLevel::Critical,
"Argument required",
None,
&["Cancel"],
cx,
);
});
Vim::action(editor, cx, |vim, action: &VimSave, window, cx| {
if let Some(range... |
rust_dataset_chunk_506232 | rust_dataset.txt | 506,232 | 512 | the current file with selected buffer content requires '!'."),
&["Cancel"],
cx,
);
return;
}
editor.buffer().update(cx, |multi, cx| {
if let Some(buffe... |
rust_dataset_chunk_506233 | rust_dataset.txt | 506,233 | 512 | vim.update_editor(cx, |_, editor, cx| {
let Some(project) = editor.project().cloned() else {
return;
};
let Some(worktree) = project.read(cx).visible_worktrees(cx).next() else {
return;
};
let path_style = worktree.read(cx).pat... |
rust_dataset_chunk_506234 | rust_dataset.txt | 506,234 | 512 | let Some(worktree) = project.read(cx).visible_worktrees(cx).next() else {
return;
};
let path_style = worktree.read(cx).path_style();
let Some(path) = RelPath::new(Path::new(&action.filename), path_style).log_err() else {
return;
... |
rust_dataset_chunk_506235 | rust_dataset.txt | 506,235 | 512 | .fold_options(HashSet::<char>::default(), |mut set, chars| {
set.extend(chars.iter().copied());
set
})
.map(|set| set.iter().collect::<String>())
};
let Some(to_delete) = to_delete e... |
rust_dataset_chunk_506236 | rust_dataset.txt | 506,236 | 512 | new(0, 0), Bias::Right)
}
_ => snapshot.clip_point(Point::new(multi_range.end.0 + 1, 0), Bias::Right),
}
} else {
let end_row = editor
.selections
.newest::<Point>(&editor.display_snapshot(cx))
... |
rust_dataset_chunk_506237 | rust_dataset.txt | 506,237 | 512 | point = if is_end_of_file {
Point::new(
edit_range.start.to_point(&snapshot).row.saturating_add(1),
0,
)
} else {
Point::ne... |
rust_dataset_chunk_506238 | rust_dataset.txt | 506,238 | 512 | .update_in(cx, |vim, window, cx| {
if matches!(vim.mode, Mode::Insert | Mode::Replace) {
vim.normal_before(&Default::default(), window, cx);
} else {
vim.switch_mode(Mode::Normal, true, window, cx);
}
if had_override... |
rust_dataset_chunk_506239 | rust_dataset.txt | 506,239 | 512 | | {
s.select_ranges([target..target]);
});
anyhow::Ok(())
});
if let Some(e @ Err(_)) = result {
let Some(workspace) = vim.workspace(window, cx) else {
return;
};
workspace.update(cx, |workspace, cx| {
... |
rust_dataset_chunk_506240 | rust_dataset.txt | 506,240 | 512 | (range.end.0, snapshot.line_len(range.end));
s.select_ranges([end..Point::new(range.start.0, 0)]);
});
selections
})
.flatten();
window.dispatch_action(action.action.boxed_clone(), cx);
cx.defer_in(window, move |vim, window, cx|... |
rust_dataset_chunk_506241 | rust_dataset.txt | 506,241 | 512 | Self {
prefix: pattern.0,
suffix: pattern.1,
action_name: Some(action_name),
..Default::default()
}
}
fn bang(mut self, bang_action: impl Action) -> Self {
self.bang_action = Some(bang_action.boxed_clone());
self
}
/// Set argume... |
rust_dataset_chunk_506242 | rust_dataset.txt | 506,242 | 512 | Err(_) => {
return (Task::ready(Ok(Vec::new())), RelPathBuf::new());
}
};
let rel_path = if args.ends_with(PathStyle::local().primary_separator()) {
rel_path
} else {
rel_path
.pa... |
rust_dataset_chunk_506243 | rust_dataset.txt | 506,243 | 512 | <Box<dyn Action>> {
let ParsedQuery {
args,
has_bang,
has_space: _,
} = self.get_parsed_query(query.to_string())?;
let action = if has_bang && let Some(bang_action) = self.bang_action.as_ref() {
bang_action.boxed_clone()
} else if let Some(... |
rust_dataset_chunk_506244 | rust_dataset.txt | 506,244 | 512 | start.map(|start| CommandRange { start, end: None }),
chars.collect(),
),
}
}
fn parse_position(chars: &mut Peekable<Chars>) -> Option<Position> {
match chars.peek()? {
'0'..='9' => {
let row = Self::parse_u32(chars);
Some... |
rust_dataset_chunk_506245 | rust_dataset.txt | 506,245 | 512 | editor: &mut Editor,
window: &mut Window,
cx: &mut App,
) -> Result<MultiBufferRow> {
let snapshot = editor.snapshot(window, cx);
let target = match self {
Position::Line { row, offset } => {
if let Some(anchor) = editor.active_buffer(cx).and_then(... |
rust_dataset_chunk_506246 | rust_dataset.txt | 506,246 | 512 | im, editor, window, cx)?;
let end = if let Some(end) = self.end.as_ref() {
end.buffer_row(vim, editor, window, cx)?
} else {
start
};
if end < start {
anyhow::Ok(end..start)
} else {
anyhow::Ok(start..end)
}
}
pub f... |
rust_dataset_chunk_506247 | rust_dataset.txt | 506,247 | 512 | )
})
.range(|action, range| {
let mut action: VimRead = action.as_any().downcast_ref::<VimRead>().unwrap().clone();
action.range.replace(range.clone());
Some(Box::new(action))
}),
VimCommand::new(("sp", "lit"), workspace::SplitHorizontal::d... |
rust_dataset_chunk_506248 | rust_dataset.txt | 506,248 | 512 | close_pinned: true,
}),
VimCommand::new(
("up", "date"),
workspace::Save {
save_intent: Some(SaveIntent::SaveAll),
},
),
VimCommand::new(
("wa", "ll"),
workspace::SaveAll {
save_intent: Some(Save... |
rust_dataset_chunk_506249 | rust_dataset.txt | 506,249 | 512 | : None,
override_rows: None,
}
.boxed_clone(),
)
})
.range(|action, range| {
let mut action: VimNorm = action.as_any().downcast_ref::<VimNorm>().unwrap().clone();
action.range.replace(range.clone());
Some... |
rust_dataset_chunk_506250 | rust_dataset.txt | 506,250 | 512 | "diagnostics::Deploy"),
VimCommand::new(("cc", ""), editor::actions::Hover),
VimCommand::new(("ll", ""), editor::actions::Hover),
VimCommand::new(("cn", "ext"), editor::actions::GoToDiagnostic::default())
.range(wrap_count),
VimCommand::new(
("cp", "revious"),
... |
rust_dataset_chunk_506251 | rust_dataset.txt | 506,251 | 512 | (("reg", "isters"), ToggleRegistersView).bang(ToggleRegistersView),
VimCommand::new(("di", "splay"), ToggleRegistersView).bang(ToggleRegistersView),
VimCommand::new(("marks", ""), ToggleMarksView).bang(ToggleMarksView),
VimCommand::new(("delm", "arks"), ArgumentRequired)
.bang(Delete... |
rust_dataset_chunk_506252 | rust_dataset.txt | 506,252 | 512 | ::new(("h", "elp"), OpenDocs),
]
}
struct VimCommands(Vec<VimCommand>);
// safety: we only ever access this from the main thread (as ensured by the cx argument)
// actions are not Sync so we can't otherwise use a OnceLock.
unsafe impl Sync for VimCommands {}
impl Global for VimCommands {}
fn commands(cx: &App) ->... |
rust_dataset_chunk_506253 | rust_dataset.txt | 506,253 | 512 | && query.is_empty() {
Some(
GoToLine {
range: range.clone().unwrap(),
}
.boxed_clone(),
)
} else if query.starts_with('/') || query.starts_with('?') {
Some(
FindCommand {
query: query[1..].to_string(),
... |
rust_dataset_chunk_506254 | rust_dataset.txt | 506,254 | 512 | vec![CommandInterceptItem {
action,
string,
positions,
}],
exclusive: false,
});
}
let Some((mut results, filenames)) =
commands(cx).iter().enumerate().find_map(|(idx, command)| {
let action = command.parse(que... |
rust_dataset_chunk_506255 | rust_dataset.txt | 506,255 | 512 | : _,
positions,
string,
} in filenames
{
let offset = display_string.len() + 1;
let mut positions: Vec<_> = positions.iter().map(|&pos| pos + offset).collect();
positions.splice(0..0, no_args_positions.clone());
... |
rust_dataset_chunk_506256 | rust_dataset.txt | 506,256 | 512 | query_chars = query.chars().peekable();
let mut invert = false;
if query_chars.peek() == Some(&'v') {
invert = true;
query_chars.next();
}
while global
.peek()
.is_some_and(|char| Some(char) == query_chars.peek())
{
glo... |
rust_dataset_chunk_506257 | rust_dataset.txt | 506,257 | 512 | (&self.search) {
Ok(regex) => vec![(regex, !self.invert)],
e @ Err(_) => {
let Some(workspace) = vim.workspace(window, cx) else {
return;
};
workspace.update(cx, |workspace, cx| {
e.notify_err(workspace, cx);... |
rust_dataset_chunk_506258 | rust_dataset.txt | 506,258 | 512 | line.push_str(text)
}
}
matching_lines
})
.await;
editor
.update_in(cx, |editor, window, cx| {
let snapshot = ... |
rust_dataset_chunk_506259 | rust_dataset.txt | 506,259 | 512 | })
});
}
}
fn prepare_shell_command(
&mut self,
command: &str,
_: &mut Window,
cx: &mut Context<Self>,
) -> String {
let mut ret = String::new();
// N.B. non-standard escaping rules:
// * !echo % => "echo README.md"
// * !... |
rust_dataset_chunk_506260 | rust_dataset.txt | 506,260 | 512 | _point(&snapshot)
]);
})
}
if range.end.row() > range.start.row() && range.end.column() != 0 {
*range.end.row_mut() -= 1
}
if range.end.row() == range.start.row() {
".!".to_string()
} else {
... |
rust_dataset_chunk_506261 | rust_dataset.txt | 506,261 | 512 | _clone(),
)
}
pub fn run(&self, vim: &mut Vim, window: &mut Window, cx: &mut Context<Vim>) {
let Some(workspace) = vim.workspace(window, cx) else {
return;
};
let project = workspace.read(cx).project().clone();
let command = vim.prepare_shell_command(&self.c... |
rust_dataset_chunk_506262 | rust_dataset.txt | 506,262 | 512 | )
..snapshot.clip_point(Point::new(range.end.0 + 1, 0), Bias::Right)
} else {
let mut end = editor
.selections
.newest::<Point>(&editor.display_snapshot(cx))
.range()
.end;
end... |
rust_dataset_chunk_506263 | rust_dataset.txt | 506,263 | 512 | , cx| {
vim.cancel_running_command(window, cx);
})
.log_err();
return;
};
let mut text = String::new();
if needs_newline_prefix {
text.push('\n');
}
text.push_str(&String::from... |
rust_dataset_chunk_506264 | rust_dataset.txt | 506,264 | 512 | b
c"})
.await;
cx.simulate_shared_keystrokes(": j enter").await;
// hack: our cursor positioning after a join command is wrong
cx.simulate_shared_keystrokes("^").await;
cx.shared_state().await.assert_eq(indoc! {
"ˇa b
c"
});
... |
rust_dataset_chunk_506265 | rust_dataset.txt | 506,265 | 512 |
a
c"});
cx.simulate_shared_keystrokes(": ? a enter").await;
cx.shared_state().await.assert_eq(indoc! {"
ˇa
b
a
c"});
}
#[gpui::test]
async fn test_command_write(cx: &mut TestAppContext) {
... |
rust_dataset_chunk_506266 | rust_dataset.txt | 506,266 | 512 | \n2\n3", Mode::Normal);
cx.set_state("oneˇ\ntwo\nthree", Mode::Normal);
cx.simulate_keystrokes(": r space d i r / o t h e r . r s");
cx.simulate_keystrokes("enter");
cx.assert_state("one\nˇ1\n2\n3\ntwo\nthree", Mode::Normal);
cx.set_state("one\nˇtwo\nthree", Mode::Normal);
... |
rust_dataset_chunk_506267 | rust_dataset.txt | 506,267 | 512 | three\nfour»\nfive", Mode::Visual);
cx.simulate_keystrokes(": r space d i r / o t h e r . r s");
cx.simulate_keystrokes("enter");
cx.assert_state("one\ntwo\nthree\nfour\nˇ1\n2\n3\n\nfive", Mode::Normal);
cx.set_state("«one\ntwo\nthreeˇ»", Mode::Visual);
cx.simulate_keystrokes(":... |
rust_dataset_chunk_506268 | rust_dataset.txt | 506,268 | 512 | .assert_eq("1\nˇ2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n");
cx.simulate_shared_keystrokes(": 1 0 - enter").await;
cx.shared_state()
.await
.assert_eq("1\n2\n3\n4\n5\n6\n7\n8\nˇ9\n10\n11\n");
cx.simulate_shared_keystrokes(": . - 2 enter").await;
cx.shared_sta... |
rust_dataset_chunk_506269 | rust_dataset.txt | 506,269 | 512 | }
#[track_caller]
fn assert_active_item(
workspace: &mut Workspace,
expected_path: &str,
expected_text: &str,
cx: &mut Context<Workspace>,
) {
let active_editor = workspace.active_item_as::<Editor>(cx).unwrap();
let buffer = active_editor
.read(... |
rust_dataset_chunk_506270 | rust_dataset.txt | 506,270 | 512 | path to the third file into the currently open buffer,
// but remove its suffix, because we want that lookup to happen automatically.
cx.set_state(indoc! {"go to fiˇle3"}, Mode::Normal);
// Go to file3.rs
cx.simulate_keystrokes("g f");
// We now have three items
cx.wor... |
rust_dataset_chunk_506271 | rust_dataset.txt | 506,271 | 512 | let other = path!("/root/dir/other.rs");
let _ = cx
.workspace(|workspace, window, cx| {
workspace.open_abs_path(PathBuf::from(other), OpenOptions::default(), window, cx)
})
.await;
cx.workspace(|workspace, _, cx| {
assert_active_item(
... |
rust_dataset_chunk_506272 | rust_dataset.txt | 506,272 | 512 | "😀"),
],
None,
cx,
);
});
cx.run_until_parked();
let expected = if normal_command {
"match 新\n前置\nmatch α!\nkeep β\n😀match γ!\nlast δ\n"
} else {
"match 新\n前置\n... |
rust_dataset_chunk_506273 | rust_dataset.txt | 506,273 | 512 | editor.unfold_ranges(&[fold_range], true, false, cx);
}
});
cx.run_until_parked();
let expected = if normal_command {
"header\nhidden α\nhidden β\nmatch γ!\nkeep δ\nmatch ε!\nlast\n"
} else {... |
rust_dataset_chunk_506274 | rust_dataset.txt | 506,274 | 512 | {
let mut cx = NeovimBackedTestContext::new(cx).await;
cx.set_shared_state(indoc! {"
ˇa
b
a
b
a
"})
.await;
cx.simulate_shared_keystrokes("m a").await;
let mark = cx.update_editor(|editor, window, cx| {
... |
rust_dataset_chunk_506275 | rust_dataset.txt | 506,275 | 512 | brown word
lˇaumps test
the lazy dog
"});
cx.set_shared_state(indoc! {"
ˇThe quick
brown fox
jumps over
the lazy dog
"})
.await;
cx.simulate_shared_keystrokes("c i w M y escape").await;
... |
rust_dataset_chunk_506276 | rust_dataset.txt | 506,276 | 512 | f o o / n o r m space A b a r")
.await;
cx.simulate_shared_keystrokes("enter").await;
cx.run_until_parked();
cx.shared_state().await.assert_eq(indoc! {"
foobar
foobaˇr
"});
cx.simulate_shared_keystrokes("u").await;
cx.shared_state(... |
rust_dataset_chunk_506277 | rust_dataset.txt | 506,277 | 512 | filename` argument provided to the `:tabnew` command is for a
// file that doesn't yet exist, it should still associate the buffer
// with that file path, so that when the buffer contents are saved, the
// file is created.
cx.simulate_keystrokes(": tabnew space dir/file_3.rs");
c... |
rust_dataset_chunk_506278 | rust_dataset.txt | 506,278 | 512 | | {
assert_active_item(workspace, path!("/root/dir/file_2.rs"), "file_2", cx);
});
// If the `filename` argument provided to the `:tabedit` command is for a
// file that doesn't yet exist, it should still associate the buffer
// with that file path, so that when the buffer c... |
rust_dataset_chunk_506279 | rust_dataset.txt | 506,279 | 512 | get_global(cx).search.case_sensitive,
false,
"The `case_sensitive` setting should have been disabled with `:set ic`."
);
});
}
#[gpui::test]
async fn test_sort_commands(cx: &mut TestAppContext) {
let mut cx = VimTestContext::new(cx, true).await;
... |
rust_dataset_chunk_506280 | rust_dataset.txt | 506,280 | 512 | ulate_keystrokes("enter");
cx.assert_state(
indoc! {"
ˇcornifer
elderbug
hornet
ida
quirrel
"},
Mode::Normal,
);
}
#[gpui::test]
async fn test_reflow(cx: &mut TestAppContext)... |
rust_dataset_chunk_506281 | rust_dataset.txt | 506,281 | 512 | indoc! {"
ˇ0123 4567 0123 4567
"},
Mode::VisualLine,
);
}
fn start_matching_lines(cx: &mut VimTestContext, normal_command: bool) {
let vim = cx.editor(|editor, _, _| editor.addon::<VimAddon>().unwrap().entity.clone());
cx.update(|windo... |
rust_dataset_chunk_506282 | rust_dataset.txt | 506,282 | 512 | 12),
('D', '3', 0x13),
('D', '4', 0x14),
('N', 'K', 0x15),
('S', 'Y', 0x16),
('E', 'B', 0x17),
('C', 'N', 0x18),
('E', 'M', 0x19),
('S', 'B', 0x1a),
('E', 'C', 0x1b),
('F', 'S', 0x1c),
('G', 'S', 0x1d),
('R', 'S', 0x1e),
('U', 'S', 0x1f),
('S', 'P', 0x20),
('N... |
rust_dataset_chunk_506283 | rust_dataset.txt | 506,283 | 512 | ('S', '3', 0x8f),
('D', 'C', 0x90),
('P', '1', 0x91),
('P', '2', 0x92),
('T', 'S', 0x93),
('C', 'C', 0x94),
('M', 'W', 0x95),
('S', 'G', 0x96),
('E', 'G', 0x97),
('S', 'S', 0x98),
('G', 'C', 0x99),
('S', 'C', 0x9a),
('C', 'I', 0x9b),
('S', 'T', 0x9c),
('O', 'C... |
rust_dataset_chunk_506284 | rust_dataset.txt | 506,284 | 512 | 0xb1),
('2', 'S', 0xb2),
('2', '2', 0xb2),
('3', 'S', 0xb3),
('3', '3', 0xb3),
('\'', '\'', 0xb4),
('M', 'y', 0xb5),
('P', 'I', 0xb6),
('p', 'p', 0xb6),
('.', 'M', 0xb7),
('~', '.', 0xb7),
('\'', ',', 0xb8),
('1', 'S', 0xb9),
('1', '1', 0xb9),
('-', 'o', 0xba),
... |
rust_dataset_chunk_506285 | rust_dataset.txt | 506,285 | 512 | ),
('D', '-', 0xd0),
('N', '?', 0xd1),
('N', '~', 0xd1),
('O', '!', 0xd2),
('O', '`', 0xd2),
('O', '\'', 0xd3),
('O', '>', 0xd4),
('O', '^', 0xd4),
('O', '?', 0xd5),
('O', '~', 0xd5),
('O', ':', 0xd6),
('*', 'X', 0xd7),
('/', '\\', 0xd7),
('O', '/', 0xd8),
('U... |
rust_dataset_chunk_506286 | rust_dataset.txt | 506,286 | 512 | xee),
('i', '^', 0xee),
('i', ':', 0xef),
('d', '-', 0xf0),
('n', '?', 0xf1),
('n', '~', 0xf1),
('o', '!', 0xf2),
('o', '`', 0xf2),
('o', '\'', 0xf3),
('o', '>', 0xf4),
('o', '^', 0xf4),
('o', '?', 0xf5),
('o', '~', 0xf5),
('o', ':', 0xf6),
('-', ':', 0xf7),
(... |
rust_dataset_chunk_506287 | rust_dataset.txt | 506,287 | 512 | ', '(', 0x0115),
('E', '.', 0x0116),
('e', '.', 0x0117),
('E', ';', 0x0118),
('e', ';', 0x0119),
('E', '<', 0x011a),
('e', '<', 0x011b),
('G', '>', 0x011c),
('g', '>', 0x011d),
('G', '(', 0x011e),
('g', '(', 0x011f),
('G', '.', 0x0120),
('g', '.', 0x0121),
('G', ',', ... |
rust_dataset_chunk_506288 | rust_dataset.txt | 506,288 | 512 | L', '/', 0x0141),
('l', '/', 0x0142),
('N', '\'', 0x0143),
('n', '\'', 0x0144),
('N', ',', 0x0145),
('n', ',', 0x0146),
('N', '<', 0x0147),
('n', '<', 0x0148),
('\'', 'n', 0x0149),
('N', 'G', 0x014a),
('n', 'g', 0x014b),
('O', '-', 0x014c),
('o', '-', 0x014d),
('O', '... |
rust_dataset_chunk_506289 | rust_dataset.txt | 506,289 | 512 | 016c),
('u', '(', 0x016d),
('U', '0', 0x016e),
('u', '0', 0x016f),
('U', '"', 0x0170),
('u', '"', 0x0171),
('U', ';', 0x0172),
('u', ';', 0x0173),
('W', '>', 0x0174),
('w', '>', 0x0175),
('Y', '>', 0x0176),
('y', '>', 0x0177),
('Y', ':', 0x0178),
('Z', '\'', 0x0179),
... |
rust_dataset_chunk_506290 | rust_dataset.txt | 506,290 | 512 | ', '3', 0x01e2),
('a', '3', 0x01e3),
('G', '/', 0x01e4),
('g', '/', 0x01e5),
('G', '<', 0x01e6),
('g', '<', 0x01e7),
('K', '<', 0x01e8),
('k', '<', 0x01e9),
('O', ';', 0x01ea),
('o', ';', 0x01eb),
('O', '1', 0x01ec),
('o', '1', 0x01ed),
('E', 'Z', 0x01ee),
('e', 'z', ... |
rust_dataset_chunk_506291 | rust_dataset.txt | 506,291 | 512 | L', '*', 0x039b),
('M', '*', 0x039c),
('N', '*', 0x039d),
('C', '*', 0x039e),
('O', '*', 0x039f),
('P', '*', 0x03a0),
('R', '*', 0x03a1),
('S', '*', 0x03a3),
('T', '*', 0x03a4),
('U', '*', 0x03a5),
('F', '*', 0x03a6),
('X', '*', 0x03a7),
('Q', '*', 0x03a8),
('W', '*',... |
rust_dataset_chunk_506292 | rust_dataset.txt | 506,292 | 512 | 03c7),
('q', '*', 0x03c8),
('w', '*', 0x03c9),
('j', '*', 0x03ca),
('v', '*', 0x03cb),
('o', '%', 0x03cc),
('u', '%', 0x03cd),
('w', '%', 0x03ce),
('\'', 'G', 0x03d8),
(',', 'G', 0x03d9),
('T', '3', 0x03da),
('t', '3', 0x03db),
('M', '3', 0x03dc),
('m', '3', 0x03dd),
... |
rust_dataset_chunk_506293 | rust_dataset.txt | 506,293 | 512 | 7),
('I', '=', 0x0418),
('J', '=', 0x0419),
('K', '=', 0x041a),
('L', '=', 0x041b),
('M', '=', 0x041c),
('N', '=', 0x041d),
('O', '=', 0x041e),
('P', '=', 0x041f),
('R', '=', 0x0420),
('S', '=', 0x0421),
('T', '=', 0x0422),
('U', '=', 0x0423),
('F', '=', 0x0424),
... |
rust_dataset_chunk_506294 | rust_dataset.txt | 506,294 | 512 | '=', 0x0445),
('c', '=', 0x0446),
('c', '%', 0x0447),
('s', '%', 0x0448),
('s', 'c', 0x0449),
('=', '\'', 0x044a),
('y', '=', 0x044b),
('%', '\'', 0x044c),
('j', 'e', 0x044d),
('j', 'u', 0x044e),
('j', 'a', 0x044f),
('i', 'o', 0x0451),
('d', '%', 0x0452),
('g', '%', ... |
rust_dataset_chunk_506295 | rust_dataset.txt | 506,295 | 512 | ),
('H', '+', 0x05d4),
('W', '+', 0x05d5),
('Z', '+', 0x05d6),
('X', '+', 0x05d7),
('T', 'j', 0x05d8),
('J', '+', 0x05d9),
('K', '%', 0x05da),
('K', '+', 0x05db),
('L', '+', 0x05dc),
('M', '%', 0x05dd),
('M', '+', 0x05de),
('N', '%', 0x05df),
('N', '+', 0x05e0),
(... |
rust_dataset_chunk_506296 | rust_dataset.txt | 506,296 | 512 | ', 0x062f),
('d', 'k', 0x0630),
('r', '+', 0x0631),
('z', '+', 0x0632),
('s', '+', 0x0633),
('s', 'n', 0x0634),
('c', '+', 0x0635),
('d', 'd', 0x0636),
('t', 'j', 0x0637),
('z', 'H', 0x0638),
('e', '+', 0x0639),
('i', '+', 0x063a),
('+', '+', 0x0640),
('f', '+', 0x064... |
rust_dataset_chunk_506297 | rust_dataset.txt | 506,297 | 512 | x06f6),
('7', 'a', 0x06f7),
('8', 'a', 0x06f8),
('9', 'a', 0x06f9),
('B', '.', 0x1e02),
('b', '.', 0x1e03),
('B', '_', 0x1e06),
('b', '_', 0x1e07),
('D', '.', 0x1e0a),
('d', '.', 0x1e0b),
('D', '_', 0x1e0e),
('d', '_', 0x1e0f),
('D', ',', 0x1e10),
('d', ',', 0x1e11),
... |
rust_dataset_chunk_506298 | rust_dataset.txt | 506,298 | 512 | ', '.', 0x1e57),
('R', '.', 0x1e58),
('r', '.', 0x1e59),
('R', '_', 0x1e5e),
('r', '_', 0x1e5f),
('S', '.', 0x1e60),
('s', '.', 0x1e61),
('T', '.', 0x1e6a),
('t', '.', 0x1e6b),
('T', '_', 0x1e6e),
('t', '_', 0x1e6f),
('V', '?', 0x1e7c),
('v', '?', 0x1e7d),
('W', '!', ... |
rust_dataset_chunk_506299 | rust_dataset.txt | 506,299 | 512 | 1eba),
('e', '2', 0x1ebb),
('E', '?', 0x1ebc),
('e', '?', 0x1ebd),
('I', '2', 0x1ec8),
('i', '2', 0x1ec9),
('O', '2', 0x1ece),
('o', '2', 0x1ecf),
('U', '2', 0x1ee6),
('u', '2', 0x1ee7),
('Y', '!', 0x1ef2),
('Y', '`', 0x1ef2),
('y', '!', 0x1ef3),
('y', '`', 0x1ef3),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.