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_508700 | rust_dataset.txt | 508,700 | 512 | old: indoc! {"
aaa
bbb
ccc
ddd
"},
patch: indoc! {"
@@ -1,4 +1,2 @@
aaa
-bbb
-ccc
ddd
... |
rust_dataset_chunk_508701 | rust_dataset.txt | 508,701 | 512 | + todo()
+}
fn handle_keystroke() {
"},
expected_new: indoc! {"
fn foo() {
modal_state.dismiss();
}
fn handle_submit() {
... |
rust_dataset_chunk_508702 | rust_dataset.txt | 508,702 | 512 | commands);
assert_eq!(applied, case.expected_new, "case {}", case.name);
}
}
}
}
pub mod qwen {
use super::*;
pub const FIM_PREFIX: &str = "<|fim_prefix|>";
pub const FIM_SUFFIX: &str = "<|fim_suffix|>";
pub const FIM_MIDDLE: &str = "<|fim_middle|>";
pub con... |
rust_dataset_chunk_508703 | rust_dataset.txt | 508,703 | 512 | context[editable_range.end..]);
if !section.ends_with('\n') {
section.push('\n');
}
section
}
}
pub mod seed_coder {
//! Seed-Coder prompt format using SPM (Suffix-Prefix-Middle) FIM mode.
//!
//! Seed-Coder uses different FIM tokens and order than Qwen:
//! - SP... |
rust_dataset_chunk_508704 | rust_dataset.txt | 508,704 | 512 | _MARKER,
SEPARATOR,
END_MARKER,
CURSOR_MARKER,
]
}
pub fn write_cursor_excerpt_section(
prompt: &mut String,
path: &Path,
context: &str,
editable_range: &Range<usize>,
cursor_offset: usize,
) {
let section = build_c... |
rust_dataset_chunk_508705 | rust_dataset.txt | 508,705 | 512 | ating_sub(diagnostics_tokens);
let related_files_section = super::format_related_files_within_budget(
related_files,
FILE_MARKER,
"",
budget_after_diagnostics,
);
let mut prompt = String::new();
prompt.push_str(&suffix_section);
p... |
rust_dataset_chunk_508706 | rust_dataset.txt | 508,706 | 512 | //! to the model, and it chooses which text to replace by outputting surrounding
//! context lines with `<|fim_middle|>` and `<|fim_suffix|>` delimiting the new
//! text.
//!
//! Example prompt:
//!
//! <|file_sep|>path/to/file.py
//! zero
//! one
//! two
//! three<|user_curs... |
rust_dataset_chunk_508707 | rust_dataset.txt | 508,707 | 512 | ) = model_output
.split_once("<|fim_middle|>\n")
.or_else(|| model_output.split_once("<|fim_middle|>"))
.ok_or_else(|| anyhow::anyhow!("missing <|fim_middle|> in model output"))?;
let (new_text, suffix_context) = rest
.split_once("<|fim_suffix|>\n")
.... |
rust_dataset_chunk_508708 | rust_dataset.txt | 508,708 | 512 | expressed as byte ranges within that context plus replacement
// text.
let hunks = parse_hunks(patch);
if hunks.is_empty() {
return Ok(String::new());
}
// Apply each hunk by finding its old_context in the text and
// performing the edits. We search forward ... |
rust_dataset_chunk_508709 | rust_dataset.txt | 508,709 | 512 | rev())
.take(max_suffix)
.take_while(|(a, b)| a == b)
.count();
let old_end = old_lines.len() - common_suffix;
let new_end = new_lines.len() - common_suffix;
if first_changed_row == old_end && first_changed_row == new_end {
return Ok(String::new(... |
rust_dataset_chunk_508710 | rust_dataset.txt | 508,710 | 512 | } else {
break;
}
}
while suffix_end < old_lines.len() {
if count_matches(old_end..suffix_end, &old_lines) > 1 {
suffix_end += 1;
} else {
break;
}
}
let mut output = String::new();
... |
rust_dataset_chunk_508711 | rust_dataset.txt | 508,711 | 512 | .push(ParsedEdit {
range: pos..pos,
text: format!("{added}\n"),
});
} else if let Some(removed) = line.strip_prefix('-') {
let start = hunk.old_context.len();
writeln!(&mut hunk.old_context, "{rem... |
rust_dataset_chunk_508712 | rust_dataset.txt | 508,712 | 512 | },
},
Case {
name: "insertion_between_existing_lines",
original: indoc! {"
a
b
c
"},
model_output: indoc! {"
a
... |
rust_dataset_chunk_508713 | rust_dataset.txt | 508,713 | 512 | user_cursor|>B
<|fim_suffix|>
c
"},
expected: indoc! {"
a
B<|user_cursor|>B
c
"},
},
Case {
... |
rust_dataset_chunk_508714 | rust_dataset.txt | 508,714 | 512 |
"},
cursor_offset: None,
expected_variable_edit: indoc! {"
a
b
<|fim_middle|>
X
<|fim_suffix|>
c
... |
rust_dataset_chunk_508715 | rust_dataset.txt | 508,715 | 512 | : indoc! {"
zero
one
two
three
four
five
"},
patch: indoc! {"
@@ -3,3 +3,3 @@
two
... |
rust_dataset_chunk_508716 | rust_dataset.txt | 508,716 | 512 | _after_apply: indoc! {"
one
a
b
c
d
two
a
b
C
d
three
... |
rust_dataset_chunk_508717 | rust_dataset.txt | 508,717 | 512 | for {}: {error}",
case.name
)
},
);
let mut edited_by_expected_variable_edit = case.old.to_string();
edited_by_expected_variable_edit
.replace_range(expected_edit_... |
rust_dataset_chunk_508718 | rust_dataset.txt | 508,718 | 512 | );
prompt.push_str(INSTRUCTION_HEADER);
prompt.push_str(input_events);
prompt.push_str(EXCERPT_HEADER);
prompt.push_str(input_excerpt);
prompt.push_str(RESPONSE_HEADER);
prompt
}
/// Formats a complete zeta1 prompt from a `Zeta2PromptInput` using the give... |
rust_dataset_chunk_508719 | rust_dataset.txt | 508,719 | 512 | {
let path_str = input.cursor_path.to_string_lossy();
let excerpt = &*input.cursor_excerpt;
let cursor_offset = input.cursor_offset_in_excerpt;
let mut prompt = String::new();
writeln!(&mut prompt, "```{path_str}").ok();
let starts_at_file_beginning =
input... |
rust_dataset_chunk_508720 | rust_dataset.txt | 508,720 | 512 | | {
let text_before_cursor = output[..zeta1_cursor_pos].replace(CURSOR_MARKER, "");
let text_before_cursor = text_before_cursor
.find(EDITABLE_REGION_START_MARKER)
.map(|pos| {
let after_marker = pos + EDITABLE_REGION_START_MARKER.len();
... |
rust_dataset_chunk_508721 | rust_dataset.txt | 508,721 | 512 | Range<usize>,
context_range: Range<usize>,
cursor_offset: usize,
) -> Zeta2PromptInput {
Zeta2PromptInput {
cursor_path: Path::new("test.rs").into(),
cursor_excerpt: excerpt.into(),
cursor_offset_in_excerpt: cursor_offset,
excerpt_start_row: N... |
rust_dataset_chunk_508722 | rust_dataset.txt | 508,722 | 512 | 7..15,
10,
vec![make_event("a.rs", "-old\n+new\n")],
vec![make_related_file("related.rs", "fn helper() {}\n")],
);
assert_eq!(
format_with_budget(&input, 10000).unwrap(),
indoc! {r#"
<|file_sep|>related.rs
fn he... |
rust_dataset_chunk_508723 | rust_dataset.txt | 508,723 | 512 | <|fim_suffix|>
<|fim_middle|>updated
"#}
.to_string()
)
);
}
#[test]
fn test_truncation_includes_partial_excerpts() {
let input = make_input(
"x",
0..1,
0,
vec![],
vec![Relat... |
rust_dataset_chunk_508724 | rust_dataset.txt | 508,724 | 512 | .
let input = make_input(
"x",
0..1,
0,
vec![],
vec![RelatedFile {
path: Path::new("big.rs").into(),
max_row: 30,
in_open_source_repo: false,
excerpts: vec![
RelatedExc... |
rust_dataset_chunk_508725 | rust_dataset.txt | 508,725 | 512 | // With large budget, both files included; rendered in stable lexicographic order.
assert_eq!(
format_with_budget(&input, 10000).unwrap(),
indoc! {r#"
<|file_sep|>file_a.rs
low priority content
<|file_sep|>file_b.rs
... |
rust_dataset_chunk_508726 | rust_dataset.txt | 508,726 | 512 | ::Lsp,
},
RelatedExcerpt {
row_range: 6..15,
text: "important fn\n".into(),
order: 1,
context_source: ContextSource::Lsp,
},
RelatedExcerpt {
... |
rust_dataset_chunk_508727 | rust_dataset.txt | 508,727 | 512 | >x
<|fim_suffix|>
<|fim_middle|>updated
"#}
.to_string()
);
assert_eq!(
format_with_budget(&input, 60).unwrap(),
indoc! {r#"
<|file_sep|>edit history
--- a/new.rs
+++ b/new.rs... |
rust_dataset_chunk_508728 | rust_dataset.txt | 508,728 | 512 | CoderModelPy").unwrap(),
ZetaFormat::V0331SeedCoderModelPy
);
}
#[test]
fn test_seed_coder_basic_format() {
let input = make_input(
"prefix\neditable\nsuffix",
7..15,
10,
vec![make_event("a.rs", "-old\n+new\n")],
vec![m... |
rust_dataset_chunk_508729 | rust_dataset.txt | 508,729 | 512 | ("related.rs", "fn helper() {}\n")],
);
input.active_buffer_diagnostics = vec![
ActiveBufferDiagnostic {
severity: Some(1),
message: "missing semicolon".to_string(),
snippet: "let value = 1".to_string(),
snippet_buffer_row_range... |
rust_dataset_chunk_508730 | rust_dataset.txt | 508,730 | 512 | _without_related_files() {
let excerpt = indoc! {"
line01
line02
line03
line04
line05
line06
line07
line08
line09
line10
line11
line12
line13
li... |
rust_dataset_chunk_508731 | rust_dataset.txt | 508,731 | 512 | }\n";
let cursor_offset = current_text.find("let value").unwrap();
let input = Zeta2PromptInput {
cursor_path: Path::new("test.rs").into(),
cursor_excerpt: current_text.into(),
cursor_offset_in_excerpt: cursor_offset,
excerpt_start_row: Some(0),
... |
rust_dataset_chunk_508732 | rust_dataset.txt | 508,732 | 512 | >readonly.rs\n"));
assert!(prompt.contains("<filename>readonly.rs\n<|marker_"));
assert!(prompt.contains("pub fn readonly() {}"));
assert_eq!(
prompt.matches(hashed_regions::MARKER_TAG_PREFIX).count(),
marker_count
);
assert!(!prompt.contains(seed_coder::S... |
rust_dataset_chunk_508733 | rust_dataset.txt | 508,733 | 512 | let patch =
parse_zeta2_model_output_as_patch(&output, ZetaFormat::V0615HashRegions, &input)
.unwrap();
assert!(patch.contains("--- a/helper.rs"), "patch: {patch}");
assert!(patch.contains("@@ -11,"), "patch: {patch}");
assert!(patch.contains("- one();"), "patch:... |
rust_dataset_chunk_508734 | rust_dataset.txt | 508,734 | 512 | _zeta2_model_output_as_patch(&output, ZetaFormat::V0615HashRegions, &input)
.unwrap();
assert!(output.contains(hashed_regions::MARKER_TAG_PREFIX));
assert!(
parsed_patch.contains("- one();"),
"patch: {parsed_patch}"
);
assert!(
pars... |
rust_dataset_chunk_508735 | rust_dataset.txt | 508,735 | 512 | zeta3_input, ZetaFormat::V0318SeedMultiRegions),
format_zeta_prompt(&zeta2_input, ZetaFormat::V0318SeedMultiRegions),
);
}
#[test]
fn test_zeta3_parse_seed_multi_region_output_as_patch() {
let prefix = (0..20)
.map(|index| format!("prefix {index}\n"))
.co... |
rust_dataset_chunk_508736 | rust_dataset.txt | 508,736 | 512 | 10, vec![], vec![]);
assert_eq!(
format_seed_coder(&input),
indoc! {r#"
<[fim-suffix]>
after
<[fim-prefix]><filename>test.rs
before
<<<<<<< CURRENT
mid<|user_cursor|>dle
====... |
rust_dataset_chunk_508737 | rust_dataset.txt | 508,737 | 512 | : ContextSource::Lsp,
}],
},
RelatedFile {
path: Path::new("high_prio.rs").into(),
max_row: 5,
in_open_source_repo: false,
excerpts: vec![RelatedExcerpt {
row_range... |
rust_dataset_chunk_508738 | rust_dataset.txt | 508,738 | 512 | _context_350: 0..excerpt.len(),
editable_180_context_350: 0..excerpt.len(),
editable_350_context_150: 0..excerpt.len(),
..Default::default()
},
syntax_ranges: None,
in_open_source_repo: false,
can_collect_data: false,
... |
rust_dataset_chunk_508739 | rust_dataset.txt | 508,739 | 512 | 28,
editable_180_context_350: 0..28,
editable_350_context_150: 0..28,
..Default::default()
},
syntax_ranges: None,
in_open_source_repo: false,
can_collect_data: false,
repo_url: None,
};
let prom... |
rust_dataset_chunk_508740 | rust_dataset.txt | 508,740 | 512 | can_collect_data: false,
repo_url: None,
};
let prompt = zeta1::format_zeta1_from_input(&input, editable_range, context_range);
assert_eq!(
prompt,
concat!(
"### Instruction:\n",
"You are a code completion assistant and your ... |
rust_dataset_chunk_508741 | rust_dataset.txt | 508,741 | 512 | _budget(
&input.events,
"<|file_sep|>",
"edit history",
usize::MAX,
2,
);
assert_eq!(
&edit_history_section,
indoc!(
"
<|file_sep|>edit history
--- a/event-1.rs
... |
rust_dataset_chunk_508742 | rust_dataset.txt | 508,742 | 512 | fn apply_edit(excerpt: &str, parsed_output: &ParsedOutput) -> String {
let mut result = excerpt.to_string();
result.replace_range(
parsed_output.range_in_excerpt.clone(),
&parsed_output.new_editable_region,
);
result
}
#[test]
fn test_parse_zeta2_mod... |
rust_dataset_chunk_508743 | rust_dataset.txt | 508,743 | 512 | parse_zeta2_model_output("new content\n", format, &input).unwrap();
assert_eq!(apply_edit(excerpt, &output1), apply_edit(excerpt, &output2));
assert_eq!(apply_edit(excerpt, &output1), "new content\n");
}
#[test]
fn test_parsed_output_to_patch_round_trips_through_udiff_application() {
... |
rust_dataset_chunk_508744 | rust_dataset.txt | 508,744 | 512 | );
})
.detach();
}
#[derive(Clone, Debug, RegisterSetting)]
pub struct ZlogSettings {
/// A map of log scopes to the desired log level.
/// Useful for filtering out noisy logs or enabling more verbose logging.
///
/// Example: {"log": {"client": "warn"}}
pub scopes: HashMap<String, String>,... |
rust_dataset_chunk_508745 | rust_dataset.txt | 508,745 | 512 | }
if level.eq_ignore_ascii_case("ERROR") {
return Ok(log::LevelFilter::Error);
}
if level.eq_ignore_ascii_case("OFF") || level.eq_ignore_ascii_case("NONE") {
return Ok(log::LevelFilter::Off);
}
anyhow::bail!("Invalid level: {level}")
}
#[cfg(test)]
mod tests {
use super::*;
... |
rust_dataset_chunk_508746 | rust_dataset.txt | 508,746 | 512 | },
};
use crate::{SCOPE_DEPTH_MAX, SCOPE_STRING_SEP_STR, ScopeAlloc, ScopeRef, env_config, private};
use log;
static ENV_FILTER: OnceLock<env_config::EnvFilter> = OnceLock::new();
static SCOPE_MAP: RwLock<ScopeMap> = RwLock::new(ScopeMap::empty());
pub const LEVEL_ENABLED_MAX_DEFAULT: log::LevelFilter = log::LevelF... |
rust_dataset_chunk_508747 | rust_dataset.txt | 508,747 | 512 | ("simplecss::selector", log::LevelFilter::Error),
("pet", log::LevelFilter::Warn),
];
pub fn init_env_filter(filter: env_config::EnvFilter) {
if let Some(level_max) = filter.level_global {
LEVEL_ENABLED_MAX_STATIC.store(level_max as u8, Ordering::Release)
}
if ENV_FILTER.set(filter).is_err(... |
rust_dataset_chunk_508748 | rust_dataset.txt | 508,748 | 512 | }
LEVEL_ENABLED_MAX_CONFIG.store(level_enabled_max, Ordering::Release);
{
let mut global_map = SCOPE_MAP.write().unwrap_or_else(|err| {
SCOPE_MAP.clear_poison();
err.into_inner()
});
*global_map = map_new;
}
log::trace!("Log configuration updated");
}... |
rust_dataset_chunk_508749 | rust_dataset.txt | 508,749 | 512 | std::ops::Range<usize>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum EnabledStatus {
Enabled,
Disabled,
NotConfigured,
}
impl ScopeMap {
pub fn new_from_settings_and_env(
items_input_map: &HashMap<String, String>,
env_config: Option<&env_config::EnvFilter>,
default_... |
rust_dataset_chunk_508750 | rust_dataset.txt | 508,750 | 512 | modules,
root_count: 0,
};
let items_count = items.len();
struct ProcessQueueEntry {
parent_index: usize,
depth: usize,
items_range: std::ops::Range<usize>,
}
let mut process_queue = VecDeque::new();
process_queue.push_ba... |
rust_dataset_chunk_508751 | rust_dataset.txt | 508,751 | 512 | .root_count = res_entries_end;
}
}
this
}
pub fn is_empty(&self) -> bool {
self.entries.is_empty() && self.modules.is_empty()
}
pub fn is_enabled<S>(
&self,
scope: &[S; SCOPE_DEPTH_MAX],
module_path: Option<&str>,
level: log::Level,
... |
rust_dataset_chunk_508752 | rust_dataset.txt | 508,752 | 512 | return EnabledStatus::Disabled;
}
EnabledStatus::NotConfigured
}
const fn empty() -> ScopeMap {
ScopeMap {
entries: vec![],
modules: vec![],
root_count: 0,
}
}
}
#[cfg(test)]
mod tests {
use log::LevelFilter;
use crate::Scope;
... |
rust_dataset_chunk_508753 | rust_dataset.txt | 508,753 | 512 | _MAX];
let mut index = 0;
let mut scope_iter = scope_str.split(SCOPE_STRING_SEP_STR);
while index < SCOPE_DEPTH_MAX {
let Some(scope) = scope_iter.next() else {
break;
};
if scope.is_empty() {
continue;
}
... |
rust_dataset_chunk_508754 | rust_dataset.txt | 508,754 | 512 | );
assert_eq!(
map.is_enabled(&scope_from_scope_str("m.n.o.p"), None, Level::Info),
EnabledStatus::Disabled
);
assert_eq!(
map.is_enabled(&scope_from_scope_str("q.r.s.t"), None, Level::Error),
EnabledStatus::Enabled
);
asse... |
rust_dataset_chunk_508755 | rust_dataset.txt | 508,755 | 512 | the scope overrides the module path
assert_eq!(
map.is_enabled(
&scope_from_scope_str("a.scope"),
Some("a::b::d"),
Level::Trace
),
EnabledStatus::Enabled,
);
}
fn scope_map_from_keys_and_env(kv: &[(&str, &str)]... |
rust_dataset_chunk_508756 | rust_dataset.txt | 508,756 | 512 | .entries[5].scope, "u");
assert_eq!(
map.is_enabled(&scope_new(&["a", "b", "c", "d"]), None, log::Level::Trace),
EnabledStatus::Enabled
);
assert_eq!(
map.is_enabled(&scope_new(&["a", "b", "c"]), None, log::Level::Trace),
EnabledStatus::Disabled
... |
rust_dataset_chunk_508757 | rust_dataset.txt | 508,757 | 512 | .n.o", "warn"), // Overrides env
("j.k.l", "info"), // New filter
("crate::module::env", "trace"), // Overrides env for module
("crate::module::kv", "trace"), // New module filter
];
let map = scope_map_from_all(kv_filters, &env_filter, d... |
rust_dataset_chunk_508758 | rust_dataset.txt | 508,758 | 512 | modules"
);
// Default is used when no override exists for modules
assert_eq!(
map.is_enabled(
&scope_new(&[""]),
Some("crate::module::default"),
Level::Error
),
EnabledStatus::Enabled,
"Default fil... |
rust_dataset_chunk_508759 | rust_dataset.txt | 508,759 | 512 | (&[], &env_config::parse("").unwrap(), default_filters);
use log::Level;
assert_eq!(
map.is_enabled(&scope_new(&[""]), Some("crate::submodule"), Level::Error),
EnabledStatus::Disabled,
"crate::submodule should be disabled by disabling `crate` filter"
);
}... |
rust_dataset_chunk_508760 | rust_dataset.txt | 508,760 | 512 | module_path: Option<&'a str>,
pub line: Option<u32>,
}
pub fn init_output_stdout() {
// Use atomics here instead of just a `static mut`, since in the context
// of tests these accesses can be multi-threaded.
ENABLED_SINKS_STDOUT.store(true, Ordering::Release);
}
pub fn init_output_stderr() {
ENAB... |
rust_dataset_chunk_508761 | rust_dataset.txt | 508,761 | 512 | // Warn: Yellow
ANSI_GREEN, // Info: Green
ANSI_BLUE, // Debug: Blue
ANSI_MAGENTA, // Trace: Magenta
];
// PERF: batching
pub fn submit(mut record: Record) {
if record.module_path.is_none_or(|p| !p.ends_with(".rs")) {
// Only render line numbers for actual rust files emitted by `log_err` ... |
rust_dataset_chunk_508762 | rust_dataset.txt | 508,762 | 512 | .len())
}
fn flush(&mut self) -> io::Result<()> {
self.file.flush()
}
}
let file_size_bytes = {
let mut writer = SizedWriter { file, written: 0 };
_ = writeln!(
&mut writer,
"{} {} {} {}",
... |
rust_dataset_chunk_508763 | rust_dataset.txt | 508,763 | 512 |
if (self.scope[1].is_empty() && self.module_path.is_some()) || self.scope[0].is_empty() {
f.write_str(self.module_path.unwrap_or("?"))?;
} else {
f.write_str(self.scope[0])?;
for subscope in &self.scope[1..] {
if subscope.is_empty() {
... |
rust_dataset_chunk_508764 | rust_dataset.txt | 508,764 | 512 | assert!(log_file_path.exists());
assert_eq!(log_file_path.metadata().unwrap().len(), 0);
assert!(rotation_log_file_path.exists());
assert_eq!(std::fs::read_to_string(&log_file_path).unwrap(), "");
}
#[test]
fn test_open_or_create_log_file() {
let temp_dir = tempfile::tempdi... |
rust_dataset_chunk_508765 | rust_dataset.txt | 508,765 | 512 | pub fn init_test() {
if get_env_config().is_some() && try_init(None).is_ok() {
init_output_stdout();
}
}
fn get_env_config() -> Option<String> {
std::env::var("ZED_LOG")
.or_else(|_| std::env::var("RUST_LOG"))
.ok()
.or_else(|| {
if std::env::var("CI").is_ok() {
... |
rust_dataset_chunk_508766 | rust_dataset.txt | 508,766 | 512 | ();
}
}
#[macro_export]
macro_rules! log {
($logger:expr, $level:expr, $($arg:tt)+) => {
let level = $level;
let logger = $logger;
let enabled = $crate::filter::is_scope_enabled(&logger.scope, Some(module_path!()), level);
if enabled {
$crate::sink::submit($crate::si... |
rust_dataset_chunk_508767 | rust_dataset.txt | 508,767 | 512 | _impl::Level::Error, $($arg)+);
};
($($arg:tt)+) => {
$crate::log!($crate::default_logger!(), $crate::log_impl::Level::Error, $($arg)+);
};
}
/// Creates a timer that logs the duration it was active for either when
/// it is dropped, or when explicitly stopped using the `end` method.
/// Logs at th... |
rust_dataset_chunk_508768 | rust_dataset.txt | 508,768 | 512 | therefore must be public,
/// but should not be used directly
pub mod private {
use super::*;
pub const fn extract_crate_name_from_module_path(module_path: &str) -> &str {
let mut i = 0;
let mod_path_bytes = module_path.as_bytes();
let mut index = mod_path_bytes.len();
while i ... |
rust_dataset_chunk_508769 | rust_dataset.txt | 508,769 | 512 | flush();
}
}
pub struct Timer {
pub logger: Logger,
pub start_time: std::time::Instant,
pub name: &'static str,
pub warn_if_longer_than: Option<std::time::Duration>,
pub done: bool,
}
impl Drop for Timer {
fn drop(&mut self) {
self.finish();
}
}
impl Timer {
#[must_use = "... |
rust_dataset_chunk_508770 | rust_dataset.txt | 508,770 | 512 | _module"),
"my_speedy_crate_:⚡️:some_module"
);
assert_eq!(
private::extract_crate_name_from_module_path("my_speedy_crate_::⚡️some_module"),
"my_speedy_crate_"
);
}
}
--- FILE: zed/crates/ztracing/build.rs ---
use std::env;
fn main() {
if env::var_o... |
rust_dataset_chunk_508771 | rust_dataset.txt | 508,771 | 512 | web"))))]
pub use __consume_all_tokens as info_span;
#[cfg(not(any(ztracing, all(target_family = "wasm", feature = "web"))))]
pub use __consume_all_tokens as debug_span;
#[cfg(not(any(ztracing, all(target_family = "wasm", feature = "web"))))]
pub use __consume_all_tokens as warn_span;
#[cfg(not(any(ztracing, all(target... |
rust_dataset_chunk_508772 | rust_dataset.txt | 508,772 | 512 | tracy subscriber, you can now connect the profiler");
tracing::subscriber::set_global_default(
tracing_subscriber::registry()
.with(tracing_tracy::TracyLayer::new(TracyLayerConfig::default())),
)
.expect("setup tracy layer");
}
#[cfg(all(target_family = "wasm", feature = "web"))]
mod w... |
rust_dataset_chunk_508773 | rust_dataset.txt | 508,773 | 512 | pub struct PerformanceLayer {
event_sender: async_channel::Sender<Event>,
dropped_event_count: Arc<AtomicUsize>,
}
pub struct PerformanceReporter {
event_receiver: async_channel::Receiver<Event>,
dropped_event_count: Arc<AtomicUsize>,
}
enum Event {
NewSpan {
span_id: u64,
target: ... |
rust_dataset_chunk_508774 | rust_dataset.txt | 508,774 | 512 | }
fn on_enter(&self, id: &Id, _context: tracing_subscriber::layer::Context<'_, S>) {
let Some(timestamp) = absolute_now() else {
return;
};
self.send(Event::Enter {
span_id: id.into_u64(),
source_thread_id: source_thread_id(),
timestamp,
... |
rust_dataset_chunk_508775 | rust_dataset.txt | 508,775 | 512 | completed_measures: &mut Vec<CompletedMeasure>) {
match event {
Event::NewSpan {
span_id,
target,
name,
} => {
self.spans.insert(
span_id,
SpanState {
display_... |
rust_dataset_chunk_508776 | rust_dataset.txt | 508,776 | 512 | _then(|performance| performance.dyn_into().ok())
})
.as_ref()
.map(callback)
})
}
fn report_measure(performance: &Performance, reporter_time_origin: f64, measure: CompletedMeasure) {
let start = measure.start - reporter_time_origin;
if start < 0.0 {
web_sys::cons... |
rust_dataset_chunk_508777 | rust_dataset.txt | 508,777 | 512 | {
span_id: 1,
target: "editor",
name: "layout",
},
&mut completed_measures,
);
state.process(
Event::Enter {
span_id: 1,
source_thread_id: 2,
timestamp: 10.0,
... |
rust_dataset_chunk_508778 | rust_dataset.txt | 508,778 | 512 | ::fs;
use zed::settings::LspSettings;
use zed_extension_api::{self as zed, LanguageServerId, Result, serde_json};
struct GlslExtension {
cached_binary_path: Option<String>,
}
impl GlslExtension {
fn language_server_binary_path(
&mut self,
language_server_id: &LanguageServerId,
worktree... |
rust_dataset_chunk_508779 | rust_dataset.txt | 508,779 | 512 | ServerInstallationStatus::Downloading,
);
zed::download_file(
&asset.download_url,
&version_dir,
match platform {
zed::Os::Mac | zed::Os::Linux => zed::DownloadedFileType::Zip,
zed::Os::Windows => zed::Downl... |
rust_dataset_chunk_508780 | rust_dataset.txt | 508,780 | 512 | vscode-html-language-server";
const SERVER_PATH: &str =
"node_modules/@zed-industries/vscode-langservers-extracted/bin/vscode-html-language-server";
const PACKAGE_NAME: &str = "@zed-industries/vscode-langservers-extracted";
struct HtmlExtension {
cached_binary_path: Option<String>,
}
impl HtmlExtension {
... |
rust_dataset_chunk_508781 | rust_dataset.txt | 508,781 | 512 | env::current_dir()
.unwrap()
.join(&server_path)
.to_string_lossy()
.to_string()
};
self.cached_binary_path = Some(server_path.clone());
Ok(zed::Command {
command: zed::node_binary_path()?,
args:... |
rust_dataset_chunk_508782 | rust_dataset.txt | 508,782 | 512 | Command {
command: path,
args,
env: Default::default(),
});
} else if let Some(path) = self.cached_binary_path.clone() {
return Ok(zed::Command {
command: path,
args,
env: Default::default(),
... |
rust_dataset_chunk_508783 | rust_dataset.txt | 508,783 | 512 | _path = Some(binary_path.clone());
Ok(zed::Command {
command: binary_path,
args,
env: Default::default(),
})
}
}
--- FILE: zed/extensions/proto/src/language_servers/protobuf_language_server.rs ---
use zed_extension_api::{self as zed, Result, settings::LspSettin... |
rust_dataset_chunk_508784 | rust_dataset.txt | 508,784 | 512 | new() -> Self {
ProtoLs {
cached_binary_path: None,
}
}
pub(crate) fn language_server_binary(
&mut self,
worktree: &zed::Worktree,
) -> Result<zed::Command> {
let binary_settings = LspSettings::for_worktree(Self::SERVER_NAME, worktree)
.ok()
... |
rust_dataset_chunk_508785 | rust_dataset.txt | 508,785 | 512 | Zip
} else {
DownloadedFileType::GzipTar
};
let version_dir = format!("{}-{}", Self::SERVER_NAME, latest_release.version);
let binary_path = format!("{version_dir}/protols");
let download_target = latest_release
.assets
.into_iter()
... |
rust_dataset_chunk_508786 | rust_dataset.txt | 508,786 | 512 | Self {
Self {
protobuf_language_server: None,
protols: None,
buf_lsp: None,
}
}
fn language_server_command(
&mut self,
language_server_id: &zed_extension_api::LanguageServerId,
worktree: &zed_extension_api::Worktree,
) -> zed_exte... |
rust_dataset_chunk_508787 | rust_dataset.txt | 508,787 | 512 | <String> {
let (platform, arch) = zed::current_platform();
let current_dir = std::env::current_dir().unwrap();
println!("current_dir: {}", current_dir.display());
assert_eq!(
current_dir.file_name().unwrap().to_str().unwrap(),
"test-extension"
);
... |
rust_dataset_chunk_508788 | rust_dataset.txt | 508,788 | 512 | arch}-{os}.{ext}",
version = release.version,
arch = match arch {
zed::Architecture::Aarch64 => "aarch64",
zed::Architecture::X8664 => "x86_64",
},
os = match platform {
zed::Os::Mac => "apple-darwin",
zed::O... |
rust_dataset_chunk_508789 | rust_dataset.txt | 508,789 | 512 | args: vec!["lsp".to_string()],
env: Default::default(),
})
}
fn label_for_completion(
&self,
_language_server_id: &LanguageServerId,
completion: zed::lsp::Completion,
) -> Option<zed::CodeLabel> {
let name = &completion.label;
let ty =... |
rust_dataset_chunk_508790 | rust_dataset.txt | 508,790 | 512 | , PullRequestData, PullRequestReview, Repository, ReviewState,
},
report::{Report, ReportEntry},
};
const ZED_ZIPPY_COMMENT_APPROVAL_PATTERN: &str = "@zed-zippy approve";
const ZED_ZIPPY_GROUP_APPROVAL: &str = "@zed-industries/approved";
#[derive(Debug)]
pub enum ReviewSuccess {
ApprovingComment(Vec<PullR... |
rust_dataset_chunk_508791 | rust_dataset.txt | 508,791 | 512 | Error),
}
impl fmt::Display for ReviewFailure {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::NoPullRequestFound => formatter.write_str("No pull request found"),
Self::Unreviewed => formatter
.write_str("No qualifying organizat... |
rust_dataset_chunk_508792 | rust_dataset.txt | 508,792 | 512 | self,
metadata: &CommitMetadata,
files: &[CommitFileChange],
) -> Result<(), AutomatedChangeFailure> {
let expected_loc = self.expected_loc();
if metadata.additions() != expected_loc || metadata.deletions() != expected_loc {
return Err(AutomatedChangeFailure::UnexpectedL... |
rust_dataset_chunk_508793 | rust_dataset.txt | 508,793 | 512 | return Ok(approval);
}
if let Some(approval) = self
.check_approving_pull_request_comment(&pull_request)
.await?
{
return Ok(approval);
}
if let Some(approval) = self.check_commit_co_authors(commit).await? {
return Ok(approval);
... |
rust_dataset_chunk_508794 | rust_dataset.txt | 508,794 | 512 | <ReviewSuccess>, ReviewFailure> {
if commit.co_authors().is_some()
&& let Some(commit_authors) = self
.github_client
.get_commit_metadata(&Repository::ZED, &[commit.sha()])
.await?
.get(commit.sha())
.and_then(|authors| ... |
rust_dataset_chunk_508795 | rust_dataset.txt | 508,795 | 512 | _actor = pull_request
.user
.as_ref()
.is_none_or(|pr_user| pr_user.login != author_login);
let approving_pattern = item
.review_state()
.is_some_and(|state| state == ReviewState::Approved)
|| item.body().is_some_and(Self::contains_approvi... |
rust_dataset_chunk_508796 | rust_dataset.txt | 508,796 | 512 | GithubApi {
pull_request: PullRequestData,
reviews: Vec<PullRequestReview>,
comments: Vec<PullRequestComment>,
commit_metadata_json: serde_json::Value,
commit_files: Vec<CommitFileChange>,
org_members: Vec<String>,
}
#[async_trait::async_trait(?Send)]
impl Gi... |
rust_dataset_chunk_508797 | rust_dataset.txt | 508,797 | 512 | imiter|{author_name}|field-delimiter|{author_email}|field-delimiter|\
{title}|body-delimiter|{body}|commit-delimiter|"
);
CommitList::from_str(&formatted)
.expect("test commit should parse")
.into_iter()
.next()
.expect("should have one commit... |
rust_dataset_chunk_508798 | rust_dataset.txt | 508,798 | 512 | _commit() -> Self {
Self {
pull_request: PullRequestData {
number: 1234,
user: Some(GithubUser {
login: "alice".to_owned(),
}),
merged_by: None,
labels: None,
... |
rust_dataset_chunk_508799 | rust_dataset.txt | 508,799 | 512 | to_owned(),
},
CommitFileChange {
filename: "crates/zed/Cargo.toml".to_owned(),
},
],
org_members: vec![],
commit: make_commit(
"abc12345abc12345",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.