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_508100 | rust_dataset.txt | 508,100 | 512 | _EXCLUDE).as_ref(),
"file.txt\n".as_bytes(),
)
.await
.unwrap();
cx.run_until_parked();
feature_tree.read_with(cx, |tree, _| {
check_worktree_entries(
tree,
WorktreeExpectations {
ignored_paths: &["file.txt", "subdir/file.txt"],
... |
rust_dataset_chunk_508101 | rust_dataset.txt | 508,101 | 512 | |tree, _| tree.as_local().unwrap().scan_complete())
.await;
cx.run_until_parked();
// For a linked worktree, root_repo_common_dir should point to the
// main repo's .git, not the worktree-specific git directory.
tree.read_with(cx, |tree, _| {
assert_eq!(
tree.snapshot().roo... |
rust_dataset_chunk_508102 | rust_dataset.txt | 508,102 | 512 | _parked();
worktree.read_with(cx, |worktree, _| {
let local_worktree = worktree.as_local().unwrap();
assert!(local_worktree.repositories().is_empty());
assert_eq!(local_worktree.root_repo_common_dir(), None);
});
}
#[gpui::test]
async fn test_linked_worktree_gitfile_event_preserves_rep... |
rust_dataset_chunk_508103 | rust_dataset.txt | 508,103 | 512 | arked();
// Overwrite the .git gitfile with garbage to trigger an event for the
// gitfile path itself, which only matches `dot_git_abs_path`.
fs.write(path!("/linked_worktree/.git").as_ref(), b"garbage")
.await
.unwrap();
tree.flush_fs_events(cx).await;
// The worktree should stil... |
rust_dataset_chunk_508104 | rust_dataset.txt | 508,104 | 512 | .emit_fs_event(
path!("/project/main_repo/.git/refs/heads/main"),
Some(PathEventKind::Changed),
);
executor.run_until_parked();
let mut updated_work_dirs = Vec::new();
while let Ok(event) = events.try_recv() {
if let Event::UpdatedGitRepositories(updates) = event {
u... |
rust_dataset_chunk_508105 | rust_dataset.txt | 508,105 | 512 | ::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
.unwrap();
tree.update(cx, |tree, _| tree.as_local().unwrap().scan_complete())
.await;
cx.run_until_parked();
let repo_update_count: Rc<Cell<usize>> = Rc::new(Cell::new(0));
tree.updat... |
rust_dataset_chunk_508106 | rust_dataset.txt | 508,106 | 512 | /worktrees/feature/index.lock"),
];
for path in skipped_paths {
fs.emit_fs_event(path, Some(PathEventKind::Changed));
cx.run_until_parked();
assert_eq!(
repo_update_count.get(),
0,
"event for {path} should not emit UpdatedGitRepositories"
);
... |
rust_dataset_chunk_508107 | rust_dataset.txt | 508,107 | 512 | ();
let repo_update_count: Rc<Cell<usize>> = Rc::new(Cell::new(0));
tree.update(cx, {
let repo_update_count = repo_update_count.clone();
|_, cx| {
cx.subscribe(&cx.entity(), move |_, _, event, _| {
if matches!(event, Event::UpdatedGitRepositories(_)) {
... |
rust_dataset_chunk_508108 | rust_dataset.txt | 508,108 | 512 | scan_complete())
.await;
cx.run_until_parked();
let repo_update_count: Rc<Cell<usize>> = Rc::new(Cell::new(0));
tree.update(cx, {
let repo_update_count = repo_update_count.clone();
|_, cx| {
cx.subscribe(&cx.entity(), move |_, _, event, _| {
if matches!(e... |
rust_dataset_chunk_508109 | rust_dataset.txt | 508,109 | 512 | .txt").as_ref(),
"content".as_bytes(),
)
.await
.unwrap();
let tree = Worktree::local(
path!("/linked_worktree").as_ref(),
true,
fs.clone(),
Arc::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
.unwrap(... |
rust_dataset_chunk_508110 | rust_dataset.txt | 508,110 | 512 | (),
)
.await
.unwrap();
worktree
.update(cx, |worktree, _| {
worktree.as_local().unwrap().scan_complete()
})
.await;
cx.run_until_parked();
let dot_git = project_dir.join(DOT_GIT);
// Case 1: Event for .git/index.lock only should NOT emit UpdatedGitRepos... |
rust_dataset_chunk_508111 | rust_dataset.txt | 508,111 | 512 | );
assert!(
got_git_update,
"should emit UpdatedGitRepositories for a .git/index event"
);
}
{
let mut events = cx.events(&worktree);
fs.pause_events();
fs.emit_fs_event(dot_git, Some(PathEventKind::Rescan));
fs.unpause_events_and_flush();... |
rust_dataset_chunk_508112 | rust_dataset.txt | 508,112 | 512 | Id::from_proto(0),
&mut cx.to_async(),
)
.await
.unwrap();
worktree
.update(cx, |worktree, _| {
worktree.as_local().unwrap().scan_complete()
})
.await;
cx.run_until_parked();
let dot_git = project_dir.join(DOT_GIT);
// The exact batch Windows del... |
rust_dataset_chunk_508113 | rust_dataset.txt | 508,113 | 512 | rescan.
{
let mut events = cx.events(&worktree);
fs.pause_events();
fs.emit_fs_event(dot_git, Some(PathEventKind::Changed));
fs.unpause_events_and_flush();
executor.run_until_parked();
let got_git_update = drain_git_repo_updates(&mut events);
assert!(
... |
rust_dataset_chunk_508114 | rust_dataset.txt | 508,114 | 512 | dir.path().join(".git/refs/remotes/origin/main"),
"2222222222222222222222222222222222222222\n",
)
.unwrap();
expect_git_repo_update(
&mut events,
cx,
"updating a ref in a directory created after the initial scan",
)
.await;
}
async fn expect_git_repo_update(
eve... |
rust_dataset_chunk_508115 | rust_dataset.txt | 508,115 | 512 | // --- Success Cases ---
let success_cases = vec![
TestCase {
name: "utf8.txt",
bytes: "こんにちは".as_bytes().to_vec(),
expected_text: "こんにちは",
},
TestCase {
name: "sjis.txt",
bytes: vec![0x82, 0xb1, 0x82, 0xf1, 0x82, 0xc9, 0x82, 0x... |
rust_dataset_chunk_508116 | rust_dataset.txt | 508,116 | 512 | , 0x61, 0x30, 0x6F, 0x30,
],
expected_text: "こんにちは",
},
// UTF-16BE with BOM
TestCase {
name: "utf16be_bom.txt",
bytes: vec![
0xFE, 0xFF, // BOM
0x30, 0x53, 0x30, 0x93, 0x30, 0x6B, 0x30, 0x61, 0x30, 0x6F,
... |
rust_dataset_chunk_508117 | rust_dataset.txt | 508,117 | 512 | cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
let rel_path = |name: &str| {
RelPath::new(&Path::new(name), PathStyle::local())
.unwrap()
.into_arc()
};
// Run Success Tests
for case in success_cases {
let loaded = tree
... |
rust_dataset_chunk_508118 | rust_dataset.txt | 508,118 | 512 | _bom: false,
expected_bytes: vec![0x82, 0xb1, 0x82, 0xf1, 0x82, 0xc9, 0x82, 0xbf, 0x82, 0xcd],
},
// UTF-8 No BOM
TestCase {
name: "UTF-8 No BOM",
text: "AB",
encoding: encoding_rs::UTF_8,
has_bom: false,
expected_bytes: vec... |
rust_dataset_chunk_508119 | rust_dataset.txt | 508,119 | 512 | 61, 0x30, 0x6f],
},
// UTF-16BE with BOM
TestCase {
name: "UTF-16BE with BOM",
text: "A",
encoding: encoding_rs::UTF_16BE,
has_bom: true,
expected_bytes: vec![0xFE, 0xFF, 0x00, 0x41],
},
];
for (i, case) in cases.into_i... |
rust_dataset_chunk_508120 | rust_dataset.txt | 508,120 | 512 | .to_async(),
)
.await
.unwrap();
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
tree.read_with(cx, |tree, _| {
assert_eq!(
tree.entries(true, 0)
.map(|e| e.path.as_ref())
.collect::<Vec<_>>(),
&[rel_pa... |
rust_dataset_chunk_508121 | rust_dataset.txt | 508,121 | 512 | !(tree.is_single_file(), "Should be a single-file worktree");
assert_eq!(tree.abs_path().as_ref(), Path::new("/root/test.txt"));
});
// Delete the file
fs.remove_file(Path::new("/root/test.txt"), Default::default())
.await
.unwrap();
// Subscribe to worktree events
let dele... |
rust_dataset_chunk_508122 | rust_dataset.txt | 508,122 | 512 | _ref(), Path::new(path!("/code/project")));
});
cx.background_executor
.advance_clock(worktree::ROOT_PATH_CHECK_INTERVAL);
cx.background_executor.run_until_parked();
tree.read_with(cx, |tree, _| {
assert_eq!(tree.abs_path().as_ref(), Path::new(path!("/src/project")));
assert_eq... |
rust_dataset_chunk_508123 | rust_dataset.txt | 508,123 | 512 | update_from_remote(proto::UpdateWorktree {
project_id: 1,
worktree_id: 1,
abs_path: "/home/user/project".to_string(),
root_name: "project".to_string(),
updated_entries: vec![proto::Entry {
id: 1,
is_d... |
rust_dataset_chunk_508124 | rust_dataset.txt | 508,124 | 512 | : false,
is_private: false,
};
cx.read(|cx| {
assert_eq!(
language::File::full_path(&file, cx),
PathBuf::from("config")
);
assert_eq!(
language::File::file_system_abs_path(&file, cx),
Some(PathBuf::from("/home/user/.ssh/config"))
... |
rust_dataset_chunk_508125 | rust_dataset.txt | 508,125 | 512 | "C:\Users\user\.ssh\config",
"",
PathStyle::Windows,
),
(
"config",
r"\\server\share\.ssh\config",
"",
PathStyle::Windows,
),
(
"config",
"C:/Users/user/.ssh/config",
"",
... |
rust_dataset_chunk_508126 | rust_dataset.txt | 508,126 | 512 | _with_git_emits_root_repo_event_when_repo_info_arrives(
cx: &mut TestAppContext,
) {
cx.update(|cx| {
let store = SettingsStore::test(cx);
cx.set_global(store);
});
let client = AnyProtoClient::new(NoopProtoClient::new());
let worktree = cx.update(|cx| {
Worktree::remote(
... |
rust_dataset_chunk_508127 | rust_dataset.txt | 508,127 | 512 | : vec![],
root_repo_common_dir: Some("/home/user/project/.git".to_string()),
root_repo_is_linked_worktree: false,
});
});
cx.run_until_parked();
let fired = events.lock().unwrap();
assert!(
fired.contains(&"UpdatedRootRepoCommonDir"),
"Update... |
rust_dataset_chunk_508128 | rust_dataset.txt | 508,128 | 512 | _id,
is_last_update,
updated_repositories: vec![],
removed_repositories: vec![],
root_repo_common_dir: None,
root_repo_is_linked_worktree: false,
};
// A mid-scan update without repo info must not clobber the seeded
// metadata: the sender's scanner may not have regi... |
rust_dataset_chunk_508129 | rust_dataset.txt | 508,129 | 512 | Worktree::local(
path!("/root").as_ref(),
true,
fs.clone(),
Default::default(),
true,
WorktreeId::from_proto(1),
&mut cx.to_async(),
)
.await
.unwrap();
cx.read(|cx| host.read(cx).as_local().unwrap().scan_complete())
.await;
// The re... |
rust_dataset_chunk_508130 | rust_dataset.txt | 508,130 | 512 | UpdatedEntries(updated) = event {
changes.lock().extend(
updated
.iter()
.map(|(path, _, change)| (path.as_unix_str().to_string(), *change)),
);
}
})
.detach();
});
// Flush the initi... |
rust_dataset_chunk_508131 | rust_dataset.txt | 508,131 | 512 | subproject": {
"a.txt": "A"
}
}),
)
.await;
let worktree = Worktree::local(
path!("/root/subproject").as_ref(),
true,
fs.clone(),
Arc::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
... |
rust_dataset_chunk_508132 | rust_dataset.txt | 508,132 | 512 | .read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
cx.run_until_parked();
tree.read_with(cx, |tree, _| {
assert_eq!(
tree.entries(true, 0)
.map(|entry| (entry.path.as_ref(), entry.is_external))
.collect::<Vec<_>>(),
vec!... |
rust_dataset_chunk_508133 | rust_dataset.txt | 508,133 | 512 | ignoreBuilder::new("/repo/inner");
builder.add_line(None, "build").unwrap();
builder.add_line(None, "repo").unwrap();
let exclude = Arc::new(builder.build().unwrap());
let stack = IgnoreStack::none().append(IgnoreKind::RepoExclude, exclude);
assert!(
stack.is_abs_path_ignored(Path::new("/r... |
rust_dataset_chunk_508134 | rust_dataset.txt | 508,134 | 512 | : &mut TestAppContext) {
init_test(cx);
set_file_scan_depth(cx, Some(1));
let fs = FakeFs::new(cx.background_executor.clone());
fs.insert_tree(
path!("/root"),
json!({
"junk": {
"a": {
"b": {
"deep.txt": ""
... |
rust_dataset_chunk_508135 | rust_dataset.txt | 508,135 | 512 | path!("/root"),
json!({
".git": {},
"sub": {
"a": {
"b": {
"c": {
"deep.txt": ""
}
}
}
}
}),
)
.await;
... |
rust_dataset_chunk_508136 | rust_dataset.txt | 508,136 | 512 | .clone());
fs.insert_tree(
path!("/root"),
json!({
"junk": {
"a": {
"file.txt": "",
"b": {
"c.txt": ""
}
}
}
}),
)
.await;
let tree = build... |
rust_dataset_chunk_508137 | rust_dataset.txt | 508,137 | 512 | entry.path.as_ref(), entry.kind))
.collect::<Vec<_>>(),
vec![
(rel_path(""), EntryKind::Dir),
(rel_path("junk"), EntryKind::UnloadedDir),
(rel_path("top.txt"), EntryKind::File),
]
);
});
}
#[gpui::test]
async fn test_fi... |
rust_dataset_chunk_508138 | rust_dataset.txt | 508,138 | 512 | 1 }"#),
cx,
)
.unwrap();
});
});
let fs = FakeFs::new(cx.background_executor.clone());
fs.insert_tree(
path!("/root"),
json!({
"junk": {
"a": {
"b": {
"deep.t... |
rust_dataset_chunk_508139 | rust_dataset.txt | 508,139 | 512 | Path::new(root),
true,
fs,
Arc::default(),
true,
WorktreeId::from_proto(0),
&mut cx.to_async(),
)
.await
.unwrap();
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;
tree
}
fn set_file_scan_depth(cx: &mut TestAppContext,... |
rust_dataset_chunk_508140 | rust_dataset.txt | 508,140 | 512 | _fast() -> Self {
Self::Grok43
}
pub fn from_id(id: &str) -> Result<Self> {
match id {
"grok-4.3" => Ok(Self::Grok43),
"grok-4.5" => Ok(Self::Grok45),
"grok-4.6" => Ok(Self::Grok46),
"grok-4.7" => Ok(Self::Grok47),
"grok-4.20-0309-reas... |
rust_dataset_chunk_508141 | rust_dataset.txt | 508,141 | 512 | Self::Grok420Reasoning | Self::Grok420NonReasoning => 2_000_000,
Self::Custom { max_tokens, .. } => *max_tokens,
}
}
pub fn max_output_tokens(&self) -> Option<u64> {
match self {
Self::Grok43 | Self::Grok420Reasoning | Self::Grok420NonReasoning => Some(64_000... |
rust_dataset_chunk_508142 | rust_dataset.txt | 508,142 | 512 | => true,
Self::Grok420Reasoning | Self::Grok420NonReasoning | Self::Custom { .. } => false,
}
}
}
--- FILE: zed/crates/x_ai_subscribed/src/x_ai_subscribed.rs ---
use anyhow::{Context as _, Result, anyhow};
use base64::Engine as _;
use base64::engine::general_purpose::URL_SAFE_NO_PAD;
use cred... |
rust_dataset_chunk_508143 | rust_dataset.txt | 508,143 | 512 | illis() as u64;
const CALLBACK_HOST: &str = "127.0.0.1";
const CALLBACK_PORT: u16 = 56121;
const CALLBACK_PATH: &str = "/callback";
const INFERENCE_FORBIDDEN_MESSAGE: &str = "Login succeeded, but this Grok account cannot use the API \
(HTTP 403). Some plans do not include this access. You can also use the separat... |
rust_dataset_chunk_508144 | rust_dataset.txt | 508,144 | 512 | }
match result {
Ok(Some((_, bytes))) => {
match serde_json::from_slice::<SuperGrokCredentials>(&bytes) {
Ok(credentials) => {
state.aut... |
rust_dataset_chunk_508145 | rust_dataset.txt | 508,145 | 512 | (()) => {
this.update(cx, |state, cx| {
state.auth_generation = state.auth_generation.wrapping_add(1);
state.credentials = Some(creds);
state.last_auth_error = None;
... |
rust_dataset_chunk_508146 | rust_dataset.txt | 508,146 | 512 | Grok46),
Self::Grok45 => Some(x_ai::Model::Grok45),
// grok-build-0.1 is SuperGrok-only; it is not in the BYOK catalog.
Self::GrokBuild01 => None,
}
}
pub fn id(&self) -> &str {
match self {
Self::Grok47 => "grok-4.7",
Self::Grok46 => ... |
rust_dataset_chunk_508147 | rust_dataset.txt | 508,147 | 512 |
// title requests disable thinking, so we omit the field instead of sending none.
match model.x_ai_model() {
Some(x_ai::Model::Grok45) => &[
ReasoningEffort::Low,
ReasoningEffort::Medium,
ReasoningEffort::High,
],
Some(x_ai::Model::Grok46 | x_ai::Mode... |
rust_dataset_chunk_508148 | rust_dataset.txt | 508,148 | 512 | => ("High", "high"),
ReasoningEffort::XHigh => ("Extra High", "xhigh"),
ReasoningEffort::Max => return None,
};
Some(LanguageModelEffortLevel {
name: name.into(),
value: value.into(),
is_default: Some(effort) == de... |
rust_dataset_chunk_508149 | rust_dataset.txt | 508,149 | 512 | LanguageModel {
supports_tools: model.supports_tools(),
supports_images: model.supports_images(),
supports_streaming_tools: true,
tool_choice_support: LanguageModelToolChoiceSupport::ALL,
supports_thinking: model.supports_reasoning_effort(),
supported_effort_levels: supp... |
rust_dataset_chunk_508150 | rust_dataset.txt | 508,150 | 512 | .clone()))
.map_err(LanguageModelCompletionError::Other)?;
let creds = creds.ok_or(LanguageModelCompletionError::NoApiKey {
provider: PROVIDER_NAME,
})?;
if !creds.is_expired() {
return Ok(creds);
}
if let Some(shared_task) = existing_task {
return shared_task
... |
rust_dataset_chunk_508151 | rust_dataset.txt | 508,151 | 512 | |s, _| {
s.credentials = Some(refreshed.clone());
s.refresh_task = None;
})
.map_err(|e| Arc::new(e))?;
Ok(refreshed)
}
.await;
... |
rust_dataset_chunk_508152 | rust_dataset.txt | 508,152 | 512 | email: Option<String>,
}
struct PkceAuthorizeRequest {
authorize_url: String,
verifier: String,
state: String,
redirect_uri: String,
}
fn pkce_challenge(verifier: &str) -> String {
let mut hasher = Sha256::new();
hasher.update(verifier.as_bytes());
URL_SAFE_NO_PAD.encode(hasher.finalize()... |
rust_dataset_chunk_508153 | rust_dataset.txt | 508,153 | 512 | to start OAuth callback server")?;
let pkce = new_pkce_authorize_request(redirect_uri)?;
cx.update(|cx| cx.open_url(&pkce.authorize_url));
let callback = callback_rx
.await
.map_err(|_| anyhow!("OAuth callback was cancelled"))?
.context("OAuth callback failed")?;
if callback.... |
rust_dataset_chunk_508154 | rust_dataset.txt | 508,154 | 512 | to parse token response")
}
async fn refresh_token(
client: &Arc<dyn HttpClient>,
refresh_token: &str,
) -> Result<TokenResponse, RefreshError> {
let body = form_urlencoded::Serializer::new(String::new())
.append_pair("grant_type", "refresh_token")
.append_pair("client_id", CLIENT_ID)
... |
rust_dataset_chunk_508155 | rust_dataset.txt | 508,155 | 512 | SystemTime::now()
.duration_since(UNIX_EPOCH)
.map(|d| d.as_millis() as u64)
.unwrap_or_else(|err| {
log::error!("System clock is before UNIX epoch: {err}");
0
})
}
#[cfg(test)]
mod tests {
use super::*;
use gpui::{AppContext as _, TestAppContext};
... |
rust_dataset_chunk_508156 | rust_dataset.txt | 508,156 | 512 | k_build_omits_reasoning_effort() {
let request = LanguageModelRequest {
thinking_allowed: true,
thinking_effort: Some("medium".to_string()),
..Default::default()
};
assert_eq!(
reasoning_effort_for_request(&request, &SuperGrokModel::GrokBuild01),
... |
rust_dataset_chunk_508157 | rust_dataset.txt | 508,157 | 512 | assert!(pairs.contains(&("response_type".into(), "code".into())));
assert!(pairs.contains(&("code_challenge_method".into(), "S256".into())));
assert!(pairs.contains(&("code_challenge".into(), pkce_challenge(verifier))));
assert!(pairs.contains(&("state".into(), "abc123".into())));
asser... |
rust_dataset_chunk_508158 | rust_dataset.txt | 508,158 | 512 | let refresh_count = Arc::new(AtomicUsize::new(0));
let refresh_count_clone = refresh_count.clone();
let http_client = FakeHttpClient::create(move |_request| {
let refresh_count = refresh_count_clone.clone();
async move {
refresh_count.fetch_add(1, Ordering::SeqC... |
rust_dataset_chunk_508159 | rust_dataset.txt | 508,159 | 512 | cx| state.downgrade());
let result = cx
.spawn(async move |mut cx| get_fresh_credentials(&weak_state, &http, &mut cx).await)
.await;
cx.run_until_parked();
assert!(result.is_err());
cx.read(|cx| {
let state = state.read(cx);
assert!(state.... |
rust_dataset_chunk_508160 | rust_dataset.txt | 508,160 | 512 | , gate_rx) = futures::channel::oneshot::channel::<()>();
let gate_rx = Arc::new(Mutex::new(Some(gate_rx)));
let gate_rx_clone = gate_rx.clone();
let http_client = FakeHttpClient::create(move |_request| {
let gate_rx = gate_rx_clone.clone();
async move {
l... |
rust_dataset_chunk_508161 | rust_dataset.txt | 508,161 | 512 | Some(make_expired_credentials()),
creds_provider.clone(),
cx,
);
let weak_state = cx.read(|_cx| state.downgrade());
let refresh_task =
cx.spawn(async move |mut cx| get_fresh_credentials(&weak_state, &http, &mut cx).await);
cx.run_until_parked();
... |
rust_dataset_chunk_508162 | rust_dataset.txt | 508,162 | 512 | ]
async fn test_initial_load_restores_persisted_credentials(cx: &mut TestAppContext) {
let creds = make_fresh_credentials();
let creds_json = serde_json::to_vec(&creds).unwrap();
let creds_provider = Arc::new(FakeCredentialsProvider::new());
creds_provider
.storage
... |
rust_dataset_chunk_508163 | rust_dataset.txt | 508,163 | 512 | fn write_credentials<'a>(
&'a self,
_url: &'a str,
username: &'a str,
password: &'a [u8],
_cx: &'a AsyncApp,
) -> Pin<Box<dyn Future<Output = Result<()>> + 'a>> {
self.storage
.lock()
.replace((username.to_s... |
rust_dataset_chunk_508164 | rust_dataset.txt | 508,164 | 512 | });
if include_refresh_token {
value["refresh_token"] = serde_json::json!("fresh_refresh");
}
value.to_string()
}
}
--- FILE: zed/crates/zed_actions/src/lib.rs ---
use gpui::{Action, actions};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use std::{path::PathB... |
rust_dataset_chunk_508165 | rust_dataset.txt | 508,165 | 512 | keymap editor.
#[action(deprecated_aliases = ["zed_actions::OpenKeymapEditor"])]
OpenKeymap,
/// Opens account settings.
OpenAccountSettings,
/// Opens server settings.
OpenServerSettings,
/// Quits the application.
Quit,
/// Shows information abo... |
rust_dataset_chunk_508166 | rust_dataset.txt | 508,166 | 512 | Eq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct IncreaseBufferFontSize {
#[serde(default)]
pub persist: bool,
}
/// Opens the settings editor at a specific path.
#[derive(PartialEq, Clone, Debug, Deserialize, JsonSchema, Action)]
... |
rust_dataset_chunk_508167 | rust_dataset.txt | 508,167 | 512 | (PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = zed)]
#[serde(deny_unknown_fields)]
pub struct IncreaseUiFontSize {
#[serde(default)]
pub persist: bool,
}
/// Resets the UI font size to the default value.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSche... |
rust_dataset_chunk_508168 | rust_dataset.txt | 508,168 | 512 | workspace,
[
#[action(deprecated_aliases = ["editor::CopyPath", "outline_panel::CopyPath", "project_panel::CopyPath"])]
CopyPath,
#[action(deprecated_aliases = ["editor::CopyRelativePath", "outline_panel::CopyRelativePath", "project_panel::CopyRelativePath"])]
Co... |
rust_dataset_chunk_508169 | rust_dataset.txt | 508,169 | 512 | Schema, Action)]
#[action(namespace = git)]
#[serde(deny_unknown_fields)]
pub struct OpenWorktreeInNewWindow {
pub path: PathBuf,
}
pub mod git {
use gpui::actions;
actions!(
git,
[
/// Checks out a different git branch.
CheckoutBranch,
/// Switches to a... |
rust_dataset_chunk_508170 | rust_dataset.txt | 508,170 | 512 | /// Toggles the theme selector interface.
#[derive(PartialEq, Clone, Default, Debug, Deserialize, JsonSchema, Action)]
#[action(namespace = theme_selector)]
#[serde(deny_unknown_fields)]
pub struct Toggle {
/// A list of theme names to filter the theme selector down to.
pub themes_filte... |
rust_dataset_chunk_508171 | rust_dataset.txt | 508,171 | 512 | find() -> Self {
Self {
focus: true,
replace_enabled: false,
selection_search_enabled: false,
}
}
pub fn replace() -> Self {
Self {
focus: true,
replace_enabled: true,
se... |
rust_dataset_chunk_508172 | rust_dataset.txt | 508,172 | 512 | .
#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = agent)]
#[serde(deny_unknown_fields)]
pub struct SelectAgent {
/// The id of the agent to select.
pub agent: String,
}
/// Opens a new agent thread with the provided branch diff for review.
#... |
rust_dataset_chunk_508173 | rust_dataset.txt | 508,173 | 512 | the project AGENTS.md rules file.
#[action(name = "OpenProjectAGENTS.mdRules")]
OpenProjectAgentsMdRules,
/// Opens the skills manager in the settings window.
#[action(deprecated_aliases = ["agent::OpenRulesLibrary", "assistant::OpenRulesLibrary", "assistant::DeployPromp... |
rust_dataset_chunk_508174 | rust_dataset.txt | 508,174 | 512 | },
/// Spawns a task via modal's selection.
ViaModal {
/// Selected task's `reveal_target` property override.
#[serde(default)]
reveal_target: Option<RevealTarget>,
},
}
impl Spawn {
pub fn modal() -> Self {
Self::ViaModal {
reveal_target: None,
}... |
rust_dataset_chunk_508175 | rust_dataset.txt | 508,175 | 512 | debug_panel {
use gpui::actions;
actions!(
debug_panel,
[
/// Toggles the debug panel.
Toggle,
/// Toggles focus on the debug panel.
ToggleFocus
]
);
}
actions!(
debugger,
[
/// Toggles the enabled state of a breakpoin... |
rust_dataset_chunk_508176 | rust_dataset.txt | 508,176 | 512 | use serde::Deserialize;
/// Toggles the thread switcher popup when the sidebar is focused.
#[derive(PartialEq, Clone, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = agents_sidebar)]
#[serde(deny_unknown_fields)]
pub struct ToggleThreadSwitcher {
#[serde(default)]
... |
rust_dataset_chunk_508177 | rust_dataset.txt | 508,177 | 512 | BTreeSet::new();
for lib in &dlopened_libs {
if let Some(libdir) = pkg_config::get_variable(lib, "libdir").ok() {
rpath_dirs.insert(libdir);
} else {
eprintln!("zed build.rs: {lib} not found in pkg-config's path");
}
}
for dir ... |
rust_dataset_chunk_508178 | rust_dataset.txt | 508,178 | 512 | ) = std::env::var("PROFILE")
&& build_profile == "release"
{
// This is currently the best way to make `cargo build ...`'s build script
// to print something to stdout without extra verbosity.
println!("cargo::warning=Info: using '{git_sha}' hash for ZED_COMMIT_SH... |
rust_dataset_chunk_508179 | rust_dataset.txt | 508,179 | 512 | output();
match download_result {
Ok(output) if output.status.success() => {
println!("Downloaded conpty nupkg successfully");
let extract_script = format!(
"$ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '{}' ... |
rust_dataset_chunk_508180 | rust_dataset.txt | 508,180 | 512 | );
}
Err(e) => {
println!(
"cargo::warning=Failed to run PowerShell for download: {}",
e
);
}
}
}
println!("cargo:rerun-if-env-changed=RELEASE_CHANNEL");
... |
rust_dataset_chunk_508181 | rust_dataset.txt | 508,181 | 512 | Buf;
use std::pin::Pin;
use std::sync::{Arc, LazyLock};
use anyhow::Result;
use credentials_provider::CredentialsProvider;
use futures::FutureExt as _;
use gpui::{App, AsyncApp, Global};
use release_channel::ReleaseChannel;
/// An environment variable whose presence indicates that the system keychain
/// should be us... |
rust_dataset_chunk_508182 | rust_dataset.txt | 508,182 | 512 | <'a>(
&'a self,
url: &'a str,
cx: &'a AsyncApp,
) -> Pin<Box<dyn Future<Output = Result<Option<(String, Vec<u8>)>>> + 'a>> {
async move { cx.update(|cx| cx.read_credentials(url)).await }.boxed_local()
}
fn write_credentials<'a>(
&'a self,
url: &'a str,
... |
rust_dataset_chunk_508183 | rust_dataset.txt | 508,183 | 512 | (&json)?;
Ok(credentials)
}
fn save_credentials(&self, credentials: &HashMap<String, (String, Vec<u8>)>) -> Result<()> {
let json = serde_json::to_string(credentials)?;
std::fs::write(&self.path, json)?;
Ok(())
}
}
impl CredentialsProvider for DevelopmentCredentialsProvid... |
rust_dataset_chunk_508184 | rust_dataset.txt | 508,184 | 512 | at runtime (data dir, config dir, etc.) match what the binary is called.
const _: () = assert!(
paths::APP_NAME_LOWERCASE
.as_bytes()
.eq_ignore_ascii_case(env!("CARGO_BIN_NAME").as_bytes()),
"paths::APP_NAME_LOWERCASE must match the binary name. \
Forks: update APP_NAME in crates/paths/sr... |
rust_dataset_chunk_508185 | rust_dataset.txt | 508,185 | 512 | Registry};
use theme_settings::load_user_theme;
use util::{
ResultExt, maybe,
paths::{PathStyle, SanitizedPath},
};
use uuid::Uuid;
use workspace::{
AppState, MultiWorkspace, PathList, SerializedWorkspaceLocation, SessionWorkspace, Toast,
WorkspaceSettings, WorkspaceStore,
notifications::{Notificati... |
rust_dataset_chunk_508186 | rust_dataset.txt | 508,186 | 512 | _quit_mode(QuitMode::Explicit)
.run(move |cx| {
if let Ok(window) = cx.open_window(gpui::WindowOptions::default(), |_, cx| {
cx.new(|_| gpui::Empty)
}) {
window
.update(cx, |_, window, cx| {
let response = window... |
rust_dataset_chunk_508187 | rust_dataset.txt | 508,187 | 512 | : OnceLock<Instant> = OnceLock::new();
fn main() {
STARTUP_TIME.get_or_init(|| Instant::now());
// If this process was re-executed as a Linux sandbox helper, run that mode
// without returning. Must run before argument parsing: the wrapped command's
// args are appended verbatim and would otherwise be... |
rust_dataset_chunk_508188 | rust_dataset.txt | 508,188 | 512 | _data_dir(directory);
vec![
std::ffi::OsString::from("--user-data-dir"),
directory.as_os_str().to_owned(),
]
} else {
Vec::new()
};
#[cfg(target_os = "windows")]
match util::get_zed_cli_path() {
Ok(path) => askpass::set_askpass_program(path),
... |
rust_dataset_chunk_508189 | rust_dataset.txt | 508,189 | 512 | ,
app_commit_sha
.as_ref()
.map(|sha| sha.short())
.as_deref()
.unwrap_or("unknown"),
);
#[cfg(windows)]
check_for_conpty_dll();
let app = build_application()
.with_assets(Assets)
.with_restart_arguments(restart_arguments);
l... |
rust_dataset_chunk_508190 | rust_dataset.txt | 508,190 | 512 | as_ref()
.map(|sha| sha.full())
.unwrap_or_else(|| "no sha".to_owned()),
},
{
let background_executor1 = app.background_executor();
move |task| {
background_executor1.spawn(tas... |
rust_dataset_chunk_508191 | rust_dataset.txt | 508,191 | 512 | cx| {
cx.set_global(app_db);
let db_trusted_paths = match workspace::WorkspaceDb::global(cx).fetch_trusted_worktrees() {
Ok(trusted_paths) => trusted_paths,
Err(e) => {
log::error!("Failed to do initial trusted worktrees fetch: {e:#}");
HashMap::de... |
rust_dataset_chunk_508192 | rust_dataset.txt | 508,192 | 512 | true,
use_paths: settings.path.as_ref().map(|node_path| {
let node_path = PathBuf::from(shellexpand::tilde(node_path).as_ref());
let npm_path = settings
.npm_path
.as_ref()
.map(|path| PathBu... |
rust_dataset_chunk_508193 | rust_dataset.txt | 508,193 | 512 | .telemetry();
telemetry.start(
system_id.as_ref().map(|id| id.to_string()),
installation_id.as_ref().map(|id| id.to_string()),
session.id().to_owned(),
cx,
);
cx.subscribe(&user_store, {
let telemetry = telemetry.clone();
mo... |
rust_dataset_chunk_508194 | rust_dataset.txt | 508,194 | 512 | .node_runtime.clone(),
cx,
);
theme_settings::init(theme::LoadThemes::All(Box::new(Assets)), cx);
eager_load_active_theme_and_icon_theme(fs.clone(), cx);
theme_extension::init(
extension_host_proxy,
ThemeRegistry::global(cx),
cx.background... |
rust_dataset_chunk_508195 | rust_dataset.txt | 508,195 | 512 | _to_line::init(cx);
file_finder::init(cx);
tab_switcher::init(cx);
outline::init(cx);
call_hierarchy::init(cx);
project_bookmarks::init(cx);
project_symbols::init(cx);
project_panel::init(cx);
outline_panel::init(cx);
tasks_ui::init(cx);
sn... |
rust_dataset_chunk_508196 | rust_dataset.txt | 508,196 | 512 | let background_appearance = cx.theme().window_background_appearance();
window
.update(cx, |_, window, _| {
window.set_background_appearance(background_appearance)
})
.ok();
... |
rust_dataset_chunk_508197 | rust_dataset.txt | 508,197 | 512 | cx.activate(true);
cx.spawn({
let client = app_state.client.clone();
async move |cx| authenticate(client, cx).await
})
.detach_and_log_err(cx);
let urls: Vec<_> = args
.paths_or_urls
.iter()
.map(|arg| parse_url_arg(ar... |
rust_dataset_chunk_508198 | rust_dataset.txt | 508,198 | 512 | None => cx.spawn({
let app_state = app_state.clone();
async move |cx| {
if let Err(e) = restore_or_create_workspace(app_state, cx).await {
fail_to_open_window_async(e, cx)
}
}
}),
... |
rust_dataset_chunk_508199 | rust_dataset.txt | 508,199 | 512 | cx: &mut App,
) -> Task<()> {
let is_cli_connection = matches!(request.kind, Some(OpenRequestKind::CliConnection(_)));
if !is_cli_connection && RequestedPaths::of_request(&request).is_none() {
handle_open_request(request, app_state, cx);
return Task::ready(());
}
cx.spawn(async move |c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.