chore: Bump Rust edition to 2024 (#27800)

Follow-up to https://github.com/zed-industries/zed/pull/27791

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 20:55:27 +02:00 committed by GitHub
parent d50905e000
commit dc64ec9cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
802 changed files with 3775 additions and 3662 deletions

View file

@ -1,32 +1,32 @@
use crate::{
ProjectItem as _, ProjectPath,
lsp_store::OpenLspBufferHandle,
search::SearchQuery,
worktree_store::{WorktreeStore, WorktreeStoreEvent},
ProjectItem as _, ProjectPath,
};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use client::Client;
use collections::{hash_map, HashMap, HashSet};
use collections::{HashMap, HashSet, hash_map};
use fs::Fs;
use futures::{channel::oneshot, future::Shared, Future, FutureExt as _, StreamExt};
use futures::{Future, FutureExt as _, StreamExt, channel::oneshot, future::Shared};
use gpui::{
App, AppContext as _, AsyncApp, Context, Entity, EventEmitter, Subscription, Task, WeakEntity,
};
use language::{
Buffer, BufferEvent, Capability, DiskState, File as _, Language, Operation,
proto::{
deserialize_line_ending, deserialize_version, serialize_line_ending, serialize_version,
split_operations,
},
Buffer, BufferEvent, Capability, DiskState, File as _, Language, Operation,
};
use rpc::{
proto::{self, ToProto},
AnyProtoClient, ErrorExt as _, TypedEnvelope,
proto::{self, ToProto},
};
use smol::channel::Receiver;
use std::{io, path::Path, pin::pin, sync::Arc, time::Instant};
use text::BufferId;
use util::{debug_panic, maybe, ResultExt as _, TryFutureExt};
use util::{ResultExt as _, TryFutureExt, debug_panic, maybe};
use worktree::{File, PathChange, ProjectEntryId, Worktree, WorktreeId};
/// A set of open buffers.

View file

@ -1,4 +1,4 @@
use futures::{channel::oneshot, FutureExt};
use futures::{FutureExt, channel::oneshot};
use gpui::{Context, Task};
use std::{marker::PhantomData, time::Duration};

View file

@ -1,20 +1,20 @@
//! Module for managing breakpoints in a project.
//!
//! Breakpoints are separate from a session because they're not associated with any particular debug session. They can also be set up without a session running.
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use breakpoints_in_file::BreakpointsInFile;
use collections::BTreeMap;
use dap::client::SessionId;
use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, Subscription, Task};
use language::{proto::serialize_anchor as serialize_text_anchor, Buffer, BufferSnapshot};
use language::{Buffer, BufferSnapshot, proto::serialize_anchor as serialize_text_anchor};
use rpc::{
proto::{self},
AnyProtoClient, TypedEnvelope,
proto::{self},
};
use std::{hash::Hash, ops::Range, path::Path, sync::Arc};
use text::PointUtf16;
use crate::{buffer_store::BufferStore, worktree_store::WorktreeStore, Project, ProjectPath};
use crate::{Project, ProjectPath, buffer_store::BufferStore, worktree_store::WorktreeStore};
mod breakpoints_in_file {
use language::BufferEvent;

View file

@ -1,14 +1,14 @@
use std::sync::Arc;
use anyhow::{anyhow, Ok, Result};
use anyhow::{Ok, Result, anyhow};
use dap::{
client::SessionId,
proto_conversions::ProtoConversion,
requests::{Continue, Next},
Capabilities, ContinueArguments, InitializeRequestArguments,
InitializeRequestArgumentsPathFormat, NextArguments, SetVariableResponse, SourceBreakpoint,
StepInArguments, StepOutArguments, SteppingGranularity, ValueFormat, Variable,
VariablesArgumentsFilter,
client::SessionId,
proto_conversions::ProtoConversion,
requests::{Continue, Next},
};
use rpc::proto;
use serde_json::Value;

View file

@ -3,23 +3,23 @@ use super::{
locator_store::LocatorStore,
session::{self, Session},
};
use crate::{debugger, worktree_store::WorktreeStore, ProjectEnvironment};
use anyhow::{anyhow, Result};
use crate::{ProjectEnvironment, debugger, worktree_store::WorktreeStore};
use anyhow::{Result, anyhow};
use async_trait::async_trait;
use collections::HashMap;
use dap::{
Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse,
EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments,
Source, StartDebuggingRequestArguments,
adapters::{DapStatus, DebugAdapterName},
client::SessionId,
messages::Message,
requests::{Completions, Evaluate, Request as _, RunInTerminal, StartDebugging},
Capabilities, CompletionItem, CompletionsArguments, DapRegistry, ErrorResponse,
EvaluateArguments, EvaluateArgumentsContext, EvaluateResponse, RunInTerminalRequestArguments,
Source, StartDebuggingRequestArguments,
};
use fs::Fs;
use futures::{
channel::{mpsc, oneshot},
future::{join_all, Shared},
future::{Shared, join_all},
};
use gpui::{App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Task};
use http_client::HttpClient;
@ -28,8 +28,8 @@ use lsp::LanguageServerName;
use node_runtime::NodeRuntime;
use rpc::{
proto::{self},
AnyProtoClient, TypedEnvelope,
proto::{self},
};
use serde_json::Value;
use settings::WorktreeId;
@ -39,7 +39,7 @@ use std::{
collections::{BTreeMap, HashSet},
ffi::OsStr,
path::PathBuf,
sync::{atomic::Ordering::SeqCst, Arc},
sync::{Arc, atomic::Ordering::SeqCst},
};
use std::{collections::VecDeque, sync::atomic::AtomicU32};
use task::{DebugAdapterConfig, DebugRequestDisposition};

View file

@ -1,4 +1,4 @@
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use cargo::CargoLocator;
use collections::HashMap;
use dap::DebugAdapterConfig;

View file

@ -1,5 +1,5 @@
use super::DapLocator;
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use async_trait::async_trait;
use dap::DebugAdapterConfig;
use serde_json::Value;

View file

@ -10,25 +10,25 @@ use super::dap_command::{
VariablesCommand,
};
use super::dap_store::DapAdapterDelegate;
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use collections::{HashMap, HashSet, IndexMap, IndexSet};
use dap::adapters::{DebugAdapter, DebugAdapterBinary};
use dap::messages::Response;
use dap::{
Capabilities, ContinueArguments, EvaluateArgumentsContext, Module, Source, StackFrameId,
SteppingGranularity, StoppedEvent, VariableReference,
adapters::{DapDelegate, DapStatus},
client::{DebugAdapterClient, SessionId},
messages::{Events, Message},
Capabilities, ContinueArguments, EvaluateArgumentsContext, Module, Source, StackFrameId,
SteppingGranularity, StoppedEvent, VariableReference,
};
use dap::{DapRegistry, DebugRequestType, OutputEventCategory};
use futures::channel::oneshot;
use futures::{future::Shared, FutureExt};
use futures::{FutureExt, future::Shared};
use gpui::{
App, AppContext, AsyncApp, BackgroundExecutor, Context, Entity, EventEmitter, Task, WeakEntity,
};
use rpc::AnyProtoClient;
use serde_json::{json, Value};
use serde_json::{Value, json};
use settings::Settings;
use smol::stream::StreamExt;
use std::any::TypeId;
@ -43,7 +43,7 @@ use std::{
};
use task::{DebugAdapterConfig, DebugTaskDefinition};
use text::{PointUtf16, ToPointUtf16};
use util::{merge_json_value_into, ResultExt};
use util::{ResultExt, merge_json_value_into};
#[derive(Debug, Copy, Clone, Hash, PartialEq, PartialOrd, Ord, Eq)]
#[repr(transparent)]
@ -1194,8 +1194,12 @@ impl Session {
fn fetch<T: DapCommand + PartialEq + Eq + Hash>(
&mut self,
request: T,
process_result: impl FnOnce(&mut Self, Result<T::Response>, &mut Context<Self>) -> Option<T::Response>
+ 'static,
process_result: impl FnOnce(
&mut Self,
Result<T::Response>,
&mut Context<Self>,
) -> Option<T::Response>
+ 'static,
cx: &mut Context<Self>,
) {
const {
@ -1246,8 +1250,12 @@ impl Session {
session_id: SessionId,
mode: &Mode,
request: T,
process_result: impl FnOnce(&mut Self, Result<T::Response>, &mut Context<Self>) -> Option<T::Response>
+ 'static,
process_result: impl FnOnce(
&mut Self,
Result<T::Response>,
&mut Context<Self>,
) -> Option<T::Response>
+ 'static,
cx: &mut Context<Self>,
) -> Task<Option<T::Response>> {
if !T::is_supported(&capabilities) {
@ -1277,8 +1285,12 @@ impl Session {
fn request<T: DapCommand + PartialEq + Eq + Hash>(
&self,
request: T,
process_result: impl FnOnce(&mut Self, Result<T::Response>, &mut Context<Self>) -> Option<T::Response>
+ 'static,
process_result: impl FnOnce(
&mut Self,
Result<T::Response>,
&mut Context<Self>,
) -> Option<T::Response>
+ 'static,
cx: &mut Context<Self>,
) -> Task<Option<T::Response>> {
Self::request_inner(

View file

@ -1,4 +1,4 @@
use futures::{future::Shared, FutureExt};
use futures::{FutureExt, future::Shared};
use std::{path::Path, sync::Arc};
use util::ResultExt;
@ -280,7 +280,7 @@ async fn load_shell_environment(
Option<HashMap<String, String>>,
Option<EnvironmentErrorMessage>,
) {
use crate::direnv::{load_direnv_environment, DirenvError};
use crate::direnv::{DirenvError, load_direnv_environment};
use std::path::PathBuf;
use util::parse_env_output;

View file

@ -1,22 +1,23 @@
pub mod git_traversal;
use crate::{
ProjectEnvironment, ProjectItem, ProjectPath,
buffer_store::{BufferStore, BufferStoreEvent},
worktree_store::{WorktreeStore, WorktreeStoreEvent},
ProjectEnvironment, ProjectItem, ProjectPath,
};
use anyhow::{anyhow, bail, Context as _, Result};
use anyhow::{Context as _, Result, anyhow, bail};
use askpass::AskPassDelegate;
use buffer_diff::{BufferDiff, BufferDiffEvent};
use client::ProjectId;
use collections::HashMap;
use fs::Fs;
use futures::{
FutureExt as _, StreamExt as _,
channel::{mpsc, oneshot},
future::{self, OptionFuture, Shared},
FutureExt as _, StreamExt as _,
};
use git::{
BuildPermalinkParams, GitHostingProviderRegistry,
blame::Blame,
parse_git_remote_url,
repository::{
@ -24,25 +25,24 @@ use git::{
Remote, RemoteCommandOutput, RepoPath, ResetMode,
},
status::FileStatus,
BuildPermalinkParams, GitHostingProviderRegistry,
};
use gpui::{
App, AppContext, AsyncApp, Context, Entity, EventEmitter, SharedString, Subscription, Task,
WeakEntity,
};
use language::{
proto::{deserialize_version, serialize_version},
Buffer, BufferEvent, Language, LanguageRegistry,
proto::{deserialize_version, serialize_version},
};
use parking_lot::Mutex;
use rpc::{
proto::{self, git_reset, FromProto, ToProto, SSH_PROJECT_ID},
AnyProtoClient, TypedEnvelope,
proto::{self, FromProto, SSH_PROJECT_ID, ToProto, git_reset},
};
use serde::Deserialize;
use settings::WorktreeId;
use std::{
collections::{hash_map, VecDeque},
collections::{VecDeque, hash_map},
future::Future,
ops::Range,
path::{Path, PathBuf},
@ -50,10 +50,10 @@ use std::{
};
use sum_tree::TreeSet;
use text::BufferId;
use util::{debug_panic, maybe, ResultExt};
use util::{ResultExt, debug_panic, maybe};
use worktree::{
proto_to_branch, File, PathKey, ProjectEntryId, RepositoryEntry, StatusEntry,
UpdatedGitRepositoriesSet, Worktree,
File, PathKey, ProjectEntryId, RepositoryEntry, StatusEntry, UpdatedGitRepositoriesSet,
Worktree, proto_to_branch,
};
pub struct GitStore {

View file

@ -1,13 +1,13 @@
use crate::{
worktree_store::{WorktreeStore, WorktreeStoreEvent},
Project, ProjectEntryId, ProjectItem, ProjectPath,
worktree_store::{WorktreeStore, WorktreeStoreEvent},
};
use anyhow::{anyhow, Context as _, Result};
use collections::{hash_map, HashMap, HashSet};
use futures::{channel::oneshot, StreamExt};
use anyhow::{Context as _, Result, anyhow};
use collections::{HashMap, HashSet, hash_map};
use futures::{StreamExt, channel::oneshot};
use gpui::{
hash, prelude::*, App, AsyncApp, Context, Entity, EventEmitter, Img, Subscription, Task,
WeakEntity,
App, AsyncApp, Context, Entity, EventEmitter, Img, Subscription, Task, WeakEntity, hash,
prelude::*,
};
pub use image::ImageFormat;
use image::{ExtendedColorType, GenericImageView, ImageReader};

View file

@ -1,13 +1,13 @@
mod signature_help;
use crate::{
lsp_store::{LocalLspStore, LspStore},
CodeAction, CompletionSource, CoreCompletion, DocumentHighlight, DocumentSymbol, Hover,
HoverBlock, HoverBlockKind, InlayHint, InlayHintLabel, InlayHintLabelPart,
InlayHintLabelPartTooltip, InlayHintTooltip, Location, LocationLink, LspAction, MarkupContent,
PrepareRenameResponse, ProjectTransaction, ResolveState,
lsp_store::{LocalLspStore, LspStore},
};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use async_trait::async_trait;
use client::proto::{self, PeerId};
use clock::Global;
@ -15,11 +15,12 @@ use collections::HashSet;
use futures::future;
use gpui::{App, AsyncApp, Entity};
use language::{
language_settings::{language_settings, InlayHintKind, LanguageSettings},
Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind, OffsetRangeExt, PointUtf16,
ToOffset, ToPointUtf16, Transaction, Unclipped,
language_settings::{InlayHintKind, LanguageSettings, language_settings},
point_from_lsp, point_to_lsp,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
range_from_lsp, range_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, CachedLspAdapter, CharKind,
OffsetRangeExt, PointUtf16, ToOffset, ToPointUtf16, Transaction, Unclipped,
range_from_lsp, range_to_lsp,
};
use lsp::{
AdapterServerCapabilities, CodeActionKind, CodeActionOptions, CompletionContext,

View file

@ -3,6 +3,8 @@ pub mod lsp_ext_command;
pub mod rust_analyzer_ext;
use crate::{
CodeAction, Completion, CompletionSource, CoreCompletion, Hover, InlayHint, LspAction,
ProjectItem, ProjectPath, ProjectTransaction, ResolveState, Symbol, ToolchainStore,
buffer_store::{BufferStore, BufferStoreEvent},
environment::ProjectEnvironment,
lsp_command::{self, *},
@ -13,18 +15,16 @@ use crate::{
toolchain_store::{EmptyToolchainStore, ToolchainStoreEvent},
worktree_store::{WorktreeStore, WorktreeStoreEvent},
yarn::YarnPathStore,
CodeAction, Completion, CompletionSource, CoreCompletion, Hover, InlayHint, LspAction,
ProjectItem, ProjectPath, ProjectTransaction, ResolveState, Symbol, ToolchainStore,
};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use async_trait::async_trait;
use client::{proto, TypedEnvelope};
use collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet};
use client::{TypedEnvelope, proto};
use collections::{BTreeMap, BTreeSet, HashMap, HashSet, btree_map};
use futures::{
future::{join_all, Shared},
AsyncWriteExt, Future, FutureExt, StreamExt,
future::{Shared, join_all},
select, select_biased,
stream::FuturesUnordered,
AsyncWriteExt, Future, FutureExt, StreamExt,
};
use globset::{Glob, GlobBuilder, GlobMatcher, GlobSet, GlobSetBuilder};
use gpui::{
@ -34,23 +34,25 @@ use gpui::{
use http_client::HttpClient;
use itertools::Itertools as _;
use language::{
Bias, BinaryStatus, Buffer, BufferSnapshot, CachedLspAdapter, CodeLabel, Diagnostic,
DiagnosticEntry, DiagnosticSet, Diff, File as _, Language, LanguageRegistry,
LanguageToolchainStore, LocalFile, LspAdapter, LspAdapterDelegate, Patch, PointUtf16,
TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped,
language_settings::{
language_settings, FormatOnSave, Formatter, LanguageSettings, SelectedFormatter,
FormatOnSave, Formatter, LanguageSettings, SelectedFormatter, language_settings,
},
point_to_lsp,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
range_from_lsp, range_to_lsp, Bias, BinaryStatus, Buffer, BufferSnapshot, CachedLspAdapter,
CodeLabel, Diagnostic, DiagnosticEntry, DiagnosticSet, Diff, File as _, Language,
LanguageRegistry, LanguageToolchainStore, LocalFile, LspAdapter, LspAdapterDelegate, Patch,
PointUtf16, TextBufferSnapshot, ToOffset, ToPointUtf16, Transaction, Unclipped,
range_from_lsp, range_to_lsp,
};
use lsp::{
notification::DidRenameFiles, CodeActionKind, CompletionContext, DiagnosticSeverity,
DiagnosticTag, DidChangeWatchedFilesRegistrationOptions, Edit, FileOperationFilter,
FileOperationPatternKind, FileOperationRegistrationOptions, FileRename, FileSystemWatcher,
LanguageServer, LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerId,
LanguageServerName, LspRequestFuture, MessageActionItem, MessageType, OneOf, RenameFilesParams,
SymbolKind, TextEdit, WillRenameFiles, WorkDoneProgressCancelParams, WorkspaceFolder,
CodeActionKind, CompletionContext, DiagnosticSeverity, DiagnosticTag,
DidChangeWatchedFilesRegistrationOptions, Edit, FileOperationFilter, FileOperationPatternKind,
FileOperationRegistrationOptions, FileRename, FileSystemWatcher, LanguageServer,
LanguageServerBinary, LanguageServerBinaryOptions, LanguageServerId, LanguageServerName,
LspRequestFuture, MessageActionItem, MessageType, OneOf, RenameFilesParams, SymbolKind,
TextEdit, WillRenameFiles, WorkDoneProgressCancelParams, WorkspaceFolder,
notification::DidRenameFiles,
};
use node_runtime::read_package_installed_version;
use parking_lot::Mutex;
@ -58,8 +60,8 @@ use postage::watch;
use rand::prelude::*;
use rpc::{
proto::{FromProto, ToProto},
AnyProtoClient,
proto::{FromProto, ToProto},
};
use serde::Serialize;
use settings::{Settings, SettingsLocation, SettingsStore};
@ -83,8 +85,8 @@ use std::{
use text::{Anchor, BufferId, LineEnding, OffsetRangeExt};
use url::Url;
use util::{
debug_panic, defer, maybe, merge_json_value_into, paths::SanitizedPath, post_inc, ResultExt,
TryFutureExt as _,
ResultExt, TryFutureExt as _, debug_panic, defer, maybe, merge_json_value_into,
paths::SanitizedPath, post_inc,
};
pub use fs::*;
@ -92,8 +94,8 @@ pub use language::Location;
#[cfg(any(test, feature = "test-support"))]
pub use prettier::FORMAT_SUFFIX as TEST_PRETTIER_FORMAT_SUFFIX;
pub use worktree::{
Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId, UpdatedEntriesSet,
UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, FS_WATCH_LATENCY,
Entry, EntryKind, FS_WATCH_LATENCY, File, LocalWorktree, PathChange, ProjectEntryId,
UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings,
};
const SERVER_LAUNCHING_BEFORE_SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
@ -3785,8 +3787,7 @@ impl LspStore {
irrefutable_let_patterns,
reason = "Make sure to handle new event types in extension properly"
)]
let extension::Event::ExtensionsInstalledChanged = evt
else {
let extension::Event::ExtensionsInstalledChanged = evt else {
return;
};
if self.as_local().is_none() {

View file

@ -2,7 +2,7 @@ use crate::{lsp_command::LspCommand, lsp_store::LspStore, make_text_document_ide
use anyhow::{Context as _, Result};
use async_trait::async_trait;
use gpui::{App, AsyncApp, Entity};
use language::{point_to_lsp, proto::deserialize_anchor, Buffer};
use language::{Buffer, point_to_lsp, proto::deserialize_anchor};
use lsp::{LanguageServer, LanguageServerId};
use rpc::proto::{self, PeerId};
use serde::{Deserialize, Serialize};

View file

@ -9,7 +9,7 @@ mod server_tree;
use std::{
borrow::Borrow,
collections::{hash_map::Entry, BTreeMap},
collections::{BTreeMap, hash_map::Entry},
ops::ControlFlow,
sync::Arc,
};
@ -23,8 +23,8 @@ use settings::{SettingsStore, WorktreeId};
use worktree::{Event as WorktreeEvent, Worktree};
use crate::{
worktree_store::{WorktreeStore, WorktreeStoreEvent},
ProjectPath,
worktree_store::{WorktreeStore, WorktreeStoreEvent},
};
pub(crate) use server_tree::{AdapterQuery, LanguageServerTree, LaunchDisposition};

View file

@ -1,5 +1,5 @@
use std::{
collections::{btree_map::Entry, BTreeMap},
collections::{BTreeMap, btree_map::Entry},
ffi::OsStr,
ops::ControlFlow,
path::{Path, PathBuf},

View file

@ -16,14 +16,14 @@ use std::{
use collections::{HashMap, IndexMap};
use gpui::{App, AppContext as _, Entity, Subscription};
use language::{
language_settings::AllLanguageSettings, Attach, CachedLspAdapter, LanguageName,
LanguageRegistry, LspAdapterDelegate,
Attach, CachedLspAdapter, LanguageName, LanguageRegistry, LspAdapterDelegate,
language_settings::AllLanguageSettings,
};
use lsp::LanguageServerName;
use settings::{Settings, SettingsLocation, WorktreeId};
use std::sync::OnceLock;
use crate::{project_settings::LspSettings, LanguageServerId, ProjectPath};
use crate::{LanguageServerId, ProjectPath, project_settings::LspSettings};
use super::{ManifestTree, ManifestTreeEvent};

View file

@ -4,18 +4,18 @@ use std::{
sync::Arc,
};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::{HashMap, HashSet};
use fs::Fs;
use futures::{
FutureExt,
future::{self, Shared},
stream::FuturesUnordered,
FutureExt,
};
use gpui::{AppContext as _, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity};
use language::{
language_settings::{Formatter, LanguageSettings, SelectedFormatter},
Buffer, LanguageRegistry, LocalFile,
language_settings::{Formatter, LanguageSettings, SelectedFormatter},
};
use lsp::{LanguageServer, LanguageServerId, LanguageServerName};
use node_runtime::NodeRuntime;
@ -25,8 +25,8 @@ use smol::stream::StreamExt;
use util::{ResultExt, TryFutureExt};
use crate::{
lsp_store::WorktreeId, worktree_store::WorktreeStore, File, PathChange, ProjectEntryId,
Worktree,
File, PathChange, ProjectEntryId, Worktree, lsp_store::WorktreeId,
worktree_store::WorktreeStore,
};
pub struct PrettierStore {

View file

@ -31,14 +31,14 @@ mod yarn;
use crate::git_store::GitStore;
pub use git_store::git_traversal::{ChildEntriesGitIter, GitEntry, GitEntryRef, GitTraversal};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use buffer_store::{BufferStore, BufferStoreEvent};
use client::{
proto, Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore,
Client, Collaborator, PendingEntitySubscription, ProjectId, TypedEnvelope, UserStore, proto,
};
use clock::ReplicaId;
use dap::{client::DebugAdapterClient, DapRegistry, DebugAdapterConfig};
use dap::{DapRegistry, DebugAdapterConfig, client::DebugAdapterClient};
use collections::{BTreeSet, HashMap, HashSet};
use debounced_delay::DebouncedDelay;
@ -49,9 +49,9 @@ use debugger::{
};
pub use environment::ProjectEnvironment;
use futures::{
StreamExt,
channel::mpsc::{self, UnboundedReceiver},
future::try_join_all,
StreamExt,
};
pub use image_store::{ImageItem, ImageStore};
use image_store::{ImageItemEvent, ImageStoreEvent};
@ -63,9 +63,9 @@ use gpui::{
};
use itertools::Itertools;
use language::{
language_settings::InlayHintKind, proto::split_operations, Buffer, BufferEvent, Capability,
CodeLabel, File as _, Language, LanguageName, LanguageRegistry, PointUtf16, ToOffset,
ToPointUtf16, Toolchain, ToolchainList, Transaction, Unclipped,
Buffer, BufferEvent, Capability, CodeLabel, File as _, Language, LanguageName,
LanguageRegistry, PointUtf16, ToOffset, ToPointUtf16, Toolchain, ToolchainList, Transaction,
Unclipped, language_settings::InlayHintKind, proto::split_operations,
};
use lsp::{
CodeActionKind, CompletionContext, CompletionItemKind, DocumentHighlightKind, LanguageServerId,
@ -80,8 +80,8 @@ pub use prettier_store::PrettierStore;
use project_settings::{ProjectSettings, SettingsObserver, SettingsObserverEvent};
use remote::{SshConnectionOptions, SshRemoteClient};
use rpc::{
proto::{FromProto, LanguageServerPromptResponse, ToProto, SSH_PROJECT_ID},
AnyProtoClient, ErrorCode,
proto::{FromProto, LanguageServerPromptResponse, SSH_PROJECT_ID, ToProto},
};
use search::{SearchInputKind, SearchQuery, SearchResult};
use search_history::SearchHistory;
@ -104,14 +104,13 @@ use terminals::Terminals;
use text::{Anchor, BufferId};
use toolchain_store::EmptyToolchainStore;
use util::{
maybe,
paths::{compare_paths, SanitizedPath},
ResultExt as _,
ResultExt as _, maybe,
paths::{SanitizedPath, compare_paths},
};
use worktree::{CreatedEntry, Snapshot, Traversal};
pub use worktree::{
Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId, UpdatedEntriesSet,
UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings, FS_WATCH_LATENCY,
Entry, EntryKind, FS_WATCH_LATENCY, File, LocalWorktree, PathChange, ProjectEntryId,
UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId, WorktreeSettings,
};
use worktree_store::{WorktreeStore, WorktreeStoreEvent};
@ -2988,29 +2987,31 @@ impl Project {
}
fn recalculate_buffer_diffs(&mut self, cx: &mut Context<Self>) -> Task<()> {
cx.spawn(async move |this, cx| loop {
let task = this
.update(cx, |this, cx| {
let buffers = this
.buffers_needing_diff
.drain()
.filter_map(|buffer| buffer.upgrade())
.collect::<Vec<_>>();
if buffers.is_empty() {
None
} else {
Some(this.git_store.update(cx, |git_store, cx| {
git_store.recalculate_buffer_diffs(buffers, cx)
}))
}
})
.ok()
.flatten();
cx.spawn(async move |this, cx| {
loop {
let task = this
.update(cx, |this, cx| {
let buffers = this
.buffers_needing_diff
.drain()
.filter_map(|buffer| buffer.upgrade())
.collect::<Vec<_>>();
if buffers.is_empty() {
None
} else {
Some(this.git_store.update(cx, |git_store, cx| {
git_store.recalculate_buffer_diffs(buffers, cx)
}))
}
})
.ok()
.flatten();
if let Some(task) = task {
task.await;
} else {
break;
if let Some(task) = task {
task.await;
} else {
break;
}
}
})
}

View file

@ -6,18 +6,18 @@ use futures::StreamExt as _;
use gpui::{App, AsyncApp, BorrowAppContext, Context, Entity, EventEmitter, Task};
use lsp::LanguageServerName;
use paths::{
local_debug_file_relative_path, local_settings_file_relative_path,
local_tasks_file_relative_path, local_vscode_tasks_file_relative_path, EDITORCONFIG_NAME,
EDITORCONFIG_NAME, local_debug_file_relative_path, local_settings_file_relative_path,
local_tasks_file_relative_path, local_vscode_tasks_file_relative_path,
};
use rpc::{
proto::{self, FromProto, ToProto},
AnyProtoClient, TypedEnvelope,
proto::{self, FromProto, ToProto},
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{
parse_json_with_comments, watch_config_file, InvalidSettingsError, LocalSettingsKind, Settings,
SettingsLocation, SettingsSources, SettingsStore, TaskKind,
InvalidSettingsError, LocalSettingsKind, Settings, SettingsLocation, SettingsSources,
SettingsStore, TaskKind, parse_json_with_comments, watch_config_file,
};
use std::{
path::{Path, PathBuf},

View file

@ -1,23 +1,23 @@
#![allow(clippy::format_collect)]
use crate::{task_inventory::TaskContexts, task_store::TaskSettingsLocation, Event, *};
use crate::{Event, task_inventory::TaskContexts, task_store::TaskSettingsLocation, *};
use buffer_diff::{
assert_hunks, BufferDiffEvent, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind,
BufferDiffEvent, DiffHunkSecondaryStatus, DiffHunkStatus, DiffHunkStatusKind, assert_hunks,
};
use fs::FakeFs;
use futures::{future, StreamExt};
use futures::{StreamExt, future};
use git::repository::RepoPath;
use gpui::{App, BackgroundExecutor, SemanticVersion, UpdateGlobal};
use http_client::Url;
use language::{
language_settings::{language_settings, AllLanguageSettings, LanguageSettingsContent},
tree_sitter_rust, tree_sitter_typescript, Diagnostic, DiagnosticEntry, DiagnosticSet,
DiskState, FakeLspAdapter, LanguageConfig, LanguageMatcher, LanguageName, LineEnding,
OffsetRangeExt, Point, ToPoint,
Diagnostic, DiagnosticEntry, DiagnosticSet, DiskState, FakeLspAdapter, LanguageConfig,
LanguageMatcher, LanguageName, LineEnding, OffsetRangeExt, Point, ToPoint,
language_settings::{AllLanguageSettings, LanguageSettingsContent, language_settings},
tree_sitter_rust, tree_sitter_typescript,
};
use lsp::{
notification::DidRenameFiles, DiagnosticSeverity, DocumentChanges, FileOperationFilter,
NumberOrString, TextDocumentEdit, WillRenameFiles,
DiagnosticSeverity, DocumentChanges, FileOperationFilter, NumberOrString, TextDocumentEdit,
WillRenameFiles, notification::DidRenameFiles,
};
use parking_lot::Mutex;
use paths::tasks_file;
@ -29,11 +29,11 @@ use std::{mem, num::NonZeroU32, ops::Range, str::FromStr, sync::OnceLock, task::
use task::{ResolvedTask, TaskContext};
use unindent::Unindent as _;
use util::{
assert_set_eq, path,
TryFutureExt as _, assert_set_eq, path,
paths::PathMatcher,
separator,
test::{marked_text_offsets, TempTree},
uri, TryFutureExt as _,
test::{TempTree, marked_text_offsets},
uri,
};
use worktree::WorktreeModelHandle as _;

View file

@ -13,13 +13,13 @@ use collections::{HashMap, HashSet, VecDeque};
use gpui::{App, AppContext as _, Entity, SharedString, Task};
use itertools::Itertools;
use language::{ContextProvider, File, Language, LanguageToolchainStore, Location};
use settings::{parse_json_with_comments, InvalidSettingsError, TaskKind};
use settings::{InvalidSettingsError, TaskKind, parse_json_with_comments};
use task::{
DebugTaskDefinition, ResolvedTask, TaskContext, TaskId, TaskTemplate, TaskTemplates,
TaskVariables, VariableName,
};
use text::{Point, ToPoint};
use util::{paths::PathExt as _, post_inc, NumericPrefixWithSuffix, ResultExt as _};
use util::{NumericPrefixWithSuffix, ResultExt as _, paths::PathExt as _, post_inc};
use worktree::WorktreeId;
use crate::{task_store::TaskSettingsLocation, worktree_store::WorktreeStore};

View file

@ -7,18 +7,18 @@ use anyhow::Context as _;
use collections::HashMap;
use gpui::{App, AsyncApp, Context, Entity, EventEmitter, Task, WeakEntity};
use language::{
proto::{deserialize_anchor, serialize_anchor},
ContextProvider as _, LanguageToolchainStore, Location,
proto::{deserialize_anchor, serialize_anchor},
};
use rpc::{proto, AnyProtoClient, TypedEnvelope};
use rpc::{AnyProtoClient, TypedEnvelope, proto};
use settings::{InvalidSettingsError, SettingsLocation, TaskKind};
use task::{TaskContext, TaskVariables, VariableName};
use text::{BufferId, OffsetRangeExt};
use util::ResultExt;
use crate::{
buffer_store::BufferStore, worktree_store::WorktreeStore, BasicContextProvider, Inventory,
ProjectEnvironment,
BasicContextProvider, Inventory, ProjectEnvironment, buffer_store::BufferStore,
worktree_store::WorktreeStore,
};
#[allow(clippy::large_enum_variant)] // platform-dependent warning

View file

@ -15,8 +15,8 @@ use std::{
};
use task::{Shell, ShellBuilder, SpawnInTerminal};
use terminal::{
terminal_settings::{self, TerminalSettings, VenvSettings},
TaskState, TaskStatus, Terminal, TerminalBuilder,
terminal_settings::{self, TerminalSettings, VenvSettings},
};
use util::ResultExt;

View file

@ -4,7 +4,7 @@ use std::{
sync::Arc,
};
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use async_trait::async_trait;
use collections::BTreeMap;
@ -13,13 +13,13 @@ use gpui::{
};
use language::{LanguageName, LanguageRegistry, LanguageToolchainStore, Toolchain, ToolchainList};
use rpc::{
proto::{self, FromProto, ToProto},
AnyProtoClient, TypedEnvelope,
proto::{self, FromProto, ToProto},
};
use settings::WorktreeId;
use util::ResultExt as _;
use crate::{worktree_store::WorktreeStore, ProjectEnvironment, ProjectPath};
use crate::{ProjectEnvironment, ProjectPath, worktree_store::WorktreeStore};
pub struct ToolchainStore(ToolchainStoreInner);
enum ToolchainStoreInner {

View file

@ -2,36 +2,36 @@ use std::{
io::{BufRead, BufReader},
path::{Path, PathBuf},
pin::pin,
sync::{atomic::AtomicUsize, Arc},
sync::{Arc, atomic::AtomicUsize},
};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::{HashMap, HashSet};
use fs::Fs;
use futures::{
future::{BoxFuture, Shared},
FutureExt, SinkExt,
future::{BoxFuture, Shared},
};
use gpui::{
App, AppContext as _, AsyncApp, Context, Entity, EntityId, EventEmitter, Task, WeakEntity,
};
use postage::oneshot;
use rpc::{
proto::{self, FromProto, ToProto, SSH_PROJECT_ID},
AnyProtoClient, ErrorExt, TypedEnvelope,
proto::{self, FromProto, SSH_PROJECT_ID, ToProto},
};
use smol::{
channel::{Receiver, Sender},
stream::StreamExt,
};
use text::ReplicaId;
use util::{paths::SanitizedPath, ResultExt};
use util::{ResultExt, paths::SanitizedPath};
use worktree::{
Entry, ProjectEntryId, UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId,
WorktreeSettings,
};
use crate::{search::SearchQuery, ProjectPath};
use crate::{ProjectPath, search::SearchQuery};
struct MatchingEntry {
worktree_path: Arc<Path>,