Merge branch 'main' into randomized-tests-operation-script

This commit is contained in:
Antonio Scandurra 2023-04-10 08:43:29 +02:00
commit 016343e65d
148 changed files with 1283 additions and 1287 deletions

View file

@ -4,7 +4,7 @@ use crate::{
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use client::proto::{self, PeerId};
use gpui::{AppContext, AsyncAppContext, ModelHandle, MutableAppContext};
use gpui::{AppContext, AsyncAppContext, ModelHandle};
use language::{
point_from_lsp, point_to_lsp,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
@ -49,7 +49,7 @@ pub(crate) trait LspCommand: 'static + Sized {
project: &mut Project,
peer_id: PeerId,
buffer_version: &clock::Global,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> <Self::ProtoRequest as proto::RequestMessage>::Response;
async fn response_from_proto(
self,
@ -175,7 +175,7 @@ impl LspCommand for PrepareRename {
_: &mut Project,
_: PeerId,
buffer_version: &clock::Global,
_: &mut MutableAppContext,
_: &mut AppContext,
) -> proto::PrepareRenameResponse {
proto::PrepareRenameResponse {
can_rename: range.is_some(),
@ -296,7 +296,7 @@ impl LspCommand for PerformRename {
project: &mut Project,
peer_id: PeerId,
_: &clock::Global,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> proto::PerformRenameResponse {
let transaction = project.serialize_project_transaction_for_peer(response, peer_id, cx);
proto::PerformRenameResponse {
@ -391,7 +391,7 @@ impl LspCommand for GetDefinition {
project: &mut Project,
peer_id: PeerId,
_: &clock::Global,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> proto::GetDefinitionResponse {
let links = location_links_to_proto(response, project, peer_id, cx);
proto::GetDefinitionResponse { links }
@ -477,7 +477,7 @@ impl LspCommand for GetTypeDefinition {
project: &mut Project,
peer_id: PeerId,
_: &clock::Global,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> proto::GetTypeDefinitionResponse {
let links = location_links_to_proto(response, project, peer_id, cx);
proto::GetTypeDefinitionResponse { links }
@ -658,7 +658,7 @@ fn location_links_to_proto(
links: Vec<LocationLink>,
project: &mut Project,
peer_id: PeerId,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> Vec<proto::LocationLink> {
links
.into_iter()
@ -787,7 +787,7 @@ impl LspCommand for GetReferences {
project: &mut Project,
peer_id: PeerId,
_: &clock::Global,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> proto::GetReferencesResponse {
let locations = response
.into_iter()
@ -928,7 +928,7 @@ impl LspCommand for GetDocumentHighlights {
_: &mut Project,
_: PeerId,
_: &clock::Global,
_: &mut MutableAppContext,
_: &mut AppContext,
) -> proto::GetDocumentHighlightsResponse {
let highlights = response
.into_iter()
@ -1130,7 +1130,7 @@ impl LspCommand for GetHover {
_: &mut Project,
_: PeerId,
_: &clock::Global,
_: &mut MutableAppContext,
_: &mut AppContext,
) -> proto::GetHoverResponse {
if let Some(response) = response {
let (start, end) = if let Some(range) = response.range {

View file

@ -21,8 +21,8 @@ use futures::{
AsyncWriteExt, Future, FutureExt, StreamExt, TryFutureExt,
};
use gpui::{
AnyModelHandle, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle,
MutableAppContext, Task, UpgradeModelHandle, WeakModelHandle,
AnyModelHandle, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task,
UpgradeModelHandle, WeakModelHandle,
};
use language::{
point_to_lsp,
@ -427,7 +427,7 @@ impl Project {
user_store: ModelHandle<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> ModelHandle<Self> {
cx.add_model(|cx: &mut ModelContext<Self>| {
let (tx, rx) = mpsc::unbounded();
@ -5902,7 +5902,7 @@ impl Project {
&mut self,
project_transaction: ProjectTransaction,
peer_id: proto::PeerId,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> proto::ProjectTransaction {
let mut serialized_transaction = proto::ProjectTransaction {
buffer_ids: Default::default(),
@ -5960,7 +5960,7 @@ impl Project {
&mut self,
buffer: &ModelHandle<Buffer>,
peer_id: proto::PeerId,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> u64 {
let buffer_id = buffer.read(cx).remote_id();
if let Some(project_id) = self.remote_id() {
@ -6573,7 +6573,7 @@ impl<'a> Iterator for PathMatchCandidateSetIter<'a> {
impl Entity for Project {
type Event = Event;
fn release(&mut self, _: &mut gpui::MutableAppContext) {
fn release(&mut self, _: &mut gpui::AppContext) {
match &self.client_state {
Some(ProjectClientState::Local { remote_id, .. }) => {
let _ = self.client.send(proto::UnshareProject {
@ -6591,7 +6591,7 @@ impl Entity for Project {
fn app_will_quit(
&mut self,
_: &mut MutableAppContext,
_: &mut AppContext,
) -> Option<std::pin::Pin<Box<dyn 'static + Future<Output = ()>>>> {
let shutdown_futures = self
.language_servers

View file

@ -2,6 +2,7 @@ use crate::{worktree::WorktreeHandle, Event, *};
use fs::LineEnding;
use fs::{FakeFs, RealFs};
use futures::{future, StreamExt};
use gpui::AppContext;
use gpui::{executor::Deterministic, test::subscribe};
use language::{
tree_sitter_rust, tree_sitter_typescript, Diagnostic, FakeLspAdapter, LanguageConfig,

View file

@ -16,10 +16,7 @@ use futures::{
};
use fuzzy::CharBag;
use git::{DOT_GIT, GITIGNORE};
use gpui::{
executor, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext,
Task,
};
use gpui::{executor, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, Task};
use language::{
proto::{
deserialize_fingerprint, deserialize_version, serialize_fingerprint, serialize_line_ending,
@ -287,7 +284,7 @@ impl Worktree {
replica_id: ReplicaId,
worktree: proto::WorktreeMetadata,
client: Arc<Client>,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) -> ModelHandle<Self> {
cx.add_model(|cx: &mut ModelContext<Self>| {
let snapshot = Snapshot {
@ -1895,7 +1892,7 @@ impl language::LocalFile for File {
fingerprint: RopeFingerprint,
line_ending: LineEnding,
mtime: SystemTime,
cx: &mut MutableAppContext,
cx: &mut AppContext,
) {
let worktree = self.worktree.read(cx).as_local().unwrap();
if let Some(project_id) = worktree.share.as_ref().map(|share| share.project_id) {