Remove the 2s from source code

This commit is contained in:
Mikayla 2023-11-02 10:55:02 -07:00
parent a3565225ad
commit d11ff14b57
No known key found for this signature in database
115 changed files with 1473 additions and 1549 deletions

2
Cargo.lock generated
View file

@ -1541,7 +1541,6 @@ dependencies = [
"schemars", "schemars",
"serde", "serde",
"serde_derive", "serde_derive",
"settings",
"settings2", "settings2",
"smol", "smol",
"sum_tree", "sum_tree",
@ -7796,7 +7795,6 @@ dependencies = [
"anyhow", "anyhow",
"collections", "collections",
"feature_flags2", "feature_flags2",
"fs",
"fs2", "fs2",
"futures 0.3.28", "futures 0.3.28",
"gpui2", "gpui2",

View file

@ -12,9 +12,9 @@ doctest = false
test-support = [] test-support = []
[dependencies] [dependencies]
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
util = { path = "../util" } util = { path = "../util" }
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
async-trait.workspace = true async-trait.workspace = true
anyhow.workspace = true anyhow.workspace = true
futures.workspace = true futures.workspace = true
@ -35,4 +35,4 @@ rusqlite = { version = "0.29.0", features = ["blob", "array", "modern_sqlite"] }
bincode = "1.3.3" bincode = "1.3.3"
[dev-dependencies] [dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }

View file

@ -1,4 +1,4 @@
use gpui2::AppContext; use gpui::AppContext;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum ProviderCredential { pub enum ProviderCredential {

View file

@ -81,7 +81,7 @@ mod tests {
use super::*; use super::*;
use rand::prelude::*; use rand::prelude::*;
#[gpui2::test] #[gpui::test]
fn test_similarity(mut rng: StdRng) { fn test_similarity(mut rng: StdRng) {
assert_eq!( assert_eq!(
Embedding::from(vec![1., 0., 0., 0., 0.]) Embedding::from(vec![1., 0., 0., 0., 0.])

View file

@ -2,7 +2,7 @@ use std::cmp::Reverse;
use std::ops::Range; use std::ops::Range;
use std::sync::Arc; use std::sync::Arc;
use language2::BufferSnapshot; use language::BufferSnapshot;
use util::ResultExt; use util::ResultExt;
use crate::models::LanguageModel; use crate::models::LanguageModel;

View file

@ -1,6 +1,6 @@
use anyhow::anyhow; use anyhow::anyhow;
use language2::BufferSnapshot; use language::BufferSnapshot;
use language2::ToOffset; use language::ToOffset;
use crate::models::LanguageModel; use crate::models::LanguageModel;
use crate::models::TruncationDirection; use crate::models::TruncationDirection;

View file

@ -2,8 +2,8 @@ use crate::prompts::base::{PromptArguments, PromptTemplate};
use std::fmt::Write; use std::fmt::Write;
use std::{ops::Range, path::PathBuf}; use std::{ops::Range, path::PathBuf};
use gpui2::{AsyncAppContext, Model}; use gpui::{AsyncAppContext, Model};
use language2::{Anchor, Buffer}; use language::{Anchor, Buffer};
#[derive(Clone)] #[derive(Clone)]
pub struct PromptCodeSnippet { pub struct PromptCodeSnippet {

View file

@ -3,7 +3,7 @@ use futures::{
future::BoxFuture, io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, FutureExt, future::BoxFuture, io::BufReader, stream::BoxStream, AsyncBufReadExt, AsyncReadExt, FutureExt,
Stream, StreamExt, Stream, StreamExt,
}; };
use gpui2::{AppContext, BackgroundExecutor}; use gpui::{AppContext, BackgroundExecutor};
use isahc::{http::StatusCode, Request, RequestExt}; use isahc::{http::StatusCode, Request, RequestExt};
use parking_lot::RwLock; use parking_lot::RwLock;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use async_trait::async_trait; use async_trait::async_trait;
use futures::AsyncReadExt; use futures::AsyncReadExt;
use gpui2::BackgroundExecutor; use gpui::BackgroundExecutor;
use gpui2::{serde_json, AppContext}; use gpui::{serde_json, AppContext};
use isahc::http::StatusCode; use isahc::http::StatusCode;
use isahc::prelude::Configurable; use isahc::prelude::Configurable;
use isahc::{AsyncBody, Response}; use isahc::{AsyncBody, Response};

View file

@ -5,7 +5,7 @@ use std::{
use async_trait::async_trait; use async_trait::async_trait;
use futures::{channel::mpsc, future::BoxFuture, stream::BoxStream, FutureExt, StreamExt}; use futures::{channel::mpsc, future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
use gpui2::AppContext; use gpui::AppContext;
use parking_lot::Mutex; use parking_lot::Mutex;
use crate::{ use crate::{

View file

@ -9,7 +9,7 @@ path = "src/audio2.rs"
doctest = false doctest = false
[dependencies] [dependencies]
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
collections = { path = "../collections" } collections = { path = "../collections" }
util = { path = "../util" } util = { path = "../util" }

View file

@ -2,7 +2,7 @@ use std::{io::Cursor, sync::Arc};
use anyhow::Result; use anyhow::Result;
use collections::HashMap; use collections::HashMap;
use gpui2::{AppContext, AssetSource}; use gpui::{AppContext, AssetSource};
use rodio::{ use rodio::{
source::{Buffered, SamplesConverter}, source::{Buffered, SamplesConverter},
Decoder, Source, Decoder, Source,

View file

@ -1,5 +1,5 @@
use assets::SoundRegistry; use assets::SoundRegistry;
use gpui2::{AppContext, AssetSource}; use gpui::{AppContext, AssetSource};
use rodio::{OutputStream, OutputStreamHandle}; use rodio::{OutputStream, OutputStreamHandle};
use util::ResultExt; use util::ResultExt;

View file

@ -10,26 +10,26 @@ doctest = false
[features] [features]
test-support = [ test-support = [
"client2/test-support", "client/test-support",
"collections/test-support", "collections/test-support",
"gpui2/test-support", "gpui/test-support",
"live_kit_client2/test-support", "live_kit_client/test-support",
"project2/test-support", "project/test-support",
"util/test-support" "util/test-support"
] ]
[dependencies] [dependencies]
audio2 = { path = "../audio2" } audio = { package = "audio2", path = "../audio2" }
client2 = { path = "../client2" } client = { package = "client2", path = "../client2" }
collections = { path = "../collections" } collections = { path = "../collections" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
log.workspace = true log.workspace = true
live_kit_client2 = { path = "../live_kit_client2" } live_kit_client = { package = "live_kit_client2", path = "../live_kit_client2" }
fs2 = { path = "../fs2" } fs = { package = "fs2", path = "../fs2" }
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
media = { path = "../media" } media = { path = "../media" }
project2 = { path = "../project2" } project = { package = "project2", path = "../project2" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
util = { path = "../util" } util = { path = "../util" }
anyhow.workspace = true anyhow.workspace = true
@ -42,11 +42,11 @@ serde_json.workspace = true
serde_derive.workspace = true serde_derive.workspace = true
[dev-dependencies] [dev-dependencies]
client2 = { path = "../client2", features = ["test-support"] } client = { package = "client2", path = "../client2", features = ["test-support"] }
fs2 = { path = "../fs2", features = ["test-support"] } fs = { package = "fs2", path = "../fs2", features = ["test-support"] }
language2 = { path = "../language2", features = ["test-support"] } language = { package = "language2", path = "../language2", features = ["test-support"] }
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
live_kit_client2 = { path = "../live_kit_client2", features = ["test-support"] } live_kit_client = { package = "live_kit_client2", path = "../live_kit_client2", features = ["test-support"] }
project2 = { path = "../project2", features = ["test-support"] } project = { package = "project2", path = "../project2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }

View file

@ -3,21 +3,21 @@ pub mod participant;
pub mod room; pub mod room;
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use audio2::Audio; use audio::Audio;
use call_settings::CallSettings; use call_settings::CallSettings;
use client2::{ use client::{
proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore, proto, ClickhouseEvent, Client, TelemetrySettings, TypedEnvelope, User, UserStore,
ZED_ALWAYS_ACTIVE, ZED_ALWAYS_ACTIVE,
}; };
use collections::HashSet; use collections::HashSet;
use futures::{future::Shared, FutureExt}; use futures::{future::Shared, FutureExt};
use gpui2::{ use gpui::{
AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Subscription, Task, AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Subscription, Task,
WeakModel, WeakModel,
}; };
use postage::watch; use postage::watch;
use project2::Project; use project::Project;
use settings2::Settings; use settings::Settings;
use std::sync::Arc; use std::sync::Arc;
pub use participant::ParticipantLocation; pub use participant::ParticipantLocation;
@ -50,7 +50,7 @@ pub struct ActiveCall {
), ),
client: Arc<Client>, client: Arc<Client>,
user_store: Model<UserStore>, user_store: Model<UserStore>,
_subscriptions: Vec<client2::Subscription>, _subscriptions: Vec<client::Subscription>,
} }
impl EventEmitter for ActiveCall { impl EventEmitter for ActiveCall {

View file

@ -1,8 +1,8 @@
use anyhow::Result; use anyhow::Result;
use gpui2::AppContext; use gpui::AppContext;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use settings2::Settings; use settings::Settings;
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct CallSettings { pub struct CallSettings {

View file

@ -1,11 +1,11 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use client2::ParticipantIndex; use client::ParticipantIndex;
use client2::{proto, User}; use client::{proto, User};
use collections::HashMap; use collections::HashMap;
use gpui2::WeakModel; use gpui::WeakModel;
pub use live_kit_client2::Frame; pub use live_kit_client::Frame;
use live_kit_client2::{RemoteAudioTrack, RemoteVideoTrack}; use live_kit_client::{RemoteAudioTrack, RemoteVideoTrack};
use project2::Project; use project::Project;
use std::sync::Arc; use std::sync::Arc;
#[derive(Copy, Clone, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
@ -47,6 +47,6 @@ pub struct RemoteParticipant {
pub participant_index: ParticipantIndex, pub participant_index: ParticipantIndex,
pub muted: bool, pub muted: bool,
pub speaking: bool, pub speaking: bool,
pub video_tracks: HashMap<live_kit_client2::Sid, Arc<RemoteVideoTrack>>, pub video_tracks: HashMap<live_kit_client::Sid, Arc<RemoteVideoTrack>>,
pub audio_tracks: HashMap<live_kit_client2::Sid, Arc<RemoteAudioTrack>>, pub audio_tracks: HashMap<live_kit_client::Sid, Arc<RemoteAudioTrack>>,
} }

View file

@ -4,25 +4,25 @@ use crate::{
IncomingCall, IncomingCall,
}; };
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use audio2::{Audio, Sound}; use audio::{Audio, Sound};
use client2::{ use client::{
proto::{self, PeerId}, proto::{self, PeerId},
Client, ParticipantIndex, TypedEnvelope, User, UserStore, Client, ParticipantIndex, TypedEnvelope, User, UserStore,
}; };
use collections::{BTreeMap, HashMap, HashSet}; use collections::{BTreeMap, HashMap, HashSet};
use fs2::Fs; use fs::Fs;
use futures::{FutureExt, StreamExt}; use futures::{FutureExt, StreamExt};
use gpui2::{ use gpui::{
AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel, AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel,
}; };
use language2::LanguageRegistry; use language::LanguageRegistry;
use live_kit_client2::{ use live_kit_client::{
LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, RemoteAudioTrackUpdate, LocalAudioTrack, LocalTrackPublication, LocalVideoTrack, RemoteAudioTrackUpdate,
RemoteVideoTrackUpdate, RemoteVideoTrackUpdate,
}; };
use postage::{sink::Sink, stream::Stream, watch}; use postage::{sink::Sink, stream::Stream, watch};
use project2::Project; use project::Project;
use settings2::Settings; use settings::Settings;
use std::{future::Future, mem, sync::Arc, time::Duration}; use std::{future::Future, mem, sync::Arc, time::Duration};
use util::{post_inc, ResultExt, TryFutureExt}; use util::{post_inc, ResultExt, TryFutureExt};
@ -72,8 +72,8 @@ pub struct Room {
client: Arc<Client>, client: Arc<Client>,
user_store: Model<UserStore>, user_store: Model<UserStore>,
follows_by_leader_id_project_id: HashMap<(PeerId, u64), Vec<PeerId>>, follows_by_leader_id_project_id: HashMap<(PeerId, u64), Vec<PeerId>>,
client_subscriptions: Vec<client2::Subscription>, client_subscriptions: Vec<client::Subscription>,
_subscriptions: Vec<gpui2::Subscription>, _subscriptions: Vec<gpui::Subscription>,
room_update_completed_tx: watch::Sender<Option<()>>, room_update_completed_tx: watch::Sender<Option<()>>,
room_update_completed_rx: watch::Receiver<Option<()>>, room_update_completed_rx: watch::Receiver<Option<()>>,
pending_room_update: Option<Task<()>>, pending_room_update: Option<Task<()>>,
@ -98,7 +98,7 @@ impl Room {
if let Some(live_kit) = self.live_kit.as_ref() { if let Some(live_kit) = self.live_kit.as_ref() {
matches!( matches!(
*live_kit.room.status().borrow(), *live_kit.room.status().borrow(),
live_kit_client2::ConnectionState::Connected { .. } live_kit_client::ConnectionState::Connected { .. }
) )
} else { } else {
false false
@ -114,7 +114,7 @@ impl Room {
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) -> Self { ) -> Self {
let live_kit_room = if let Some(connection_info) = live_kit_connection_info { let live_kit_room = if let Some(connection_info) = live_kit_connection_info {
let room = live_kit_client2::Room::new(); let room = live_kit_client::Room::new();
let mut status = room.status(); let mut status = room.status();
// Consume the initial status of the room. // Consume the initial status of the room.
let _ = status.try_recv(); let _ = status.try_recv();
@ -126,7 +126,7 @@ impl Room {
break; break;
}; };
if status == live_kit_client2::ConnectionState::Disconnected { if status == live_kit_client::ConnectionState::Disconnected {
this.update(&mut cx, |this, cx| this.leave(cx).log_err()) this.update(&mut cx, |this, cx| this.leave(cx).log_err())
.ok(); .ok();
break; break;
@ -341,7 +341,7 @@ impl Room {
} }
pub fn mute_on_join(cx: &AppContext) -> bool { pub fn mute_on_join(cx: &AppContext) -> bool {
CallSettings::get_global(cx).mute_on_join || client2::IMPERSONATE_LOGIN.is_some() CallSettings::get_global(cx).mute_on_join || client::IMPERSONATE_LOGIN.is_some()
} }
fn from_join_response( fn from_join_response(
@ -1504,7 +1504,7 @@ impl Room {
} }
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
pub fn set_display_sources(&self, sources: Vec<live_kit_client2::MacOSDisplay>) { pub fn set_display_sources(&self, sources: Vec<live_kit_client::MacOSDisplay>) {
self.live_kit self.live_kit
.as_ref() .as_ref()
.unwrap() .unwrap()
@ -1514,7 +1514,7 @@ impl Room {
} }
struct LiveKitRoom { struct LiveKitRoom {
room: Arc<live_kit_client2::Room>, room: Arc<live_kit_client::Room>,
screen_track: LocalTrack, screen_track: LocalTrack,
microphone_track: LocalTrack, microphone_track: LocalTrack,
/// Tracks whether we're currently in a muted state due to auto-mute from deafening or manual mute performed by user. /// Tracks whether we're currently in a muted state due to auto-mute from deafening or manual mute performed by user.

View file

@ -9,17 +9,17 @@ path = "src/client2.rs"
doctest = false doctest = false
[features] [features]
test-support = ["collections/test-support", "gpui2/test-support", "rpc2/test-support"] test-support = ["collections/test-support", "gpui/test-support", "rpc/test-support"]
[dependencies] [dependencies]
collections = { path = "../collections" } collections = { path = "../collections" }
db2 = { path = "../db2" } db = { package = "db2", path = "../db2" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
util = { path = "../util" } util = { path = "../util" }
rpc2 = { path = "../rpc2" } rpc = { package = "rpc2", path = "../rpc2" }
text = { path = "../text" } text = { path = "../text" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
feature_flags2 = { path = "../feature_flags2" } feature_flags = { package = "feature_flags2", path = "../feature_flags2" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
anyhow.workspace = true anyhow.workspace = true
@ -46,7 +46,7 @@ url = "2.2"
[dev-dependencies] [dev-dependencies]
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
rpc2 = { path = "../rpc2", features = ["test-support"] } rpc = { package = "rpc2", path = "../rpc2", features = ["test-support"] }
settings = { path = "../settings", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }

View file

@ -14,7 +14,7 @@ use futures::{
future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt, TryFutureExt as _, future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt, TryFutureExt as _,
TryStreamExt, TryStreamExt,
}; };
use gpui2::{ use gpui::{
serde_json, AnyModel, AnyWeakModel, AppContext, AsyncAppContext, Model, SemanticVersion, Task, serde_json, AnyModel, AnyWeakModel, AppContext, AsyncAppContext, Model, SemanticVersion, Task,
WeakModel, WeakModel,
}; };
@ -22,10 +22,10 @@ use lazy_static::lazy_static;
use parking_lot::RwLock; use parking_lot::RwLock;
use postage::watch; use postage::watch;
use rand::prelude::*; use rand::prelude::*;
use rpc2::proto::{AnyTypedEnvelope, EntityMessage, EnvelopedMessage, PeerId, RequestMessage}; use rpc::proto::{AnyTypedEnvelope, EntityMessage, EnvelopedMessage, PeerId, RequestMessage};
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings2::Settings; use settings::Settings;
use std::{ use std::{
any::TypeId, any::TypeId,
collections::HashMap, collections::HashMap,
@ -44,7 +44,7 @@ use util::channel::ReleaseChannel;
use util::http::HttpClient; use util::http::HttpClient;
use util::{ResultExt, TryFutureExt}; use util::{ResultExt, TryFutureExt};
pub use rpc2::*; pub use rpc::*;
pub use telemetry::ClickhouseEvent; pub use telemetry::ClickhouseEvent;
pub use user::*; pub use user::*;
@ -367,7 +367,7 @@ pub struct TelemetrySettingsContent {
pub metrics: Option<bool>, pub metrics: Option<bool>,
} }
impl settings2::Settings for TelemetrySettings { impl settings::Settings for TelemetrySettings {
const KEY: Option<&'static str> = Some("telemetry"); const KEY: Option<&'static str> = Some("telemetry");
type FileContent = TelemetrySettingsContent; type FileContent = TelemetrySettingsContent;
@ -979,7 +979,7 @@ impl Client {
"Authorization", "Authorization",
format!("{} {}", credentials.user_id, credentials.access_token), format!("{} {}", credentials.user_id, credentials.access_token),
) )
.header("x-zed-protocol-version", rpc2::PROTOCOL_VERSION); .header("x-zed-protocol-version", rpc::PROTOCOL_VERSION);
let http = self.http.clone(); let http = self.http.clone();
cx.background_executor().spawn(async move { cx.background_executor().spawn(async move {
@ -1029,7 +1029,7 @@ impl Client {
// zed server to encrypt the user's access token, so that it can'be intercepted by // zed server to encrypt the user's access token, so that it can'be intercepted by
// any other app running on the user's device. // any other app running on the user's device.
let (public_key, private_key) = let (public_key, private_key) =
rpc2::auth::keypair().expect("failed to generate keypair for auth"); rpc::auth::keypair().expect("failed to generate keypair for auth");
let public_key_string = let public_key_string =
String::try_from(public_key).expect("failed to serialize public key for auth"); String::try_from(public_key).expect("failed to serialize public key for auth");
@ -1383,12 +1383,12 @@ mod tests {
use super::*; use super::*;
use crate::test::FakeServer; use crate::test::FakeServer;
use gpui2::{BackgroundExecutor, Context, TestAppContext}; use gpui::{BackgroundExecutor, Context, TestAppContext};
use parking_lot::Mutex; use parking_lot::Mutex;
use std::future; use std::future;
use util::http::FakeHttpClient; use util::http::FakeHttpClient;
#[gpui2::test(iterations = 10)] #[gpui::test(iterations = 10)]
async fn test_reconnection(cx: &mut TestAppContext) { async fn test_reconnection(cx: &mut TestAppContext) {
let user_id = 5; let user_id = 5;
let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx)); let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx));
@ -1422,7 +1422,7 @@ mod tests {
assert_eq!(server.auth_count(), 2); // Client re-authenticated due to an invalid token assert_eq!(server.auth_count(), 2); // Client re-authenticated due to an invalid token
} }
#[gpui2::test(iterations = 10)] #[gpui::test(iterations = 10)]
async fn test_connection_timeout(executor: BackgroundExecutor, cx: &mut TestAppContext) { async fn test_connection_timeout(executor: BackgroundExecutor, cx: &mut TestAppContext) {
let user_id = 5; let user_id = 5;
let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx)); let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx));
@ -1490,7 +1490,7 @@ mod tests {
)); ));
} }
#[gpui2::test(iterations = 10)] #[gpui::test(iterations = 10)]
async fn test_authenticating_more_than_once( async fn test_authenticating_more_than_once(
cx: &mut TestAppContext, cx: &mut TestAppContext,
executor: BackgroundExecutor, executor: BackgroundExecutor,
@ -1541,7 +1541,7 @@ mod tests {
assert_eq!(decode_worktree_url("not://the-right-format"), None); assert_eq!(decode_worktree_url("not://the-right-format"), None);
} }
#[gpui2::test] #[gpui::test]
async fn test_subscribing_to_entity(cx: &mut TestAppContext) { async fn test_subscribing_to_entity(cx: &mut TestAppContext) {
let user_id = 5; let user_id = 5;
let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx)); let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx));
@ -1594,7 +1594,7 @@ mod tests {
done_rx2.next().await.unwrap(); done_rx2.next().await.unwrap();
} }
#[gpui2::test] #[gpui::test]
async fn test_subscribing_after_dropping_subscription(cx: &mut TestAppContext) { async fn test_subscribing_after_dropping_subscription(cx: &mut TestAppContext) {
let user_id = 5; let user_id = 5;
let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx)); let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx));
@ -1622,7 +1622,7 @@ mod tests {
done_rx2.next().await.unwrap(); done_rx2.next().await.unwrap();
} }
#[gpui2::test] #[gpui::test]
async fn test_dropping_subscription_in_handler(cx: &mut TestAppContext) { async fn test_dropping_subscription_in_handler(cx: &mut TestAppContext) {
let user_id = 5; let user_id = 5;
let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx)); let client = cx.update(|cx| Client::new(FakeHttpClient::with_404_response(), cx));

View file

@ -1,9 +1,9 @@
use crate::{TelemetrySettings, ZED_SECRET_CLIENT_TOKEN, ZED_SERVER_URL}; use crate::{TelemetrySettings, ZED_SECRET_CLIENT_TOKEN, ZED_SERVER_URL};
use gpui2::{serde_json, AppContext, AppMetadata, BackgroundExecutor, Task}; use gpui::{serde_json, AppContext, AppMetadata, BackgroundExecutor, Task};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use parking_lot::Mutex; use parking_lot::Mutex;
use serde::Serialize; use serde::Serialize;
use settings2::Settings; use settings::Settings;
use std::{env, io::Write, mem, path::PathBuf, sync::Arc, time::Duration}; use std::{env, io::Write, mem, path::PathBuf, sync::Arc, time::Duration};
use sysinfo::{ use sysinfo::{
CpuRefreshKind, Pid, PidExt, ProcessExt, ProcessRefreshKind, RefreshKind, System, SystemExt, CpuRefreshKind, Pid, PidExt, ProcessExt, ProcessRefreshKind, RefreshKind, System, SystemExt,

View file

@ -1,9 +1,9 @@
use crate::{Client, Connection, Credentials, EstablishConnectionError, UserStore}; use crate::{Client, Connection, Credentials, EstablishConnectionError, UserStore};
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use futures::{stream::BoxStream, StreamExt}; use futures::{stream::BoxStream, StreamExt};
use gpui2::{BackgroundExecutor, Context, Model, TestAppContext}; use gpui::{BackgroundExecutor, Context, Model, TestAppContext};
use parking_lot::Mutex; use parking_lot::Mutex;
use rpc2::{ use rpc::{
proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse}, proto::{self, GetPrivateUserInfo, GetPrivateUserInfoResponse},
ConnectionId, Peer, Receipt, TypedEnvelope, ConnectionId, Peer, Receipt, TypedEnvelope,
}; };

View file

@ -1,11 +1,11 @@
use super::{proto, Client, Status, TypedEnvelope}; use super::{proto, Client, Status, TypedEnvelope};
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use collections::{hash_map::Entry, HashMap, HashSet}; use collections::{hash_map::Entry, HashMap, HashSet};
use feature_flags2::FeatureFlagAppExt; use feature_flags::FeatureFlagAppExt;
use futures::{channel::mpsc, future, AsyncReadExt, Future, StreamExt}; use futures::{channel::mpsc, future, AsyncReadExt, Future, StreamExt};
use gpui2::{AsyncAppContext, EventEmitter, ImageData, Model, ModelContext, Task}; use gpui::{AsyncAppContext, EventEmitter, ImageData, Model, ModelContext, Task};
use postage::{sink::Sink, watch}; use postage::{sink::Sink, watch};
use rpc2::proto::{RequestMessage, UsersResponse}; use rpc::proto::{RequestMessage, UsersResponse};
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use text::ReplicaId; use text::ReplicaId;
use util::http::HttpClient; use util::http::HttpClient;

View file

@ -11,21 +11,21 @@ doctest = false
[features] [features]
test-support = [ test-support = [
"collections/test-support", "collections/test-support",
"gpui2/test-support", "gpui/test-support",
"language2/test-support", "language/test-support",
"lsp2/test-support", "lsp/test-support",
"settings2/test-support", "settings/test-support",
"util/test-support", "util/test-support",
] ]
[dependencies] [dependencies]
collections = { path = "../collections" } collections = { path = "../collections" }
context_menu = { path = "../context_menu" } context_menu = { path = "../context_menu" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
theme = { path = "../theme" } theme = { path = "../theme" }
lsp2 = { path = "../lsp2" } lsp = { package = "lsp2", path = "../lsp2" }
node_runtime = { path = "../node_runtime"} node_runtime = { path = "../node_runtime"}
util = { path = "../util" } util = { path = "../util" }
async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] } async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }
@ -42,9 +42,9 @@ parking_lot.workspace = true
clock = { path = "../clock" } clock = { path = "../clock" }
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
fs = { path = "../fs", features = ["test-support"] } fs = { path = "../fs", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
language2 = { path = "../language2", features = ["test-support"] } language = { package = "language2", path = "../language2", features = ["test-support"] }
lsp2 = { path = "../lsp2", features = ["test-support"] } lsp = { package = "lsp2", path = "../lsp2", features = ["test-support"] }
rpc = { path = "../rpc", features = ["test-support"] } rpc = { path = "../rpc", features = ["test-support"] }
settings2 = { path = "../settings2", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }

View file

@ -6,20 +6,20 @@ use async_compression::futures::bufread::GzipDecoder;
use async_tar::Archive; use async_tar::Archive;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use futures::{channel::oneshot, future::Shared, Future, FutureExt, TryFutureExt}; use futures::{channel::oneshot, future::Shared, Future, FutureExt, TryFutureExt};
use gpui2::{ use gpui::{
AppContext, AsyncAppContext, Context, Entity, EntityId, EventEmitter, Model, ModelContext, AppContext, AsyncAppContext, Context, Entity, EntityId, EventEmitter, Model, ModelContext,
Task, WeakModel, Task, WeakModel,
}; };
use language2::{ use language::{
language_settings::{all_language_settings, language_settings}, language_settings::{all_language_settings, language_settings},
point_from_lsp, point_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, Language, point_from_lsp, point_to_lsp, Anchor, Bias, Buffer, BufferSnapshot, Language,
LanguageServerName, PointUtf16, ToPointUtf16, LanguageServerName, PointUtf16, ToPointUtf16,
}; };
use lsp2::{LanguageServer, LanguageServerBinary, LanguageServerId}; use lsp::{LanguageServer, LanguageServerBinary, LanguageServerId};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use parking_lot::Mutex; use parking_lot::Mutex;
use request::StatusNotification; use request::StatusNotification;
use settings2::SettingsStore; use settings::SettingsStore;
use smol::{fs, io::BufReader, stream::StreamExt}; use smol::{fs, io::BufReader, stream::StreamExt};
use std::{ use std::{
ffi::OsString, ffi::OsString,
@ -172,11 +172,11 @@ impl Status {
} }
struct RegisteredBuffer { struct RegisteredBuffer {
uri: lsp2::Url, uri: lsp::Url,
language_id: String, language_id: String,
snapshot: BufferSnapshot, snapshot: BufferSnapshot,
snapshot_version: i32, snapshot_version: i32,
_subscriptions: [gpui2::Subscription; 2], _subscriptions: [gpui::Subscription; 2],
pending_buffer_change: Task<Option<()>>, pending_buffer_change: Task<Option<()>>,
} }
@ -220,8 +220,8 @@ impl RegisteredBuffer {
let new_text = new_snapshot let new_text = new_snapshot
.text_for_range(edit.new.start.1..edit.new.end.1) .text_for_range(edit.new.start.1..edit.new.end.1)
.collect(); .collect();
lsp2::TextDocumentContentChangeEvent { lsp::TextDocumentContentChangeEvent {
range: Some(lsp2::Range::new( range: Some(lsp::Range::new(
point_to_lsp(edit_start), point_to_lsp(edit_start),
point_to_lsp(edit_end), point_to_lsp(edit_end),
)), )),
@ -243,9 +243,9 @@ impl RegisteredBuffer {
buffer.snapshot = new_snapshot; buffer.snapshot = new_snapshot;
server server
.lsp .lsp
.notify::<lsp2::notification::DidChangeTextDocument>( .notify::<lsp::notification::DidChangeTextDocument>(
lsp2::DidChangeTextDocumentParams { lsp::DidChangeTextDocumentParams {
text_document: lsp2::VersionedTextDocumentIdentifier::new( text_document: lsp::VersionedTextDocumentIdentifier::new(
buffer.uri.clone(), buffer.uri.clone(),
buffer.snapshot_version, buffer.snapshot_version,
), ),
@ -280,7 +280,7 @@ pub struct Copilot {
server: CopilotServer, server: CopilotServer,
buffers: HashSet<WeakModel<Buffer>>, buffers: HashSet<WeakModel<Buffer>>,
server_id: LanguageServerId, server_id: LanguageServerId,
_subscription: gpui2::Subscription, _subscription: gpui::Subscription,
} }
pub enum Event { pub enum Event {
@ -608,13 +608,13 @@ impl Copilot {
registered_buffers registered_buffers
.entry(buffer.entity_id()) .entry(buffer.entity_id())
.or_insert_with(|| { .or_insert_with(|| {
let uri: lsp2::Url = uri_for_buffer(buffer, cx); let uri: lsp::Url = uri_for_buffer(buffer, cx);
let language_id = id_for_language(buffer.read(cx).language()); let language_id = id_for_language(buffer.read(cx).language());
let snapshot = buffer.read(cx).snapshot(); let snapshot = buffer.read(cx).snapshot();
server server
.notify::<lsp2::notification::DidOpenTextDocument>( .notify::<lsp::notification::DidOpenTextDocument>(
lsp2::DidOpenTextDocumentParams { lsp::DidOpenTextDocumentParams {
text_document: lsp2::TextDocumentItem { text_document: lsp::TextDocumentItem {
uri: uri.clone(), uri: uri.clone(),
language_id: language_id.clone(), language_id: language_id.clone(),
version: 0, version: 0,
@ -647,29 +647,29 @@ impl Copilot {
fn handle_buffer_event( fn handle_buffer_event(
&mut self, &mut self,
buffer: Model<Buffer>, buffer: Model<Buffer>,
event: &language2::Event, event: &language::Event,
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) -> Result<()> { ) -> Result<()> {
if let Ok(server) = self.server.as_running() { if let Ok(server) = self.server.as_running() {
if let Some(registered_buffer) = server.registered_buffers.get_mut(&buffer.entity_id()) if let Some(registered_buffer) = server.registered_buffers.get_mut(&buffer.entity_id())
{ {
match event { match event {
language2::Event::Edited => { language::Event::Edited => {
let _ = registered_buffer.report_changes(&buffer, cx); let _ = registered_buffer.report_changes(&buffer, cx);
} }
language2::Event::Saved => { language::Event::Saved => {
server server
.lsp .lsp
.notify::<lsp2::notification::DidSaveTextDocument>( .notify::<lsp::notification::DidSaveTextDocument>(
lsp2::DidSaveTextDocumentParams { lsp::DidSaveTextDocumentParams {
text_document: lsp2::TextDocumentIdentifier::new( text_document: lsp::TextDocumentIdentifier::new(
registered_buffer.uri.clone(), registered_buffer.uri.clone(),
), ),
text: None, text: None,
}, },
)?; )?;
} }
language2::Event::FileHandleChanged | language2::Event::LanguageChanged => { language::Event::FileHandleChanged | language::Event::LanguageChanged => {
let new_language_id = id_for_language(buffer.read(cx).language()); let new_language_id = id_for_language(buffer.read(cx).language());
let new_uri = uri_for_buffer(&buffer, cx); let new_uri = uri_for_buffer(&buffer, cx);
if new_uri != registered_buffer.uri if new_uri != registered_buffer.uri
@ -679,16 +679,16 @@ impl Copilot {
registered_buffer.language_id = new_language_id; registered_buffer.language_id = new_language_id;
server server
.lsp .lsp
.notify::<lsp2::notification::DidCloseTextDocument>( .notify::<lsp::notification::DidCloseTextDocument>(
lsp2::DidCloseTextDocumentParams { lsp::DidCloseTextDocumentParams {
text_document: lsp2::TextDocumentIdentifier::new(old_uri), text_document: lsp::TextDocumentIdentifier::new(old_uri),
}, },
)?; )?;
server server
.lsp .lsp
.notify::<lsp2::notification::DidOpenTextDocument>( .notify::<lsp::notification::DidOpenTextDocument>(
lsp2::DidOpenTextDocumentParams { lsp::DidOpenTextDocumentParams {
text_document: lsp2::TextDocumentItem::new( text_document: lsp::TextDocumentItem::new(
registered_buffer.uri.clone(), registered_buffer.uri.clone(),
registered_buffer.language_id.clone(), registered_buffer.language_id.clone(),
registered_buffer.snapshot_version, registered_buffer.snapshot_version,
@ -711,9 +711,9 @@ impl Copilot {
if let Some(buffer) = server.registered_buffers.remove(&buffer.entity_id()) { if let Some(buffer) = server.registered_buffers.remove(&buffer.entity_id()) {
server server
.lsp .lsp
.notify::<lsp2::notification::DidCloseTextDocument>( .notify::<lsp::notification::DidCloseTextDocument>(
lsp2::DidCloseTextDocumentParams { lsp::DidCloseTextDocumentParams {
text_document: lsp2::TextDocumentIdentifier::new(buffer.uri), text_document: lsp::TextDocumentIdentifier::new(buffer.uri),
}, },
) )
.log_err(); .log_err();
@ -798,7 +798,7 @@ impl Copilot {
) -> Task<Result<Vec<Completion>>> ) -> Task<Result<Vec<Completion>>>
where where
R: 'static R: 'static
+ lsp2::request::Request< + lsp::request::Request<
Params = request::GetCompletionsParams, Params = request::GetCompletionsParams,
Result = request::GetCompletionsResult, Result = request::GetCompletionsResult,
>, >,
@ -926,9 +926,9 @@ fn id_for_language(language: Option<&Arc<Language>>) -> String {
} }
} }
fn uri_for_buffer(buffer: &Model<Buffer>, cx: &AppContext) -> lsp2::Url { fn uri_for_buffer(buffer: &Model<Buffer>, cx: &AppContext) -> lsp::Url {
if let Some(file) = buffer.read(cx).file().and_then(|file| file.as_local()) { if let Some(file) = buffer.read(cx).file().and_then(|file| file.as_local()) {
lsp2::Url::from_file_path(file.abs_path(cx)).unwrap() lsp::Url::from_file_path(file.abs_path(cx)).unwrap()
} else { } else {
format!("buffer://{}", buffer.entity_id()).parse().unwrap() format!("buffer://{}", buffer.entity_id()).parse().unwrap()
} }

View file

@ -8,7 +8,7 @@ pub struct CheckStatusParams {
pub local_checks_only: bool, pub local_checks_only: bool,
} }
impl lsp2::request::Request for CheckStatus { impl lsp::request::Request for CheckStatus {
type Params = CheckStatusParams; type Params = CheckStatusParams;
type Result = SignInStatus; type Result = SignInStatus;
const METHOD: &'static str = "checkStatus"; const METHOD: &'static str = "checkStatus";
@ -33,7 +33,7 @@ pub struct PromptUserDeviceFlow {
pub verification_uri: String, pub verification_uri: String,
} }
impl lsp2::request::Request for SignInInitiate { impl lsp::request::Request for SignInInitiate {
type Params = SignInInitiateParams; type Params = SignInInitiateParams;
type Result = SignInInitiateResult; type Result = SignInInitiateResult;
const METHOD: &'static str = "signInInitiate"; const METHOD: &'static str = "signInInitiate";
@ -66,7 +66,7 @@ pub enum SignInStatus {
NotSignedIn, NotSignedIn,
} }
impl lsp2::request::Request for SignInConfirm { impl lsp::request::Request for SignInConfirm {
type Params = SignInConfirmParams; type Params = SignInConfirmParams;
type Result = SignInStatus; type Result = SignInStatus;
const METHOD: &'static str = "signInConfirm"; const METHOD: &'static str = "signInConfirm";
@ -82,7 +82,7 @@ pub struct SignOutParams {}
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct SignOutResult {} pub struct SignOutResult {}
impl lsp2::request::Request for SignOut { impl lsp::request::Request for SignOut {
type Params = SignOutParams; type Params = SignOutParams;
type Result = SignOutResult; type Result = SignOutResult;
const METHOD: &'static str = "signOut"; const METHOD: &'static str = "signOut";
@ -102,9 +102,9 @@ pub struct GetCompletionsDocument {
pub tab_size: u32, pub tab_size: u32,
pub indent_size: u32, pub indent_size: u32,
pub insert_spaces: bool, pub insert_spaces: bool,
pub uri: lsp2::Url, pub uri: lsp::Url,
pub relative_path: String, pub relative_path: String,
pub position: lsp2::Position, pub position: lsp::Position,
pub version: usize, pub version: usize,
} }
@ -118,13 +118,13 @@ pub struct GetCompletionsResult {
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct Completion { pub struct Completion {
pub text: String, pub text: String,
pub position: lsp2::Position, pub position: lsp::Position,
pub uuid: String, pub uuid: String,
pub range: lsp2::Range, pub range: lsp::Range,
pub display_text: String, pub display_text: String,
} }
impl lsp2::request::Request for GetCompletions { impl lsp::request::Request for GetCompletions {
type Params = GetCompletionsParams; type Params = GetCompletionsParams;
type Result = GetCompletionsResult; type Result = GetCompletionsResult;
const METHOD: &'static str = "getCompletions"; const METHOD: &'static str = "getCompletions";
@ -132,7 +132,7 @@ impl lsp2::request::Request for GetCompletions {
pub enum GetCompletionsCycling {} pub enum GetCompletionsCycling {}
impl lsp2::request::Request for GetCompletionsCycling { impl lsp::request::Request for GetCompletionsCycling {
type Params = GetCompletionsParams; type Params = GetCompletionsParams;
type Result = GetCompletionsResult; type Result = GetCompletionsResult;
const METHOD: &'static str = "getCompletionsCycling"; const METHOD: &'static str = "getCompletionsCycling";
@ -149,7 +149,7 @@ pub struct LogMessageParams {
pub extra: Vec<String>, pub extra: Vec<String>,
} }
impl lsp2::notification::Notification for LogMessage { impl lsp::notification::Notification for LogMessage {
type Params = LogMessageParams; type Params = LogMessageParams;
const METHOD: &'static str = "LogMessage"; const METHOD: &'static str = "LogMessage";
} }
@ -162,7 +162,7 @@ pub struct StatusNotificationParams {
pub status: String, // One of Normal/InProgress pub status: String, // One of Normal/InProgress
} }
impl lsp2::notification::Notification for StatusNotification { impl lsp::notification::Notification for StatusNotification {
type Params = StatusNotificationParams; type Params = StatusNotificationParams;
const METHOD: &'static str = "statusNotification"; const METHOD: &'static str = "statusNotification";
} }
@ -176,7 +176,7 @@ pub struct SetEditorInfoParams {
pub editor_plugin_info: EditorPluginInfo, pub editor_plugin_info: EditorPluginInfo,
} }
impl lsp2::request::Request for SetEditorInfo { impl lsp::request::Request for SetEditorInfo {
type Params = SetEditorInfoParams; type Params = SetEditorInfoParams;
type Result = String; type Result = String;
const METHOD: &'static str = "setEditorInfo"; const METHOD: &'static str = "setEditorInfo";
@ -204,7 +204,7 @@ pub struct NotifyAcceptedParams {
pub uuid: String, pub uuid: String,
} }
impl lsp2::request::Request for NotifyAccepted { impl lsp::request::Request for NotifyAccepted {
type Params = NotifyAcceptedParams; type Params = NotifyAcceptedParams;
type Result = String; type Result = String;
const METHOD: &'static str = "notifyAccepted"; const METHOD: &'static str = "notifyAccepted";
@ -218,7 +218,7 @@ pub struct NotifyRejectedParams {
pub uuids: Vec<String>, pub uuids: Vec<String>,
} }
impl lsp2::request::Request for NotifyRejected { impl lsp::request::Request for NotifyRejected {
type Params = NotifyRejectedParams; type Params = NotifyRejectedParams;
type Result = String; type Result = String;
const METHOD: &'static str = "notifyRejected"; const METHOD: &'static str = "notifyRejected";

View file

@ -13,7 +13,7 @@ test-support = []
[dependencies] [dependencies]
collections = { path = "../collections" } collections = { path = "../collections" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
sqlez = { path = "../sqlez" } sqlez = { path = "../sqlez" }
sqlez_macros = { path = "../sqlez_macros" } sqlez_macros = { path = "../sqlez_macros" }
util = { path = "../util" } util = { path = "../util" }
@ -28,6 +28,6 @@ serde_derive.workspace = true
smol.workspace = true smol.workspace = true
[dev-dependencies] [dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
env_logger.workspace = true env_logger.workspace = true
tempdir.workspace = true tempdir.workspace = true

View file

@ -4,7 +4,7 @@ pub mod query;
// Re-export // Re-export
pub use anyhow; pub use anyhow;
use anyhow::Context; use anyhow::Context;
use gpui2::AppContext; use gpui::AppContext;
pub use indoc::indoc; pub use indoc::indoc;
pub use lazy_static; pub use lazy_static;
pub use smol; pub use smol;
@ -201,7 +201,7 @@ mod tests {
use crate::open_db; use crate::open_db;
// Test bad migration panics // Test bad migration panics
#[gpui2::test] #[gpui::test]
#[should_panic] #[should_panic]
async fn test_bad_migration_panics() { async fn test_bad_migration_panics() {
enum BadDB {} enum BadDB {}
@ -225,8 +225,8 @@ mod tests {
} }
/// Test that DB exists but corrupted (causing recreate) /// Test that DB exists but corrupted (causing recreate)
#[gpui2::test] #[gpui::test]
async fn test_db_corruption(cx: &mut gpui2::TestAppContext) { async fn test_db_corruption(cx: &mut gpui::TestAppContext) {
cx.executor().allow_parking(); cx.executor().allow_parking();
enum CorruptedDB {} enum CorruptedDB {}
@ -269,8 +269,8 @@ mod tests {
} }
/// Test that DB exists but corrupted (causing recreate) /// Test that DB exists but corrupted (causing recreate)
#[gpui2::test(iterations = 30)] #[gpui::test(iterations = 30)]
async fn test_simultaneous_db_corruption(cx: &mut gpui2::TestAppContext) { async fn test_simultaneous_db_corruption(cx: &mut gpui::TestAppContext) {
cx.executor().allow_parking(); cx.executor().allow_parking();
enum CorruptedDB {} enum CorruptedDB {}

View file

@ -35,7 +35,7 @@ impl KeyValueStore {
mod tests { mod tests {
use crate::kvp::KeyValueStore; use crate::kvp::KeyValueStore;
#[gpui2::test] #[gpui::test]
async fn test_kvp() { async fn test_kvp() {
let db = KeyValueStore(crate::open_test_db("test_kvp").await); let db = KeyValueStore(crate::open_test_db("test_kvp").await);

View file

@ -8,5 +8,5 @@ publish = false
path = "src/feature_flags2.rs" path = "src/feature_flags2.rs"
[dependencies] [dependencies]
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
anyhow.workspace = true anyhow.workspace = true

View file

@ -1,4 +1,4 @@
use gpui2::{AppContext, Subscription, ViewContext}; use gpui::{AppContext, Subscription, ViewContext};
#[derive(Default)] #[derive(Default)]
struct FeatureFlags { struct FeatureFlags {

View file

@ -31,10 +31,10 @@ log.workspace = true
libc = "0.2" libc = "0.2"
time.workspace = true time.workspace = true
gpui2 = { path = "../gpui2", optional = true} gpui = { package = "gpui2", path = "../gpui2", optional = true}
[dev-dependencies] [dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
[features] [features]
test-support = ["gpui2/test-support"] test-support = ["gpui/test-support"]

View file

@ -288,7 +288,7 @@ impl Fs for RealFs {
pub struct FakeFs { pub struct FakeFs {
// Use an unfair lock to ensure tests are deterministic. // Use an unfair lock to ensure tests are deterministic.
state: Mutex<FakeFsState>, state: Mutex<FakeFsState>,
executor: gpui2::BackgroundExecutor, executor: gpui::BackgroundExecutor,
} }
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
@ -434,7 +434,7 @@ lazy_static::lazy_static! {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
impl FakeFs { impl FakeFs {
pub fn new(executor: gpui2::BackgroundExecutor) -> Arc<Self> { pub fn new(executor: gpui::BackgroundExecutor) -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
executor, executor,
state: Mutex::new(FakeFsState { state: Mutex::new(FakeFsState {
@ -1222,10 +1222,10 @@ pub fn copy_recursive<'a>(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use gpui2::BackgroundExecutor; use gpui::BackgroundExecutor;
use serde_json::json; use serde_json::json;
#[gpui2::test] #[gpui::test]
async fn test_fake_fs(executor: BackgroundExecutor) { async fn test_fake_fs(executor: BackgroundExecutor) {
let fs = FakeFs::new(executor.clone()); let fs = FakeFs::new(executor.clone());
fs.insert_tree( fs.insert_tree(

View file

@ -9,5 +9,5 @@ path = "src/fuzzy2.rs"
doctest = false doctest = false
[dependencies] [dependencies]
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
util = { path = "../util" } util = { path = "../util" }

View file

@ -1,4 +1,4 @@
use gpui2::BackgroundExecutor; use gpui::BackgroundExecutor;
use std::{ use std::{
borrow::Cow, borrow::Cow,
cmp::{self, Ordering}, cmp::{self, Ordering},

View file

@ -2,7 +2,7 @@ use crate::{
matcher::{Match, MatchCandidate, Matcher}, matcher::{Match, MatchCandidate, Matcher},
CharBag, CharBag,
}; };
use gpui2::BackgroundExecutor; use gpui::BackgroundExecutor;
use std::{ use std::{
borrow::Cow, borrow::Cow,
cmp::{self, Ordering}, cmp::{self, Ordering},

View file

@ -90,7 +90,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
continue; continue;
} }
Some("BackgroundExecutor") => { Some("BackgroundExecutor") => {
inner_fn_args.extend(quote!(gpui2::BackgroundExecutor::new( inner_fn_args.extend(quote!(gpui::BackgroundExecutor::new(
std::sync::Arc::new(dispatcher.clone()), std::sync::Arc::new(dispatcher.clone()),
),)); ),));
continue; continue;
@ -105,7 +105,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
{ {
let cx_varname = format_ident!("cx_{}", ix); let cx_varname = format_ident!("cx_{}", ix);
cx_vars.extend(quote!( cx_vars.extend(quote!(
let mut #cx_varname = gpui2::TestAppContext::new( let mut #cx_varname = gpui::TestAppContext::new(
dispatcher.clone() dispatcher.clone()
); );
)); ));
@ -130,11 +130,11 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
fn #outer_fn_name() { fn #outer_fn_name() {
#inner_fn #inner_fn
gpui2::run_test( gpui::run_test(
#num_iterations as u64, #num_iterations as u64,
#max_retries, #max_retries,
&mut |dispatcher, _seed| { &mut |dispatcher, _seed| {
let executor = gpui2::BackgroundExecutor::new(std::sync::Arc::new(dispatcher.clone())); let executor = gpui::BackgroundExecutor::new(std::sync::Arc::new(dispatcher.clone()));
#cx_vars #cx_vars
executor.block_test(#inner_fn_name(#inner_fn_args)); executor.block_test(#inner_fn_name(#inner_fn_args));
#cx_teardowns #cx_teardowns
@ -167,7 +167,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
let cx_varname = format_ident!("cx_{}", ix); let cx_varname = format_ident!("cx_{}", ix);
let cx_varname_lock = format_ident!("cx_{}_lock", ix); let cx_varname_lock = format_ident!("cx_{}_lock", ix);
cx_vars.extend(quote!( cx_vars.extend(quote!(
let mut #cx_varname = gpui2::TestAppContext::new( let mut #cx_varname = gpui::TestAppContext::new(
dispatcher.clone() dispatcher.clone()
); );
let mut #cx_varname_lock = #cx_varname.app.borrow_mut(); let mut #cx_varname_lock = #cx_varname.app.borrow_mut();
@ -182,7 +182,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
Some("TestAppContext") => { Some("TestAppContext") => {
let cx_varname = format_ident!("cx_{}", ix); let cx_varname = format_ident!("cx_{}", ix);
cx_vars.extend(quote!( cx_vars.extend(quote!(
let mut #cx_varname = gpui2::TestAppContext::new( let mut #cx_varname = gpui::TestAppContext::new(
dispatcher.clone() dispatcher.clone()
); );
)); ));
@ -209,7 +209,7 @@ pub fn test(args: TokenStream, function: TokenStream) -> TokenStream {
fn #outer_fn_name() { fn #outer_fn_name() {
#inner_fn #inner_fn
gpui2::run_test( gpui::run_test(
#num_iterations as u64, #num_iterations as u64,
#max_retries, #max_retries,
&mut |dispatcher, _seed| { &mut |dispatcher, _seed| {

View file

@ -14,5 +14,5 @@ test-support = []
smol.workspace = true smol.workspace = true
anyhow.workspace = true anyhow.workspace = true
log.workspace = true log.workspace = true
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
util = { path = "../util" } util = { path = "../util" }

View file

@ -1,5 +1,5 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use gpui2::AsyncAppContext; use gpui::AsyncAppContext;
use std::path::Path; use std::path::Path;
use util::ResultExt; use util::ResultExt;

View file

@ -10,7 +10,7 @@ doctest = false
[dependencies] [dependencies]
editor = { path = "../editor" } editor = { path = "../editor" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
util = { path = "../util" } util = { path = "../util" }
workspace = { path = "../workspace" } workspace = { path = "../workspace" }
settings2 = { path = "../settings2" } settings2 = { path = "../settings2" }

View file

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use chrono::{Datelike, Local, NaiveTime, Timelike}; use chrono::{Datelike, Local, NaiveTime, Timelike};
use gpui2::AppContext; use gpui::AppContext;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings2::Settings; use settings2::Settings;

View file

@ -11,28 +11,28 @@ doctest = false
[features] [features]
test-support = [ test-support = [
"rand", "rand",
"client2/test-support", "client/test-support",
"collections/test-support", "collections/test-support",
"lsp2/test-support", "lsp/test-support",
"text/test-support", "text/test-support",
"tree-sitter-rust", "tree-sitter-rust",
"tree-sitter-typescript", "tree-sitter-typescript",
"settings2/test-support", "settings/test-support",
"util/test-support", "util/test-support",
] ]
[dependencies] [dependencies]
clock = { path = "../clock" } clock = { path = "../clock" }
collections = { path = "../collections" } collections = { path = "../collections" }
fuzzy2 = { path = "../fuzzy2" } fuzzy = { package = "fuzzy2", path = "../fuzzy2" }
git = { path = "../git" } git = { path = "../git" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
lsp2 = { path = "../lsp2" } lsp = { package = "lsp2", path = "../lsp2" }
rpc2 = { path = "../rpc2" } rpc = { package = "rpc2", path = "../rpc2" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
text = { path = "../text" } text = { path = "../text" }
theme2 = { path = "../theme2" } theme = { package = "theme2", path = "../theme2" }
util = { path = "../util" } util = { path = "../util" }
anyhow.workspace = true anyhow.workspace = true
@ -60,12 +60,12 @@ tree-sitter-rust = { workspace = true, optional = true }
tree-sitter-typescript = { workspace = true, optional = true } tree-sitter-typescript = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
client2 = { path = "../client2", features = ["test-support"] } client = { package = "client2", path = "../client2", features = ["test-support"] }
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
lsp2 = { path = "../lsp2", features = ["test-support"] } lsp = { package = "lsp2", path = "../lsp2", features = ["test-support"] }
text = { path = "../text", features = ["test-support"] } text = { path = "../text", features = ["test-support"] }
settings2 = { path = "../settings2", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true env_logger.workspace = true

View file

@ -16,8 +16,8 @@ use crate::{
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
pub use clock::ReplicaId; pub use clock::ReplicaId;
use futures::FutureExt as _; use futures::FutureExt as _;
use gpui2::{AppContext, EventEmitter, HighlightStyle, ModelContext, Task}; use gpui::{AppContext, EventEmitter, HighlightStyle, ModelContext, Task};
use lsp2::LanguageServerId; use lsp::LanguageServerId;
use parking_lot::Mutex; use parking_lot::Mutex;
use similar::{ChangeTag, TextDiff}; use similar::{ChangeTag, TextDiff};
use smallvec::SmallVec; use smallvec::SmallVec;
@ -40,7 +40,7 @@ use std::{
use sum_tree::TreeMap; use sum_tree::TreeMap;
use text::operation_queue::OperationQueue; use text::operation_queue::OperationQueue;
pub use text::{Buffer as TextBuffer, BufferSnapshot as TextBufferSnapshot, *}; pub use text::{Buffer as TextBuffer, BufferSnapshot as TextBufferSnapshot, *};
use theme2::SyntaxTheme; use theme::SyntaxTheme;
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
use util::RandomCharIter; use util::RandomCharIter;
use util::{RangeExt, TryFutureExt as _}; use util::{RangeExt, TryFutureExt as _};
@ -48,7 +48,7 @@ use util::{RangeExt, TryFutureExt as _};
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
pub use {tree_sitter_rust, tree_sitter_typescript}; pub use {tree_sitter_rust, tree_sitter_typescript};
pub use lsp2::DiagnosticSeverity; pub use lsp::DiagnosticSeverity;
pub struct Buffer { pub struct Buffer {
text: TextBuffer, text: TextBuffer,
@ -149,14 +149,14 @@ pub struct Completion {
pub new_text: String, pub new_text: String,
pub label: CodeLabel, pub label: CodeLabel,
pub server_id: LanguageServerId, pub server_id: LanguageServerId,
pub lsp_completion: lsp2::CompletionItem, pub lsp_completion: lsp::CompletionItem,
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct CodeAction { pub struct CodeAction {
pub server_id: LanguageServerId, pub server_id: LanguageServerId,
pub range: Range<Anchor>, pub range: Range<Anchor>,
pub lsp_action: lsp2::CodeAction, pub lsp_action: lsp::CodeAction,
} }
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
@ -226,7 +226,7 @@ pub trait File: Send + Sync {
fn as_any(&self) -> &dyn Any; fn as_any(&self) -> &dyn Any;
fn to_proto(&self) -> rpc2::proto::File; fn to_proto(&self) -> rpc::proto::File;
} }
pub trait LocalFile: File { pub trait LocalFile: File {
@ -375,7 +375,7 @@ impl Buffer {
file, file,
); );
this.text.set_line_ending(proto::deserialize_line_ending( this.text.set_line_ending(proto::deserialize_line_ending(
rpc2::proto::LineEnding::from_i32(message.line_ending) rpc::proto::LineEnding::from_i32(message.line_ending)
.ok_or_else(|| anyhow!("missing line_ending"))?, .ok_or_else(|| anyhow!("missing line_ending"))?,
)); ));
this.saved_version = proto::deserialize_version(&message.saved_version); this.saved_version = proto::deserialize_version(&message.saved_version);
@ -3003,14 +3003,14 @@ impl IndentSize {
impl Completion { impl Completion {
pub fn sort_key(&self) -> (usize, &str) { pub fn sort_key(&self) -> (usize, &str) {
let kind_key = match self.lsp_completion.kind { let kind_key = match self.lsp_completion.kind {
Some(lsp2::CompletionItemKind::VARIABLE) => 0, Some(lsp::CompletionItemKind::VARIABLE) => 0,
_ => 1, _ => 1,
}; };
(kind_key, &self.label.text[self.label.filter_range.clone()]) (kind_key, &self.label.text[self.label.filter_range.clone()])
} }
pub fn is_snippet(&self) -> bool { pub fn is_snippet(&self) -> bool {
self.lsp_completion.insert_text_format == Some(lsp2::InsertTextFormat::SNIPPET) self.lsp_completion.insert_text_format == Some(lsp::InsertTextFormat::SNIPPET)
} }
} }

View file

@ -5,13 +5,13 @@ use crate::language_settings::{
use crate::Buffer; use crate::Buffer;
use clock::ReplicaId; use clock::ReplicaId;
use collections::BTreeMap; use collections::BTreeMap;
use gpui2::{AppContext, Model}; use gpui::{AppContext, Model};
use gpui2::{Context, TestAppContext}; use gpui::{Context, TestAppContext};
use indoc::indoc; use indoc::indoc;
use proto::deserialize_operation; use proto::deserialize_operation;
use rand::prelude::*; use rand::prelude::*;
use regex::RegexBuilder; use regex::RegexBuilder;
use settings2::SettingsStore; use settings::SettingsStore;
use std::{ use std::{
env, env,
ops::Range, ops::Range,
@ -38,8 +38,8 @@ fn init_logger() {
} }
} }
#[gpui2::test] #[gpui::test]
fn test_line_endings(cx: &mut gpui2::AppContext) { fn test_line_endings(cx: &mut gpui::AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
cx.build_model(|cx| { cx.build_model(|cx| {
@ -63,7 +63,7 @@ fn test_line_endings(cx: &mut gpui2::AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_select_language() { fn test_select_language() {
let registry = Arc::new(LanguageRegistry::test()); let registry = Arc::new(LanguageRegistry::test());
registry.add(Arc::new(Language::new( registry.add(Arc::new(Language::new(
@ -132,8 +132,8 @@ fn test_select_language() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_edit_events(cx: &mut gpui2::AppContext) { fn test_edit_events(cx: &mut gpui::AppContext) {
let mut now = Instant::now(); let mut now = Instant::now();
let buffer_1_events = Arc::new(Mutex::new(Vec::new())); let buffer_1_events = Arc::new(Mutex::new(Vec::new()));
let buffer_2_events = Arc::new(Mutex::new(Vec::new())); let buffer_2_events = Arc::new(Mutex::new(Vec::new()));
@ -215,7 +215,7 @@ fn test_edit_events(cx: &mut gpui2::AppContext) {
); );
} }
#[gpui2::test] #[gpui::test]
async fn test_apply_diff(cx: &mut TestAppContext) { async fn test_apply_diff(cx: &mut TestAppContext) {
let text = "a\nbb\nccc\ndddd\neeeee\nffffff\n"; let text = "a\nbb\nccc\ndddd\neeeee\nffffff\n";
let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), text)); let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), text));
@ -238,8 +238,8 @@ async fn test_apply_diff(cx: &mut TestAppContext) {
}); });
} }
#[gpui2::test(iterations = 10)] #[gpui::test(iterations = 10)]
async fn test_normalize_whitespace(cx: &mut gpui2::TestAppContext) { async fn test_normalize_whitespace(cx: &mut gpui::TestAppContext) {
let text = [ let text = [
"zero", // "zero", //
"one ", // 2 trailing spaces "one ", // 2 trailing spaces
@ -311,8 +311,8 @@ async fn test_normalize_whitespace(cx: &mut gpui2::TestAppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
async fn test_reparse(cx: &mut gpui2::TestAppContext) { async fn test_reparse(cx: &mut gpui::TestAppContext) {
let text = "fn a() {}"; let text = "fn a() {}";
let buffer = cx.build_model(|cx| { let buffer = cx.build_model(|cx| {
Buffer::new(0, cx.entity_id().as_u64(), text).with_language(Arc::new(rust_lang()), cx) Buffer::new(0, cx.entity_id().as_u64(), text).with_language(Arc::new(rust_lang()), cx)
@ -440,8 +440,8 @@ async fn test_reparse(cx: &mut gpui2::TestAppContext) {
); );
} }
#[gpui2::test] #[gpui::test]
async fn test_resetting_language(cx: &mut gpui2::TestAppContext) { async fn test_resetting_language(cx: &mut gpui::TestAppContext) {
let buffer = cx.build_model(|cx| { let buffer = cx.build_model(|cx| {
let mut buffer = let mut buffer =
Buffer::new(0, cx.entity_id().as_u64(), "{}").with_language(Arc::new(rust_lang()), cx); Buffer::new(0, cx.entity_id().as_u64(), "{}").with_language(Arc::new(rust_lang()), cx);
@ -463,8 +463,8 @@ async fn test_resetting_language(cx: &mut gpui2::TestAppContext) {
assert_eq!(get_tree_sexp(&buffer, cx), "(document (object))"); assert_eq!(get_tree_sexp(&buffer, cx), "(document (object))");
} }
#[gpui2::test] #[gpui::test]
async fn test_outline(cx: &mut gpui2::TestAppContext) { async fn test_outline(cx: &mut gpui::TestAppContext) {
let text = r#" let text = r#"
struct Person { struct Person {
name: String, name: String,
@ -556,7 +556,7 @@ async fn test_outline(cx: &mut gpui2::TestAppContext) {
async fn search<'a>( async fn search<'a>(
outline: &'a Outline<Anchor>, outline: &'a Outline<Anchor>,
query: &'a str, query: &'a str,
cx: &'a gpui2::TestAppContext, cx: &'a gpui::TestAppContext,
) -> Vec<(&'a str, Vec<usize>)> { ) -> Vec<(&'a str, Vec<usize>)> {
let matches = cx let matches = cx
.update(|cx| outline.search(query, cx.background_executor().clone())) .update(|cx| outline.search(query, cx.background_executor().clone()))
@ -568,8 +568,8 @@ async fn test_outline(cx: &mut gpui2::TestAppContext) {
} }
} }
#[gpui2::test] #[gpui::test]
async fn test_outline_nodes_with_newlines(cx: &mut gpui2::TestAppContext) { async fn test_outline_nodes_with_newlines(cx: &mut gpui::TestAppContext) {
let text = r#" let text = r#"
impl A for B< impl A for B<
C C
@ -595,8 +595,8 @@ async fn test_outline_nodes_with_newlines(cx: &mut gpui2::TestAppContext) {
); );
} }
#[gpui2::test] #[gpui::test]
async fn test_outline_with_extra_context(cx: &mut gpui2::TestAppContext) { async fn test_outline_with_extra_context(cx: &mut gpui::TestAppContext) {
let language = javascript_lang() let language = javascript_lang()
.with_outline_query( .with_outline_query(
r#" r#"
@ -643,8 +643,8 @@ async fn test_outline_with_extra_context(cx: &mut gpui2::TestAppContext) {
); );
} }
#[gpui2::test] #[gpui::test]
async fn test_symbols_containing(cx: &mut gpui2::TestAppContext) { async fn test_symbols_containing(cx: &mut gpui::TestAppContext) {
let text = r#" let text = r#"
impl Person { impl Person {
fn one() { fn one() {
@ -731,7 +731,7 @@ async fn test_symbols_containing(cx: &mut gpui2::TestAppContext) {
} }
} }
#[gpui2::test] #[gpui::test]
fn test_enclosing_bracket_ranges(cx: &mut AppContext) { fn test_enclosing_bracket_ranges(cx: &mut AppContext) {
let mut assert = |selection_text, range_markers| { let mut assert = |selection_text, range_markers| {
assert_bracket_pairs(selection_text, range_markers, rust_lang(), cx) assert_bracket_pairs(selection_text, range_markers, rust_lang(), cx)
@ -847,7 +847,7 @@ fn test_enclosing_bracket_ranges(cx: &mut AppContext) {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_enclosing_bracket_ranges_where_brackets_are_not_outermost_children(cx: &mut AppContext) { fn test_enclosing_bracket_ranges_where_brackets_are_not_outermost_children(cx: &mut AppContext) {
let mut assert = |selection_text, bracket_pair_texts| { let mut assert = |selection_text, bracket_pair_texts| {
assert_bracket_pairs(selection_text, bracket_pair_texts, javascript_lang(), cx) assert_bracket_pairs(selection_text, bracket_pair_texts, javascript_lang(), cx)
@ -879,7 +879,7 @@ fn test_enclosing_bracket_ranges_where_brackets_are_not_outermost_children(cx: &
); );
} }
#[gpui2::test] #[gpui::test]
fn test_range_for_syntax_ancestor(cx: &mut AppContext) { fn test_range_for_syntax_ancestor(cx: &mut AppContext) {
cx.build_model(|cx| { cx.build_model(|cx| {
let text = "fn a() { b(|c| {}) }"; let text = "fn a() { b(|c| {}) }";
@ -918,7 +918,7 @@ fn test_range_for_syntax_ancestor(cx: &mut AppContext) {
} }
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_with_soft_tabs(cx: &mut AppContext) { fn test_autoindent_with_soft_tabs(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -959,7 +959,7 @@ fn test_autoindent_with_soft_tabs(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_with_hard_tabs(cx: &mut AppContext) { fn test_autoindent_with_hard_tabs(cx: &mut AppContext) {
init_settings(cx, |settings| { init_settings(cx, |settings| {
settings.defaults.hard_tabs = Some(true); settings.defaults.hard_tabs = Some(true);
@ -1002,7 +1002,7 @@ fn test_autoindent_with_hard_tabs(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut AppContext) { fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1143,7 +1143,7 @@ fn test_autoindent_does_not_adjust_lines_with_unchanged_suggestion(cx: &mut AppC
eprintln!("DONE"); eprintln!("DONE");
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_does_not_adjust_lines_within_newly_created_errors(cx: &mut AppContext) { fn test_autoindent_does_not_adjust_lines_within_newly_created_errors(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1205,7 +1205,7 @@ fn test_autoindent_does_not_adjust_lines_within_newly_created_errors(cx: &mut Ap
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut AppContext) { fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1262,7 +1262,7 @@ fn test_autoindent_adjusts_lines_when_only_text_changes(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_with_edit_at_end_of_buffer(cx: &mut AppContext) { fn test_autoindent_with_edit_at_end_of_buffer(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1280,7 +1280,7 @@ fn test_autoindent_with_edit_at_end_of_buffer(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_multi_line_insertion(cx: &mut AppContext) { fn test_autoindent_multi_line_insertion(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1322,7 +1322,7 @@ fn test_autoindent_multi_line_insertion(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_block_mode(cx: &mut AppContext) { fn test_autoindent_block_mode(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1406,7 +1406,7 @@ fn test_autoindent_block_mode(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut AppContext) { fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1486,7 +1486,7 @@ fn test_autoindent_block_mode_without_original_indent_columns(cx: &mut AppContex
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_language_without_indents_query(cx: &mut AppContext) { fn test_autoindent_language_without_indents_query(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1530,7 +1530,7 @@ fn test_autoindent_language_without_indents_query(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_with_injected_languages(cx: &mut AppContext) { fn test_autoindent_with_injected_languages(cx: &mut AppContext) {
init_settings(cx, |settings| { init_settings(cx, |settings| {
settings.languages.extend([ settings.languages.extend([
@ -1604,7 +1604,7 @@ fn test_autoindent_with_injected_languages(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_autoindent_query_with_outdent_captures(cx: &mut AppContext) { fn test_autoindent_query_with_outdent_captures(cx: &mut AppContext) {
init_settings(cx, |settings| { init_settings(cx, |settings| {
settings.defaults.tab_size = Some(2.try_into().unwrap()); settings.defaults.tab_size = Some(2.try_into().unwrap());
@ -1649,7 +1649,7 @@ fn test_autoindent_query_with_outdent_captures(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_language_scope_at_with_javascript(cx: &mut AppContext) { fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1738,7 +1738,7 @@ fn test_language_scope_at_with_javascript(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_language_scope_at_with_rust(cx: &mut AppContext) { fn test_language_scope_at_with_rust(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1806,7 +1806,7 @@ fn test_language_scope_at_with_rust(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_language_scope_at_with_combined_injections(cx: &mut AppContext) { fn test_language_scope_at_with_combined_injections(cx: &mut AppContext) {
init_settings(cx, |_| {}); init_settings(cx, |_| {});
@ -1854,8 +1854,8 @@ fn test_language_scope_at_with_combined_injections(cx: &mut AppContext) {
}); });
} }
#[gpui2::test] #[gpui::test]
fn test_serialization(cx: &mut gpui2::AppContext) { fn test_serialization(cx: &mut gpui::AppContext) {
let mut now = Instant::now(); let mut now = Instant::now();
let buffer1 = cx.build_model(|cx| { let buffer1 = cx.build_model(|cx| {
@ -1895,7 +1895,7 @@ fn test_serialization(cx: &mut gpui2::AppContext) {
assert_eq!(buffer2.read(cx).text(), "abcDF"); assert_eq!(buffer2.read(cx).text(), "abcDF");
} }
#[gpui2::test(iterations = 100)] #[gpui::test(iterations = 100)]
fn test_random_collaboration(cx: &mut AppContext, mut rng: StdRng) { fn test_random_collaboration(cx: &mut AppContext, mut rng: StdRng) {
let min_peers = env::var("MIN_PEERS") let min_peers = env::var("MIN_PEERS")
.map(|i| i.parse().expect("invalid `MIN_PEERS` variable")) .map(|i| i.parse().expect("invalid `MIN_PEERS` variable"))
@ -2199,7 +2199,7 @@ fn test_contiguous_ranges() {
); );
} }
#[gpui2::test(iterations = 500)] #[gpui::test(iterations = 500)]
fn test_trailing_whitespace_ranges(mut rng: StdRng) { fn test_trailing_whitespace_ranges(mut rng: StdRng) {
// Generate a random multi-line string containing // Generate a random multi-line string containing
// some lines with trailing whitespace. // some lines with trailing whitespace.
@ -2400,7 +2400,7 @@ fn javascript_lang() -> Language {
.unwrap() .unwrap()
} }
fn get_tree_sexp(buffer: &Model<Buffer>, cx: &mut gpui2::TestAppContext) -> String { fn get_tree_sexp(buffer: &Model<Buffer>, cx: &mut gpui::TestAppContext) -> String {
buffer.update(cx, |buffer, _| { buffer.update(cx, |buffer, _| {
let snapshot = buffer.snapshot(); let snapshot = buffer.snapshot();
let layers = snapshot.syntax.layers(buffer.as_text_snapshot()); let layers = snapshot.syntax.layers(buffer.as_text_snapshot());

View file

@ -1,6 +1,6 @@
use crate::Diagnostic; use crate::Diagnostic;
use collections::HashMap; use collections::HashMap;
use lsp2::LanguageServerId; use lsp::LanguageServerId;
use std::{ use std::{
cmp::{Ordering, Reverse}, cmp::{Ordering, Reverse},
iter, iter,
@ -37,14 +37,14 @@ pub struct Summary {
impl<T> DiagnosticEntry<T> { impl<T> DiagnosticEntry<T> {
// Used to provide diagnostic context to lsp codeAction request // Used to provide diagnostic context to lsp codeAction request
pub fn to_lsp_diagnostic_stub(&self) -> lsp2::Diagnostic { pub fn to_lsp_diagnostic_stub(&self) -> lsp::Diagnostic {
let code = self let code = self
.diagnostic .diagnostic
.code .code
.clone() .clone()
.map(lsp2::NumberOrString::String); .map(lsp::NumberOrString::String);
lsp2::Diagnostic { lsp::Diagnostic {
code, code,
severity: Some(self.diagnostic.severity), severity: Some(self.diagnostic.severity),
..Default::default() ..Default::default()

View file

@ -1,6 +1,6 @@
use gpui2::HighlightStyle; use gpui::HighlightStyle;
use std::sync::Arc; use std::sync::Arc;
use theme2::SyntaxTheme; use theme::SyntaxTheme;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct HighlightMap(Arc<[HighlightId]>); pub struct HighlightMap(Arc<[HighlightId]>);
@ -79,7 +79,7 @@ impl Default for HighlightId {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use gpui2::rgba; use gpui::rgba;
#[test] #[test]
fn test_highlight_map() { fn test_highlight_map() {

View file

@ -17,10 +17,10 @@ use futures::{
future::{BoxFuture, Shared}, future::{BoxFuture, Shared},
FutureExt, TryFutureExt as _, FutureExt, TryFutureExt as _,
}; };
use gpui2::{AppContext, AsyncAppContext, BackgroundExecutor, Task}; use gpui::{AppContext, AsyncAppContext, BackgroundExecutor, Task};
pub use highlight_map::HighlightMap; pub use highlight_map::HighlightMap;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use lsp2::{CodeActionKind, LanguageServerBinary}; use lsp::{CodeActionKind, LanguageServerBinary};
use parking_lot::{Mutex, RwLock}; use parking_lot::{Mutex, RwLock};
use postage::watch; use postage::watch;
use regex::Regex; use regex::Regex;
@ -42,7 +42,7 @@ use std::{
}, },
}; };
use syntax_map::SyntaxSnapshot; use syntax_map::SyntaxSnapshot;
use theme2::{SyntaxTheme, ThemeVariant}; use theme::{SyntaxTheme, ThemeVariant};
use tree_sitter::{self, Query}; use tree_sitter::{self, Query};
use unicase::UniCase; use unicase::UniCase;
use util::{http::HttpClient, paths::PathExt}; use util::{http::HttpClient, paths::PathExt};
@ -51,7 +51,7 @@ use util::{post_inc, ResultExt, TryFutureExt as _, UnwrapFuture};
pub use buffer::Operation; pub use buffer::Operation;
pub use buffer::*; pub use buffer::*;
pub use diagnostic_set::DiagnosticEntry; pub use diagnostic_set::DiagnosticEntry;
pub use lsp2::LanguageServerId; pub use lsp::LanguageServerId;
pub use outline::{Outline, OutlineItem}; pub use outline::{Outline, OutlineItem};
pub use syntax_map::{OwnedSyntaxLayerInfo, SyntaxLayerInfo}; pub use syntax_map::{OwnedSyntaxLayerInfo, SyntaxLayerInfo};
pub use text::LineEnding; pub use text::LineEnding;
@ -98,7 +98,7 @@ lazy_static! {
} }
pub trait ToLspPosition { pub trait ToLspPosition {
fn to_lsp_position(self) -> lsp2::Position; fn to_lsp_position(self) -> lsp::Position;
} }
#[derive(Clone, Debug, PartialEq, Eq, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
@ -203,17 +203,17 @@ impl CachedLspAdapter {
self.adapter.workspace_configuration(cx) self.adapter.workspace_configuration(cx)
} }
pub fn process_diagnostics(&self, params: &mut lsp2::PublishDiagnosticsParams) { pub fn process_diagnostics(&self, params: &mut lsp::PublishDiagnosticsParams) {
self.adapter.process_diagnostics(params) self.adapter.process_diagnostics(params)
} }
pub async fn process_completion(&self, completion_item: &mut lsp2::CompletionItem) { pub async fn process_completion(&self, completion_item: &mut lsp::CompletionItem) {
self.adapter.process_completion(completion_item).await self.adapter.process_completion(completion_item).await
} }
pub async fn label_for_completion( pub async fn label_for_completion(
&self, &self,
completion_item: &lsp2::CompletionItem, completion_item: &lsp::CompletionItem,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
self.adapter self.adapter
@ -224,7 +224,7 @@ impl CachedLspAdapter {
pub async fn label_for_symbol( pub async fn label_for_symbol(
&self, &self,
name: &str, name: &str,
kind: lsp2::SymbolKind, kind: lsp::SymbolKind,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
self.adapter.label_for_symbol(name, kind, language).await self.adapter.label_for_symbol(name, kind, language).await
@ -289,13 +289,13 @@ pub trait LspAdapter: 'static + Send + Sync {
container_dir: PathBuf, container_dir: PathBuf,
) -> Option<LanguageServerBinary>; ) -> Option<LanguageServerBinary>;
fn process_diagnostics(&self, _: &mut lsp2::PublishDiagnosticsParams) {} fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
async fn process_completion(&self, _: &mut lsp2::CompletionItem) {} async fn process_completion(&self, _: &mut lsp::CompletionItem) {}
async fn label_for_completion( async fn label_for_completion(
&self, &self,
_: &lsp2::CompletionItem, _: &lsp::CompletionItem,
_: &Arc<Language>, _: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
None None
@ -304,7 +304,7 @@ pub trait LspAdapter: 'static + Send + Sync {
async fn label_for_symbol( async fn label_for_symbol(
&self, &self,
_: &str, _: &str,
_: lsp2::SymbolKind, _: lsp::SymbolKind,
_: &Arc<Language>, _: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
None None
@ -476,8 +476,8 @@ fn deserialize_regex<'de, D: Deserializer<'de>>(d: D) -> Result<Option<Regex>, D
pub struct FakeLspAdapter { pub struct FakeLspAdapter {
pub name: &'static str, pub name: &'static str,
pub initialization_options: Option<Value>, pub initialization_options: Option<Value>,
pub capabilities: lsp2::ServerCapabilities, pub capabilities: lsp::ServerCapabilities,
pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp2::FakeLanguageServer)>>, pub initializer: Option<Box<dyn 'static + Send + Sync + Fn(&mut lsp::FakeLanguageServer)>>,
pub disk_based_diagnostics_progress_token: Option<String>, pub disk_based_diagnostics_progress_token: Option<String>,
pub disk_based_diagnostics_sources: Vec<String>, pub disk_based_diagnostics_sources: Vec<String>,
pub prettier_plugins: Vec<&'static str>, pub prettier_plugins: Vec<&'static str>,
@ -532,7 +532,7 @@ pub struct Language {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
fake_adapter: Option<( fake_adapter: Option<(
mpsc::UnboundedSender<lsp2::FakeLanguageServer>, mpsc::UnboundedSender<lsp::FakeLanguageServer>,
Arc<FakeLspAdapter>, Arc<FakeLspAdapter>,
)>, )>,
} }
@ -649,7 +649,7 @@ struct LanguageRegistryState {
pub struct PendingLanguageServer { pub struct PendingLanguageServer {
pub server_id: LanguageServerId, pub server_id: LanguageServerId,
pub task: Task<Result<lsp2::LanguageServer>>, pub task: Task<Result<lsp::LanguageServer>>,
pub container_dir: Option<Arc<Path>>, pub container_dir: Option<Arc<Path>>,
} }
@ -905,7 +905,7 @@ impl LanguageRegistry {
if language.fake_adapter.is_some() { if language.fake_adapter.is_some() {
let task = cx.spawn(|cx| async move { let task = cx.spawn(|cx| async move {
let (servers_tx, fake_adapter) = language.fake_adapter.as_ref().unwrap(); let (servers_tx, fake_adapter) = language.fake_adapter.as_ref().unwrap();
let (server, mut fake_server) = lsp2::LanguageServer::fake( let (server, mut fake_server) = lsp::LanguageServer::fake(
fake_adapter.name.to_string(), fake_adapter.name.to_string(),
fake_adapter.capabilities.clone(), fake_adapter.capabilities.clone(),
cx.clone(), cx.clone(),
@ -919,7 +919,7 @@ impl LanguageRegistry {
cx.background_executor() cx.background_executor()
.spawn(async move { .spawn(async move {
if fake_server if fake_server
.try_receive_notification::<lsp2::notification::Initialized>() .try_receive_notification::<lsp::notification::Initialized>()
.await .await
.is_some() .is_some()
{ {
@ -988,7 +988,7 @@ impl LanguageRegistry {
task.await?; task.await?;
} }
lsp2::LanguageServer::new( lsp::LanguageServer::new(
stderr_capture, stderr_capture,
server_id, server_id,
binary, binary,
@ -1471,7 +1471,7 @@ impl Language {
pub async fn set_fake_lsp_adapter( pub async fn set_fake_lsp_adapter(
&mut self, &mut self,
fake_lsp_adapter: Arc<FakeLspAdapter>, fake_lsp_adapter: Arc<FakeLspAdapter>,
) -> mpsc::UnboundedReceiver<lsp2::FakeLanguageServer> { ) -> mpsc::UnboundedReceiver<lsp::FakeLanguageServer> {
let (servers_tx, servers_rx) = mpsc::unbounded(); let (servers_tx, servers_rx) = mpsc::unbounded();
self.fake_adapter = Some((servers_tx, fake_lsp_adapter.clone())); self.fake_adapter = Some((servers_tx, fake_lsp_adapter.clone()));
let adapter = CachedLspAdapter::new(Arc::new(fake_lsp_adapter)).await; let adapter = CachedLspAdapter::new(Arc::new(fake_lsp_adapter)).await;
@ -1501,7 +1501,7 @@ impl Language {
None None
} }
pub async fn process_completion(self: &Arc<Self>, completion: &mut lsp2::CompletionItem) { pub async fn process_completion(self: &Arc<Self>, completion: &mut lsp::CompletionItem) {
for adapter in &self.adapters { for adapter in &self.adapters {
adapter.process_completion(completion).await; adapter.process_completion(completion).await;
} }
@ -1509,7 +1509,7 @@ impl Language {
pub async fn label_for_completion( pub async fn label_for_completion(
self: &Arc<Self>, self: &Arc<Self>,
completion: &lsp2::CompletionItem, completion: &lsp::CompletionItem,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
self.adapters self.adapters
.first() .first()
@ -1521,7 +1521,7 @@ impl Language {
pub async fn label_for_symbol( pub async fn label_for_symbol(
self: &Arc<Self>, self: &Arc<Self>,
name: &str, name: &str,
kind: lsp2::SymbolKind, kind: lsp::SymbolKind,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
self.adapters self.adapters
.first() .first()
@ -1745,7 +1745,7 @@ impl Default for FakeLspAdapter {
fn default() -> Self { fn default() -> Self {
Self { Self {
name: "the-fake-language-server", name: "the-fake-language-server",
capabilities: lsp2::LanguageServer::full_capabilities(), capabilities: lsp::LanguageServer::full_capabilities(),
initializer: None, initializer: None,
disk_based_diagnostics_progress_token: None, disk_based_diagnostics_progress_token: None,
initialization_options: None, initialization_options: None,
@ -1794,7 +1794,7 @@ impl LspAdapter for Arc<FakeLspAdapter> {
unreachable!(); unreachable!();
} }
fn process_diagnostics(&self, _: &mut lsp2::PublishDiagnosticsParams) {} fn process_diagnostics(&self, _: &mut lsp::PublishDiagnosticsParams) {}
async fn disk_based_diagnostic_sources(&self) -> Vec<String> { async fn disk_based_diagnostic_sources(&self) -> Vec<String> {
self.disk_based_diagnostics_sources.clone() self.disk_based_diagnostics_sources.clone()
@ -1824,22 +1824,22 @@ fn get_capture_indices(query: &Query, captures: &mut [(&str, &mut Option<u32>)])
} }
} }
pub fn point_to_lsp(point: PointUtf16) -> lsp2::Position { pub fn point_to_lsp(point: PointUtf16) -> lsp::Position {
lsp2::Position::new(point.row, point.column) lsp::Position::new(point.row, point.column)
} }
pub fn point_from_lsp(point: lsp2::Position) -> Unclipped<PointUtf16> { pub fn point_from_lsp(point: lsp::Position) -> Unclipped<PointUtf16> {
Unclipped(PointUtf16::new(point.line, point.character)) Unclipped(PointUtf16::new(point.line, point.character))
} }
pub fn range_to_lsp(range: Range<PointUtf16>) -> lsp2::Range { pub fn range_to_lsp(range: Range<PointUtf16>) -> lsp::Range {
lsp2::Range { lsp::Range {
start: point_to_lsp(range.start), start: point_to_lsp(range.start),
end: point_to_lsp(range.end), end: point_to_lsp(range.end),
} }
} }
pub fn range_from_lsp(range: lsp2::Range) -> Range<Unclipped<PointUtf16>> { pub fn range_from_lsp(range: lsp::Range) -> Range<Unclipped<PointUtf16>> {
let mut start = point_from_lsp(range.start); let mut start = point_from_lsp(range.start);
let mut end = point_from_lsp(range.end); let mut end = point_from_lsp(range.end);
if start > end { if start > end {
@ -1851,9 +1851,9 @@ pub fn range_from_lsp(range: lsp2::Range) -> Range<Unclipped<PointUtf16>> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use gpui2::TestAppContext; use gpui::TestAppContext;
#[gpui2::test(iterations = 10)] #[gpui::test(iterations = 10)]
async fn test_first_line_pattern(cx: &mut TestAppContext) { async fn test_first_line_pattern(cx: &mut TestAppContext) {
let mut languages = LanguageRegistry::test(); let mut languages = LanguageRegistry::test();
@ -1891,7 +1891,7 @@ mod tests {
); );
} }
#[gpui2::test(iterations = 10)] #[gpui::test(iterations = 10)]
async fn test_language_loading(cx: &mut TestAppContext) { async fn test_language_loading(cx: &mut TestAppContext) {
let mut languages = LanguageRegistry::test(); let mut languages = LanguageRegistry::test();
languages.set_executor(cx.executor().clone()); languages.set_executor(cx.executor().clone());

View file

@ -2,13 +2,13 @@ use crate::{File, Language};
use anyhow::Result; use anyhow::Result;
use collections::{HashMap, HashSet}; use collections::{HashMap, HashSet};
use globset::GlobMatcher; use globset::GlobMatcher;
use gpui2::AppContext; use gpui::AppContext;
use schemars::{ use schemars::{
schema::{InstanceType, ObjectValidation, Schema, SchemaObject}, schema::{InstanceType, ObjectValidation, Schema, SchemaObject},
JsonSchema, JsonSchema,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings2::Settings; use settings::Settings;
use std::{num::NonZeroU32, path::Path, sync::Arc}; use std::{num::NonZeroU32, path::Path, sync::Arc};
pub fn init(cx: &mut AppContext) { pub fn init(cx: &mut AppContext) {
@ -255,7 +255,7 @@ impl InlayHintKind {
} }
} }
impl settings2::Settings for AllLanguageSettings { impl settings::Settings for AllLanguageSettings {
const KEY: Option<&'static str> = None; const KEY: Option<&'static str> = None;
type FileContent = AllLanguageSettingsContent; type FileContent = AllLanguageSettingsContent;
@ -332,7 +332,7 @@ impl settings2::Settings for AllLanguageSettings {
fn json_schema( fn json_schema(
generator: &mut schemars::gen::SchemaGenerator, generator: &mut schemars::gen::SchemaGenerator,
params: &settings2::SettingsJsonSchemaParams, params: &settings::SettingsJsonSchemaParams,
_: &AppContext, _: &AppContext,
) -> schemars::schema::RootSchema { ) -> schemars::schema::RootSchema {
let mut root_schema = generator.root_schema_for::<Self::FileContent>(); let mut root_schema = generator.root_schema_for::<Self::FileContent>();

View file

@ -1,5 +1,5 @@
use fuzzy2::{StringMatch, StringMatchCandidate}; use fuzzy::{StringMatch, StringMatchCandidate};
use gpui2::{BackgroundExecutor, HighlightStyle}; use gpui::{BackgroundExecutor, HighlightStyle};
use std::ops::Range; use std::ops::Range;
#[derive(Debug)] #[derive(Debug)]
@ -61,7 +61,7 @@ impl<T> Outline<T> {
let query = query.trim_start(); let query = query.trim_start();
let is_path_query = query.contains(' '); let is_path_query = query.contains(' ');
let smart_case = query.chars().any(|c| c.is_uppercase()); let smart_case = query.chars().any(|c| c.is_uppercase());
let mut matches = fuzzy2::match_strings( let mut matches = fuzzy::match_strings(
if is_path_query { if is_path_query {
&self.path_candidates &self.path_candidates
} else { } else {

View file

@ -4,8 +4,8 @@ use crate::{
}; };
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use clock::ReplicaId; use clock::ReplicaId;
use lsp2::{DiagnosticSeverity, LanguageServerId}; use lsp::{DiagnosticSeverity, LanguageServerId};
use rpc2::proto; use rpc::proto;
use std::{ops::Range, sync::Arc}; use std::{ops::Range, sync::Arc};
use text::*; use text::*;

View file

@ -78,7 +78,7 @@ fn test_splice_included_ranges() {
} }
} }
#[gpui2::test] #[gpui::test]
fn test_syntax_map_layers_for_range() { fn test_syntax_map_layers_for_range() {
let registry = Arc::new(LanguageRegistry::test()); let registry = Arc::new(LanguageRegistry::test());
let language = Arc::new(rust_lang()); let language = Arc::new(rust_lang());
@ -175,7 +175,7 @@ fn test_syntax_map_layers_for_range() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_dynamic_language_injection() { fn test_dynamic_language_injection() {
let registry = Arc::new(LanguageRegistry::test()); let registry = Arc::new(LanguageRegistry::test());
let markdown = Arc::new(markdown_lang()); let markdown = Arc::new(markdown_lang());
@ -253,7 +253,7 @@ fn test_dynamic_language_injection() {
assert!(!syntax_map.contains_unknown_injections()); assert!(!syntax_map.contains_unknown_injections());
} }
#[gpui2::test] #[gpui::test]
fn test_typing_multiple_new_injections() { fn test_typing_multiple_new_injections() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"Rust", "Rust",
@ -282,7 +282,7 @@ fn test_typing_multiple_new_injections() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_pasting_new_injection_line_between_others() { fn test_pasting_new_injection_line_between_others() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"Rust", "Rust",
@ -329,7 +329,7 @@ fn test_pasting_new_injection_line_between_others() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_joining_injections_with_child_injections() { fn test_joining_injections_with_child_injections() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"Rust", "Rust",
@ -373,7 +373,7 @@ fn test_joining_injections_with_child_injections() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_editing_edges_of_injection() { fn test_editing_edges_of_injection() {
test_edit_sequence( test_edit_sequence(
"Rust", "Rust",
@ -402,7 +402,7 @@ fn test_editing_edges_of_injection() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_edits_preceding_and_intersecting_injection() { fn test_edits_preceding_and_intersecting_injection() {
test_edit_sequence( test_edit_sequence(
"Rust", "Rust",
@ -414,7 +414,7 @@ fn test_edits_preceding_and_intersecting_injection() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_non_local_changes_create_injections() { fn test_non_local_changes_create_injections() {
test_edit_sequence( test_edit_sequence(
"Rust", "Rust",
@ -433,7 +433,7 @@ fn test_non_local_changes_create_injections() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_creating_many_injections_in_one_edit() { fn test_creating_many_injections_in_one_edit() {
test_edit_sequence( test_edit_sequence(
"Rust", "Rust",
@ -463,7 +463,7 @@ fn test_creating_many_injections_in_one_edit() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_editing_across_injection_boundary() { fn test_editing_across_injection_boundary() {
test_edit_sequence( test_edit_sequence(
"Rust", "Rust",
@ -491,7 +491,7 @@ fn test_editing_across_injection_boundary() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_removing_injection_by_replacing_across_boundary() { fn test_removing_injection_by_replacing_across_boundary() {
test_edit_sequence( test_edit_sequence(
"Rust", "Rust",
@ -517,7 +517,7 @@ fn test_removing_injection_by_replacing_across_boundary() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_combined_injections_simple() { fn test_combined_injections_simple() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"ERB", "ERB",
@ -564,7 +564,7 @@ fn test_combined_injections_simple() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_combined_injections_empty_ranges() { fn test_combined_injections_empty_ranges() {
test_edit_sequence( test_edit_sequence(
"ERB", "ERB",
@ -582,7 +582,7 @@ fn test_combined_injections_empty_ranges() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_combined_injections_edit_edges_of_ranges() { fn test_combined_injections_edit_edges_of_ranges() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"ERB", "ERB",
@ -613,7 +613,7 @@ fn test_combined_injections_edit_edges_of_ranges() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_combined_injections_splitting_some_injections() { fn test_combined_injections_splitting_some_injections() {
let (_buffer, _syntax_map) = test_edit_sequence( let (_buffer, _syntax_map) = test_edit_sequence(
"ERB", "ERB",
@ -638,7 +638,7 @@ fn test_combined_injections_splitting_some_injections() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_combined_injections_editing_after_last_injection() { fn test_combined_injections_editing_after_last_injection() {
test_edit_sequence( test_edit_sequence(
"ERB", "ERB",
@ -658,7 +658,7 @@ fn test_combined_injections_editing_after_last_injection() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_combined_injections_inside_injections() { fn test_combined_injections_inside_injections() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"Markdown", "Markdown",
@ -734,7 +734,7 @@ fn test_combined_injections_inside_injections() {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_empty_combined_injections_inside_injections() { fn test_empty_combined_injections_inside_injections() {
let (buffer, syntax_map) = test_edit_sequence( let (buffer, syntax_map) = test_edit_sequence(
"Markdown", "Markdown",
@ -762,7 +762,7 @@ fn test_empty_combined_injections_inside_injections() {
); );
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits_rust_macros(rng: StdRng) { fn test_random_syntax_map_edits_rust_macros(rng: StdRng) {
let text = r#" let text = r#"
fn test_something() { fn test_something() {
@ -788,7 +788,7 @@ fn test_random_syntax_map_edits_rust_macros(rng: StdRng) {
test_random_edits(text, registry, language, rng); test_random_edits(text, registry, language, rng);
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits_with_erb(rng: StdRng) { fn test_random_syntax_map_edits_with_erb(rng: StdRng) {
let text = r#" let text = r#"
<div id="main"> <div id="main">
@ -817,7 +817,7 @@ fn test_random_syntax_map_edits_with_erb(rng: StdRng) {
test_random_edits(text, registry, language, rng); test_random_edits(text, registry, language, rng);
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
fn test_random_syntax_map_edits_with_heex(rng: StdRng) { fn test_random_syntax_map_edits_with_heex(rng: StdRng) {
let text = r#" let text = r#"
defmodule TheModule do defmodule TheModule do

View file

@ -23,7 +23,7 @@ test-support = [
[dependencies] [dependencies]
collections = { path = "../collections", optional = true } collections = { path = "../collections", optional = true }
gpui2 = { path = "../gpui2", optional = true } gpui2 = { package = "gpui2", path = "../gpui2", optional = true }
live_kit_server = { path = "../live_kit_server", optional = true } live_kit_server = { path = "../live_kit_server", optional = true }
media = { path = "../media" } media = { path = "../media" }
@ -41,7 +41,7 @@ nanoid = { version ="0.4", optional = true}
[dev-dependencies] [dev-dependencies]
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui2 = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
live_kit_server = { path = "../live_kit_server" } live_kit_server = { path = "../live_kit_server" }
media = { path = "../media" } media = { path = "../media" }
nanoid = "0.4" nanoid = "0.4"

View file

@ -13,7 +13,7 @@ test-support = ["async-pipe"]
[dependencies] [dependencies]
collections = { path = "../collections" } collections = { path = "../collections" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
util = { path = "../util" } util = { path = "../util" }
anyhow.workspace = true anyhow.workspace = true
@ -29,7 +29,7 @@ serde_json.workspace = true
smol.workspace = true smol.workspace = true
[dev-dependencies] [dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }
async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553" } async-pipe = { git = "https://github.com/zed-industries/async-pipe-rs", rev = "82d00a04211cf4e1236029aa03e6b6ce2a74c553" }

View file

@ -5,7 +5,7 @@ pub use lsp_types::*;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use collections::HashMap; use collections::HashMap;
use futures::{channel::oneshot, io::BufWriter, AsyncRead, AsyncWrite, FutureExt}; use futures::{channel::oneshot, io::BufWriter, AsyncRead, AsyncWrite, FutureExt};
use gpui2::{AsyncAppContext, BackgroundExecutor, Task}; use gpui::{AsyncAppContext, BackgroundExecutor, Task};
use parking_lot::Mutex; use parking_lot::Mutex;
use postage::{barrier, prelude::Stream}; use postage::{barrier, prelude::Stream};
use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde::{de::DeserializeOwned, Deserialize, Serialize};
@ -1038,7 +1038,7 @@ impl FakeLanguageServer {
where where
T: 'static + request::Request, T: 'static + request::Request,
T::Params: 'static + Send, T::Params: 'static + Send,
F: 'static + Send + FnMut(T::Params, gpui2::AsyncAppContext) -> Fut, F: 'static + Send + FnMut(T::Params, gpui::AsyncAppContext) -> Fut,
Fut: 'static + Send + Future<Output = Result<T::Result>>, Fut: 'static + Send + Future<Output = Result<T::Result>>,
{ {
let (responded_tx, responded_rx) = futures::channel::mpsc::unbounded(); let (responded_tx, responded_rx) = futures::channel::mpsc::unbounded();
@ -1066,7 +1066,7 @@ impl FakeLanguageServer {
where where
T: 'static + notification::Notification, T: 'static + notification::Notification,
T::Params: 'static + Send, T::Params: 'static + Send,
F: 'static + Send + FnMut(T::Params, gpui2::AsyncAppContext), F: 'static + Send + FnMut(T::Params, gpui::AsyncAppContext),
{ {
let (handled_tx, handled_rx) = futures::channel::mpsc::unbounded(); let (handled_tx, handled_rx) = futures::channel::mpsc::unbounded();
self.server.remove_notification_handler::<T>(); self.server.remove_notification_handler::<T>();
@ -1110,7 +1110,7 @@ impl FakeLanguageServer {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use gpui2::TestAppContext; use gpui::TestAppContext;
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
@ -1119,7 +1119,7 @@ mod tests {
} }
} }
#[gpui2::test] #[gpui::test]
async fn test_fake(cx: &mut TestAppContext) { async fn test_fake(cx: &mut TestAppContext) {
let (server, mut fake) = let (server, mut fake) =
LanguageServer::fake("the-lsp".to_string(), Default::default(), cx.to_async()); LanguageServer::fake("the-lsp".to_string(), Default::default(), cx.to_async());

View file

@ -9,4 +9,4 @@ path = "src/menu2.rs"
doctest = false doctest = false
[dependencies] [dependencies]
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }

View file

@ -10,29 +10,29 @@ doctest = false
[features] [features]
test-support = [ test-support = [
"copilot2/test-support", "copilot/test-support",
"text/test-support", "text/test-support",
"language2/test-support", "language/test-support",
"gpui2/test-support", "gpui/test-support",
"util/test-support", "util/test-support",
"tree-sitter-rust", "tree-sitter-rust",
"tree-sitter-typescript" "tree-sitter-typescript"
] ]
[dependencies] [dependencies]
client2 = { path = "../client2" } client = { package = "client2", path = "../client2" }
clock = { path = "../clock" } clock = { path = "../clock" }
collections = { path = "../collections" } collections = { path = "../collections" }
git = { path = "../git" } git = { path = "../git" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
lsp2 = { path = "../lsp2" } lsp = { package = "lsp2", path = "../lsp2" }
rich_text = { path = "../rich_text" } rich_text = { path = "../rich_text" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
snippet = { path = "../snippet" } snippet = { path = "../snippet" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
text = { path = "../text" } text = { path = "../text" }
theme2 = { path = "../theme2" } theme = { package = "theme2", path = "../theme2" }
util = { path = "../util" } util = { path = "../util" }
aho-corasick = "1.1" aho-corasick = "1.1"
@ -59,14 +59,14 @@ tree-sitter-html = { workspace = true, optional = true }
tree-sitter-typescript = { workspace = true, optional = true } tree-sitter-typescript = { workspace = true, optional = true }
[dev-dependencies] [dev-dependencies]
copilot2 = { path = "../copilot2", features = ["test-support"] } copilot = { package = "copilot2", path = "../copilot2", features = ["test-support"] }
text = { path = "../text", features = ["test-support"] } text = { path = "../text", features = ["test-support"] }
language2 = { path = "../language2", features = ["test-support"] } language = { package = "language2", path = "../language2", features = ["test-support"] }
lsp2 = { path = "../lsp2", features = ["test-support"] } lsp = { package = "lsp2", path = "../lsp2", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }
project2 = { path = "../project2", features = ["test-support"] } project = { package = "project2", path = "../project2", features = ["test-support"] }
settings2 = { path = "../settings2", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true env_logger.workspace = true

View file

@ -1,5 +1,5 @@
use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToOffsetUtf16, ToPoint}; use super::{ExcerptId, MultiBufferSnapshot, ToOffset, ToOffsetUtf16, ToPoint};
use language2::{OffsetUtf16, Point, TextDimension}; use language::{OffsetUtf16, Point, TextDimension};
use std::{ use std::{
cmp::Ordering, cmp::Ordering,
ops::{Range, Sub}, ops::{Range, Sub},

View file

@ -6,9 +6,9 @@ use clock::ReplicaId;
use collections::{BTreeMap, Bound, HashMap, HashSet}; use collections::{BTreeMap, Bound, HashMap, HashSet};
use futures::{channel::mpsc, SinkExt}; use futures::{channel::mpsc, SinkExt};
use git::diff::DiffHunk; use git::diff::DiffHunk;
use gpui2::{AppContext, EventEmitter, Model, ModelContext}; use gpui::{AppContext, EventEmitter, Model, ModelContext};
pub use language2::Completion; pub use language::Completion;
use language2::{ use language::{
char_kind, char_kind,
language_settings::{language_settings, LanguageSettings}, language_settings::{language_settings, LanguageSettings},
AutoindentMode, Buffer, BufferChunks, BufferSnapshot, CharKind, Chunk, CursorShape, AutoindentMode, Buffer, BufferChunks, BufferSnapshot, CharKind, Chunk, CursorShape,
@ -35,11 +35,11 @@ use text::{
subscription::{Subscription, Topic}, subscription::{Subscription, Topic},
Edit, TextSummary, Edit, TextSummary,
}; };
use theme2::SyntaxTheme; use theme::SyntaxTheme;
use util::post_inc; use util::post_inc;
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
use gpui2::Context; use gpui::Context;
const NEWLINES: &[u8] = &[b'\n'; u8::MAX as usize]; const NEWLINES: &[u8] = &[b'\n'; u8::MAX as usize];
@ -62,7 +62,7 @@ pub enum Event {
ExcerptsAdded { ExcerptsAdded {
buffer: Model<Buffer>, buffer: Model<Buffer>,
predecessor: ExcerptId, predecessor: ExcerptId,
excerpts: Vec<(ExcerptId, ExcerptRange<language2::Anchor>)>, excerpts: Vec<(ExcerptId, ExcerptRange<language::Anchor>)>,
}, },
ExcerptsRemoved { ExcerptsRemoved {
ids: Vec<ExcerptId>, ids: Vec<ExcerptId>,
@ -130,7 +130,7 @@ struct BufferState {
last_file_update_count: usize, last_file_update_count: usize,
last_git_diff_update_count: usize, last_git_diff_update_count: usize,
excerpts: Vec<Locator>, excerpts: Vec<Locator>,
_subscriptions: [gpui2::Subscription; 2], _subscriptions: [gpui::Subscription; 2],
} }
#[derive(Clone, Default)] #[derive(Clone, Default)]
@ -684,7 +684,7 @@ impl MultiBuffer {
pub fn push_transaction<'a, T>(&mut self, buffer_transactions: T, cx: &mut ModelContext<Self>) pub fn push_transaction<'a, T>(&mut self, buffer_transactions: T, cx: &mut ModelContext<Self>)
where where
T: IntoIterator<Item = (&'a Model<Buffer>, &'a language2::Transaction)>, T: IntoIterator<Item = (&'a Model<Buffer>, &'a language::Transaction)>,
{ {
self.history self.history
.push_transaction(buffer_transactions, Instant::now(), cx); .push_transaction(buffer_transactions, Instant::now(), cx);
@ -1383,7 +1383,7 @@ impl MultiBuffer {
&self, &self,
position: T, position: T,
cx: &AppContext, cx: &AppContext,
) -> Option<(Model<Buffer>, language2::Anchor)> { ) -> Option<(Model<Buffer>, language::Anchor)> {
let snapshot = self.read(cx); let snapshot = self.read(cx);
let anchor = snapshot.anchor_before(position); let anchor = snapshot.anchor_before(position);
let buffer = self let buffer = self
@ -1398,25 +1398,25 @@ impl MultiBuffer {
fn on_buffer_event( fn on_buffer_event(
&mut self, &mut self,
_: Model<Buffer>, _: Model<Buffer>,
event: &language2::Event, event: &language::Event,
cx: &mut ModelContext<Self>, cx: &mut ModelContext<Self>,
) { ) {
cx.emit(match event { cx.emit(match event {
language2::Event::Edited => Event::Edited { language::Event::Edited => Event::Edited {
sigleton_buffer_edited: true, sigleton_buffer_edited: true,
}, },
language2::Event::DirtyChanged => Event::DirtyChanged, language::Event::DirtyChanged => Event::DirtyChanged,
language2::Event::Saved => Event::Saved, language::Event::Saved => Event::Saved,
language2::Event::FileHandleChanged => Event::FileHandleChanged, language::Event::FileHandleChanged => Event::FileHandleChanged,
language2::Event::Reloaded => Event::Reloaded, language::Event::Reloaded => Event::Reloaded,
language2::Event::DiffBaseChanged => Event::DiffBaseChanged, language::Event::DiffBaseChanged => Event::DiffBaseChanged,
language2::Event::LanguageChanged => Event::LanguageChanged, language::Event::LanguageChanged => Event::LanguageChanged,
language2::Event::Reparsed => Event::Reparsed, language::Event::Reparsed => Event::Reparsed,
language2::Event::DiagnosticsUpdated => Event::DiagnosticsUpdated, language::Event::DiagnosticsUpdated => Event::DiagnosticsUpdated,
language2::Event::Closed => Event::Closed, language::Event::Closed => Event::Closed,
// //
language2::Event::Operation(_) => return, language::Event::Operation(_) => return,
}); });
} }
@ -1648,14 +1648,14 @@ impl MultiBuffer {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
impl MultiBuffer { impl MultiBuffer {
pub fn build_simple(text: &str, cx: &mut gpui2::AppContext) -> Model<Self> { pub fn build_simple(text: &str, cx: &mut gpui::AppContext) -> Model<Self> {
let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), text)); let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), text));
cx.build_model(|cx| Self::singleton(buffer, cx)) cx.build_model(|cx| Self::singleton(buffer, cx))
} }
pub fn build_multi<const COUNT: usize>( pub fn build_multi<const COUNT: usize>(
excerpts: [(&str, Vec<Range<Point>>); COUNT], excerpts: [(&str, Vec<Range<Point>>); COUNT],
cx: &mut gpui2::AppContext, cx: &mut gpui::AppContext,
) -> Model<Self> { ) -> Model<Self> {
let multi = cx.build_model(|_| Self::new(0)); let multi = cx.build_model(|_| Self::new(0));
for (text, ranges) in excerpts { for (text, ranges) in excerpts {
@ -1672,11 +1672,11 @@ impl MultiBuffer {
multi multi
} }
pub fn build_from_buffer(buffer: Model<Buffer>, cx: &mut gpui2::AppContext) -> Model<Self> { pub fn build_from_buffer(buffer: Model<Buffer>, cx: &mut gpui::AppContext) -> Model<Self> {
cx.build_model(|cx| Self::singleton(buffer, cx)) cx.build_model(|cx| Self::singleton(buffer, cx))
} }
pub fn build_random(rng: &mut impl rand::Rng, cx: &mut gpui2::AppContext) -> Model<Self> { pub fn build_random(rng: &mut impl rand::Rng, cx: &mut gpui::AppContext) -> Model<Self> {
cx.build_model(|cx| { cx.build_model(|cx| {
let mut multibuffer = MultiBuffer::new(0); let mut multibuffer = MultiBuffer::new(0);
let mutation_count = rng.gen_range(1..=5); let mutation_count = rng.gen_range(1..=5);
@ -3409,7 +3409,7 @@ impl History {
now: Instant, now: Instant,
cx: &mut ModelContext<MultiBuffer>, cx: &mut ModelContext<MultiBuffer>,
) where ) where
T: IntoIterator<Item = (&'a Model<Buffer>, &'a language2::Transaction)>, T: IntoIterator<Item = (&'a Model<Buffer>, &'a language::Transaction)>,
{ {
assert_eq!(self.transaction_depth, 0); assert_eq!(self.transaction_depth, 0);
let transaction = Transaction { let transaction = Transaction {
@ -4135,15 +4135,15 @@ where
mod tests { mod tests {
use super::*; use super::*;
use futures::StreamExt; use futures::StreamExt;
use gpui2::{AppContext, Context, TestAppContext}; use gpui::{AppContext, Context, TestAppContext};
use language2::{Buffer, Rope}; use language::{Buffer, Rope};
use parking_lot::RwLock; use parking_lot::RwLock;
use rand::prelude::*; use rand::prelude::*;
use settings2::SettingsStore; use settings::SettingsStore;
use std::env; use std::env;
use util::test::sample_text; use util::test::sample_text;
#[gpui2::test] #[gpui::test]
fn test_singleton(cx: &mut AppContext) { fn test_singleton(cx: &mut AppContext) {
let buffer = let buffer =
cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(6, 6, 'a'))); cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(6, 6, 'a')));
@ -4171,7 +4171,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_remote(cx: &mut AppContext) { fn test_remote(cx: &mut AppContext) {
let host_buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "a")); let host_buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "a"));
let guest_buffer = cx.build_model(|cx| { let guest_buffer = cx.build_model(|cx| {
@ -4183,7 +4183,7 @@ mod tests {
buffer buffer
.apply_ops( .apply_ops(
ops.into_iter() ops.into_iter()
.map(|op| language2::proto::deserialize_operation(op).unwrap()), .map(|op| language::proto::deserialize_operation(op).unwrap()),
cx, cx,
) )
.unwrap(); .unwrap();
@ -4202,7 +4202,7 @@ mod tests {
assert_eq!(snapshot.text(), "abc"); assert_eq!(snapshot.text(), "abc");
} }
#[gpui2::test] #[gpui::test]
fn test_excerpt_boundaries_and_clipping(cx: &mut AppContext) { fn test_excerpt_boundaries_and_clipping(cx: &mut AppContext) {
let buffer_1 = let buffer_1 =
cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(6, 6, 'a'))); cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(6, 6, 'a')));
@ -4438,7 +4438,7 @@ mod tests {
} }
} }
#[gpui2::test] #[gpui::test]
fn test_excerpt_events(cx: &mut AppContext) { fn test_excerpt_events(cx: &mut AppContext) {
let buffer_1 = let buffer_1 =
cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(10, 3, 'a'))); cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(10, 3, 'a')));
@ -4546,7 +4546,7 @@ mod tests {
assert_eq!(*follower_edit_event_count.read(), 4); assert_eq!(*follower_edit_event_count.read(), 4);
} }
#[gpui2::test] #[gpui::test]
fn test_push_excerpts_with_context_lines(cx: &mut AppContext) { fn test_push_excerpts_with_context_lines(cx: &mut AppContext) {
let buffer = let buffer =
cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(20, 3, 'a'))); cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(20, 3, 'a')));
@ -4583,7 +4583,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
async fn test_stream_excerpts_with_context_lines(cx: &mut TestAppContext) { async fn test_stream_excerpts_with_context_lines(cx: &mut TestAppContext) {
let buffer = let buffer =
cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(20, 3, 'a'))); cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), sample_text(20, 3, 'a')));
@ -4620,7 +4620,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_empty_multibuffer(cx: &mut AppContext) { fn test_empty_multibuffer(cx: &mut AppContext) {
let multibuffer = cx.build_model(|_| MultiBuffer::new(0)); let multibuffer = cx.build_model(|_| MultiBuffer::new(0));
@ -4630,7 +4630,7 @@ mod tests {
assert_eq!(snapshot.buffer_rows(1).collect::<Vec<_>>(), &[]); assert_eq!(snapshot.buffer_rows(1).collect::<Vec<_>>(), &[]);
} }
#[gpui2::test] #[gpui::test]
fn test_singleton_multibuffer_anchors(cx: &mut AppContext) { fn test_singleton_multibuffer_anchors(cx: &mut AppContext) {
let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "abcd")); let buffer = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "abcd"));
let multibuffer = cx.build_model(|cx| MultiBuffer::singleton(buffer.clone(), cx)); let multibuffer = cx.build_model(|cx| MultiBuffer::singleton(buffer.clone(), cx));
@ -4650,7 +4650,7 @@ mod tests {
assert_eq!(old_snapshot.anchor_after(4).to_offset(&new_snapshot), 6); assert_eq!(old_snapshot.anchor_after(4).to_offset(&new_snapshot), 6);
} }
#[gpui2::test] #[gpui::test]
fn test_multibuffer_anchors(cx: &mut AppContext) { fn test_multibuffer_anchors(cx: &mut AppContext) {
let buffer_1 = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "abcd")); let buffer_1 = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "abcd"));
let buffer_2 = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "efghi")); let buffer_2 = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "efghi"));
@ -4708,7 +4708,7 @@ mod tests {
assert_eq!(old_snapshot.anchor_after(10).to_offset(&new_snapshot), 14); assert_eq!(old_snapshot.anchor_after(10).to_offset(&new_snapshot), 14);
} }
#[gpui2::test] #[gpui::test]
fn test_resolving_anchors_after_replacing_their_excerpts(cx: &mut AppContext) { fn test_resolving_anchors_after_replacing_their_excerpts(cx: &mut AppContext) {
let buffer_1 = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "abcd")); let buffer_1 = cx.build_model(|cx| Buffer::new(0, cx.entity_id().as_u64(), "abcd"));
let buffer_2 = let buffer_2 =
@ -4840,7 +4840,7 @@ mod tests {
); );
} }
#[gpui2::test(iterations = 100)] #[gpui::test(iterations = 100)]
fn test_random_multibuffer(cx: &mut AppContext, mut rng: StdRng) { fn test_random_multibuffer(cx: &mut AppContext, mut rng: StdRng) {
let operations = env::var("OPERATIONS") let operations = env::var("OPERATIONS")
.map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .map(|i| i.parse().expect("invalid `OPERATIONS` variable"))
@ -5262,7 +5262,7 @@ mod tests {
} }
} }
#[gpui2::test] #[gpui::test]
fn test_history(cx: &mut AppContext) { fn test_history(cx: &mut AppContext) {
let test_settings = SettingsStore::test(cx); let test_settings = SettingsStore::test(cx);
cx.set_global(test_settings); cx.set_global(test_settings);

View file

@ -12,12 +12,12 @@ doctest = false
test-support = [] test-support = []
[dependencies] [dependencies]
client2 = { path = "../client2" } client = { package = "client2", path = "../client2" }
collections = { path = "../collections"} collections = { path = "../collections"}
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
fs2 = { path = "../fs2" } fs = { package = "fs2", path = "../fs2" }
lsp2 = { path = "../lsp2" } lsp = { package = "lsp2", path = "../lsp2" }
node_runtime = { path = "../node_runtime"} node_runtime = { path = "../node_runtime"}
util = { path = "../util" } util = { path = "../util" }
@ -30,6 +30,6 @@ futures.workspace = true
parking_lot.workspace = true parking_lot.workspace = true
[dev-dependencies] [dev-dependencies]
language2 = { path = "../language2", features = ["test-support"] } language = { package = "language2", path = "../language2", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
fs2 = { path = "../fs2", features = ["test-support"] } fs = { package = "fs2", path = "../fs2", features = ["test-support"] }

View file

@ -1,9 +1,9 @@
use anyhow::Context; use anyhow::Context;
use collections::HashMap; use collections::HashMap;
use fs2::Fs; use fs::Fs;
use gpui2::{AsyncAppContext, Model}; use gpui::{AsyncAppContext, Model};
use language2::{language_settings::language_settings, Buffer, Diff}; use language::{language_settings::language_settings, Buffer, Diff};
use lsp2::{LanguageServer, LanguageServerId}; use lsp::{LanguageServer, LanguageServerId};
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{ use std::{
@ -141,7 +141,7 @@ impl Prettier {
node: Arc<dyn NodeRuntime>, node: Arc<dyn NodeRuntime>,
cx: AsyncAppContext, cx: AsyncAppContext,
) -> anyhow::Result<Self> { ) -> anyhow::Result<Self> {
use lsp2::LanguageServerBinary; use lsp::LanguageServerBinary;
let executor = cx.background_executor().clone(); let executor = cx.background_executor().clone();
anyhow::ensure!( anyhow::ensure!(
@ -453,7 +453,7 @@ struct FormatResult {
text: String, text: String,
} }
impl lsp2::request::Request for Format { impl lsp::request::Request for Format {
type Params = FormatParams; type Params = FormatParams;
type Result = FormatResult; type Result = FormatResult;
const METHOD: &'static str = "prettier/format"; const METHOD: &'static str = "prettier/format";
@ -461,7 +461,7 @@ impl lsp2::request::Request for Format {
enum ClearCache {} enum ClearCache {}
impl lsp2::request::Request for ClearCache { impl lsp::request::Request for ClearCache {
type Params = (); type Params = ();
type Result = (); type Result = ();
const METHOD: &'static str = "prettier/clear_cache"; const METHOD: &'static str = "prettier/clear_cache";

View file

@ -10,35 +10,35 @@ doctest = false
[features] [features]
test-support = [ test-support = [
"client2/test-support", "client/test-support",
"db2/test-support", "db/test-support",
"language2/test-support", "language/test-support",
"settings2/test-support", "settings/test-support",
"text/test-support", "text/test-support",
"prettier2/test-support", "prettier/test-support",
"gpui2/test-support", "gpui/test-support",
] ]
[dependencies] [dependencies]
text = { path = "../text" } text = { path = "../text" }
copilot2 = { path = "../copilot2" } copilot = { package = "copilot2", path = "../copilot2" }
client2 = { path = "../client2" } client = { package = "client2", path = "../client2" }
clock = { path = "../clock" } clock = { path = "../clock" }
collections = { path = "../collections" } collections = { path = "../collections" }
db2 = { path = "../db2" } db = { package = "db2", path = "../db2" }
fs2 = { path = "../fs2" } fs = { package = "fs2", path = "../fs2" }
fsevent = { path = "../fsevent" } fsevent = { path = "../fsevent" }
fuzzy2 = { path = "../fuzzy2" } fuzzy = { package = "fuzzy2", path = "../fuzzy2" }
git = { path = "../git" } git = { path = "../git" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
lsp2 = { path = "../lsp2" } lsp = { package = "lsp2", path = "../lsp2" }
node_runtime = { path = "../node_runtime" } node_runtime = { path = "../node_runtime" }
prettier2 = { path = "../prettier2" } prettier = { package = "prettier2", path = "../prettier2" }
rpc2 = { path = "../rpc2" } rpc = { package = "rpc2", path = "../rpc2" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
terminal2 = { path = "../terminal2" } terminal = { package = "terminal2", path = "../terminal2" }
util = { path = "../util" } util = { path = "../util" }
aho-corasick = "1.1" aho-corasick = "1.1"
@ -69,17 +69,17 @@ itertools = "0.10"
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true env_logger.workspace = true
pretty_assertions.workspace = true pretty_assertions.workspace = true
client2 = { path = "../client2", features = ["test-support"] } client = { package = "client2", path = "../client2", features = ["test-support"] }
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
db2 = { path = "../db2", features = ["test-support"] } db = { package = "db2", path = "../db2", features = ["test-support"] }
fs2 = { path = "../fs2", features = ["test-support"] } fs = { package = "fs2", path = "../fs2", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
language2 = { path = "../language2", features = ["test-support"] } language = { package = "language2", path = "../language2", features = ["test-support"] }
lsp2 = { path = "../lsp2", features = ["test-support"] } lsp = { package = "lsp2", path = "../lsp2", features = ["test-support"] }
settings2 = { path = "../settings2", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }
prettier2 = { path = "../prettier2", features = ["test-support"] } prettier = { package = "prettier2", path = "../prettier2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }
rpc2 = { path = "../rpc2", features = ["test-support"] } rpc = { package = "rpc2", path = "../rpc2", features = ["test-support"] }
git2.workspace = true git2.workspace = true
tempdir.workspace = true tempdir.workspace = true
unindent.workspace = true unindent.workspace = true

View file

@ -5,10 +5,10 @@ use crate::{
}; };
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use client2::proto::{self, PeerId}; use client::proto::{self, PeerId};
use futures::future; use futures::future;
use gpui2::{AppContext, AsyncAppContext, Model}; use gpui::{AppContext, AsyncAppContext, Model};
use language2::{ use language::{
language_settings::{language_settings, InlayHintKind}, language_settings::{language_settings, InlayHintKind},
point_from_lsp, point_to_lsp, point_from_lsp, point_to_lsp,
proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version}, proto::{deserialize_anchor, deserialize_version, serialize_anchor, serialize_version},
@ -16,29 +16,29 @@ use language2::{
CodeAction, Completion, OffsetRangeExt, PointUtf16, ToOffset, ToPointUtf16, Transaction, CodeAction, Completion, OffsetRangeExt, PointUtf16, ToOffset, ToPointUtf16, Transaction,
Unclipped, Unclipped,
}; };
use lsp2::{ use lsp::{
CompletionListItemDefaultsEditRange, DocumentHighlightKind, LanguageServer, LanguageServerId, CompletionListItemDefaultsEditRange, DocumentHighlightKind, LanguageServer, LanguageServerId,
OneOf, ServerCapabilities, OneOf, ServerCapabilities,
}; };
use std::{cmp::Reverse, ops::Range, path::Path, sync::Arc}; use std::{cmp::Reverse, ops::Range, path::Path, sync::Arc};
use text::LineEnding; use text::LineEnding;
pub fn lsp_formatting_options(tab_size: u32) -> lsp2::FormattingOptions { pub fn lsp_formatting_options(tab_size: u32) -> lsp::FormattingOptions {
lsp2::FormattingOptions { lsp::FormattingOptions {
tab_size, tab_size,
insert_spaces: true, insert_spaces: true,
insert_final_newline: Some(true), insert_final_newline: Some(true),
..lsp2::FormattingOptions::default() ..lsp::FormattingOptions::default()
} }
} }
#[async_trait(?Send)] #[async_trait(?Send)]
pub(crate) trait LspCommand: 'static + Sized + Send { pub(crate) trait LspCommand: 'static + Sized + Send {
type Response: 'static + Default + Send; type Response: 'static + Default + Send;
type LspRequest: 'static + Send + lsp2::request::Request; type LspRequest: 'static + Send + lsp::request::Request;
type ProtoRequest: 'static + Send + proto::RequestMessage; type ProtoRequest: 'static + Send + proto::RequestMessage;
fn check_capabilities(&self, _: &lsp2::ServerCapabilities) -> bool { fn check_capabilities(&self, _: &lsp::ServerCapabilities) -> bool {
true true
} }
@ -48,11 +48,11 @@ pub(crate) trait LspCommand: 'static + Sized + Send {
buffer: &Buffer, buffer: &Buffer,
language_server: &Arc<LanguageServer>, language_server: &Arc<LanguageServer>,
cx: &AppContext, cx: &AppContext,
) -> <Self::LspRequest as lsp2::request::Request>::Params; ) -> <Self::LspRequest as lsp::request::Request>::Params;
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: <Self::LspRequest as lsp2::request::Request>::Result, message: <Self::LspRequest as lsp::request::Request>::Result,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -140,8 +140,8 @@ pub(crate) struct FormattingOptions {
tab_size: u32, tab_size: u32,
} }
impl From<lsp2::FormattingOptions> for FormattingOptions { impl From<lsp::FormattingOptions> for FormattingOptions {
fn from(value: lsp2::FormattingOptions) -> Self { fn from(value: lsp::FormattingOptions) -> Self {
Self { Self {
tab_size: value.tab_size, tab_size: value.tab_size,
} }
@ -151,11 +151,11 @@ impl From<lsp2::FormattingOptions> for FormattingOptions {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for PrepareRename { impl LspCommand for PrepareRename {
type Response = Option<Range<Anchor>>; type Response = Option<Range<Anchor>>;
type LspRequest = lsp2::request::PrepareRenameRequest; type LspRequest = lsp::request::PrepareRenameRequest;
type ProtoRequest = proto::PrepareRename; type ProtoRequest = proto::PrepareRename;
fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool { fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool {
if let Some(lsp2::OneOf::Right(rename)) = &capabilities.rename_provider { if let Some(lsp::OneOf::Right(rename)) = &capabilities.rename_provider {
rename.prepare_provider == Some(true) rename.prepare_provider == Some(true)
} else { } else {
false false
@ -168,10 +168,10 @@ impl LspCommand for PrepareRename {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::TextDocumentPositionParams { ) -> lsp::TextDocumentPositionParams {
lsp2::TextDocumentPositionParams { lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
} }
@ -179,7 +179,7 @@ impl LspCommand for PrepareRename {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<lsp2::PrepareRenameResponse>, message: Option<lsp::PrepareRenameResponse>,
_: Model<Project>, _: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
_: LanguageServerId, _: LanguageServerId,
@ -187,8 +187,8 @@ impl LspCommand for PrepareRename {
) -> Result<Option<Range<Anchor>>> { ) -> Result<Option<Range<Anchor>>> {
buffer.update(&mut cx, |buffer, _| { buffer.update(&mut cx, |buffer, _| {
if let Some( if let Some(
lsp2::PrepareRenameResponse::Range(range) lsp::PrepareRenameResponse::Range(range)
| lsp2::PrepareRenameResponse::RangeWithPlaceholder { range, .. }, | lsp::PrepareRenameResponse::RangeWithPlaceholder { range, .. },
) = message ) = message
{ {
let Range { start, end } = range_from_lsp(range); let Range { start, end } = range_from_lsp(range);
@ -206,7 +206,7 @@ impl LspCommand for PrepareRename {
proto::PrepareRename { proto::PrepareRename {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
@ -245,10 +245,10 @@ impl LspCommand for PrepareRename {
can_rename: range.is_some(), can_rename: range.is_some(),
start: range start: range
.as_ref() .as_ref()
.map(|range| language2::proto::serialize_anchor(&range.start)), .map(|range| language::proto::serialize_anchor(&range.start)),
end: range end: range
.as_ref() .as_ref()
.map(|range| language2::proto::serialize_anchor(&range.end)), .map(|range| language::proto::serialize_anchor(&range.end)),
version: serialize_version(buffer_version), version: serialize_version(buffer_version),
} }
} }
@ -282,7 +282,7 @@ impl LspCommand for PrepareRename {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for PerformRename { impl LspCommand for PerformRename {
type Response = ProjectTransaction; type Response = ProjectTransaction;
type LspRequest = lsp2::request::Rename; type LspRequest = lsp::request::Rename;
type ProtoRequest = proto::PerformRename; type ProtoRequest = proto::PerformRename;
fn to_lsp( fn to_lsp(
@ -291,11 +291,11 @@ impl LspCommand for PerformRename {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::RenameParams { ) -> lsp::RenameParams {
lsp2::RenameParams { lsp::RenameParams {
text_document_position: lsp2::TextDocumentPositionParams { text_document_position: lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
}, },
@ -306,7 +306,7 @@ impl LspCommand for PerformRename {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<lsp2::WorkspaceEdit>, message: Option<lsp::WorkspaceEdit>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -333,7 +333,7 @@ impl LspCommand for PerformRename {
proto::PerformRename { proto::PerformRename {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
new_name: self.new_name.clone(), new_name: self.new_name.clone(),
@ -401,7 +401,7 @@ impl LspCommand for PerformRename {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetDefinition { impl LspCommand for GetDefinition {
type Response = Vec<LocationLink>; type Response = Vec<LocationLink>;
type LspRequest = lsp2::request::GotoDefinition; type LspRequest = lsp::request::GotoDefinition;
type ProtoRequest = proto::GetDefinition; type ProtoRequest = proto::GetDefinition;
fn to_lsp( fn to_lsp(
@ -410,11 +410,11 @@ impl LspCommand for GetDefinition {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::GotoDefinitionParams { ) -> lsp::GotoDefinitionParams {
lsp2::GotoDefinitionParams { lsp::GotoDefinitionParams {
text_document_position_params: lsp2::TextDocumentPositionParams { text_document_position_params: lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
}, },
@ -425,7 +425,7 @@ impl LspCommand for GetDefinition {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<lsp2::GotoDefinitionResponse>, message: Option<lsp::GotoDefinitionResponse>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -438,7 +438,7 @@ impl LspCommand for GetDefinition {
proto::GetDefinition { proto::GetDefinition {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
@ -494,13 +494,13 @@ impl LspCommand for GetDefinition {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetTypeDefinition { impl LspCommand for GetTypeDefinition {
type Response = Vec<LocationLink>; type Response = Vec<LocationLink>;
type LspRequest = lsp2::request::GotoTypeDefinition; type LspRequest = lsp::request::GotoTypeDefinition;
type ProtoRequest = proto::GetTypeDefinition; type ProtoRequest = proto::GetTypeDefinition;
fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool { fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool {
match &capabilities.type_definition_provider { match &capabilities.type_definition_provider {
None => false, None => false,
Some(lsp2::TypeDefinitionProviderCapability::Simple(false)) => false, Some(lsp::TypeDefinitionProviderCapability::Simple(false)) => false,
_ => true, _ => true,
} }
} }
@ -511,11 +511,11 @@ impl LspCommand for GetTypeDefinition {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::GotoTypeDefinitionParams { ) -> lsp::GotoTypeDefinitionParams {
lsp2::GotoTypeDefinitionParams { lsp::GotoTypeDefinitionParams {
text_document_position_params: lsp2::TextDocumentPositionParams { text_document_position_params: lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
}, },
@ -526,7 +526,7 @@ impl LspCommand for GetTypeDefinition {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<lsp2::GotoTypeDefinitionResponse>, message: Option<lsp::GotoTypeDefinitionResponse>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -539,7 +539,7 @@ impl LspCommand for GetTypeDefinition {
proto::GetTypeDefinition { proto::GetTypeDefinition {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
@ -670,7 +670,7 @@ async fn location_links_from_proto(
} }
async fn location_links_from_lsp( async fn location_links_from_lsp(
message: Option<lsp2::GotoDefinitionResponse>, message: Option<lsp::GotoDefinitionResponse>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -683,15 +683,15 @@ async fn location_links_from_lsp(
let mut unresolved_links = Vec::new(); let mut unresolved_links = Vec::new();
match message { match message {
lsp2::GotoDefinitionResponse::Scalar(loc) => { lsp::GotoDefinitionResponse::Scalar(loc) => {
unresolved_links.push((None, loc.uri, loc.range)); unresolved_links.push((None, loc.uri, loc.range));
} }
lsp2::GotoDefinitionResponse::Array(locs) => { lsp::GotoDefinitionResponse::Array(locs) => {
unresolved_links.extend(locs.into_iter().map(|l| (None, l.uri, l.range))); unresolved_links.extend(locs.into_iter().map(|l| (None, l.uri, l.range)));
} }
lsp2::GotoDefinitionResponse::Link(links) => { lsp::GotoDefinitionResponse::Link(links) => {
unresolved_links.extend(links.into_iter().map(|l| { unresolved_links.extend(links.into_iter().map(|l| {
( (
l.origin_selection_range, l.origin_selection_range,
@ -786,7 +786,7 @@ fn location_links_to_proto(
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetReferences { impl LspCommand for GetReferences {
type Response = Vec<Location>; type Response = Vec<Location>;
type LspRequest = lsp2::request::References; type LspRequest = lsp::request::References;
type ProtoRequest = proto::GetReferences; type ProtoRequest = proto::GetReferences;
fn to_lsp( fn to_lsp(
@ -795,17 +795,17 @@ impl LspCommand for GetReferences {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::ReferenceParams { ) -> lsp::ReferenceParams {
lsp2::ReferenceParams { lsp::ReferenceParams {
text_document_position: lsp2::TextDocumentPositionParams { text_document_position: lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
}, },
work_done_progress_params: Default::default(), work_done_progress_params: Default::default(),
partial_result_params: Default::default(), partial_result_params: Default::default(),
context: lsp2::ReferenceContext { context: lsp::ReferenceContext {
include_declaration: true, include_declaration: true,
}, },
} }
@ -813,7 +813,7 @@ impl LspCommand for GetReferences {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
locations: Option<Vec<lsp2::Location>>, locations: Option<Vec<lsp::Location>>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -859,7 +859,7 @@ impl LspCommand for GetReferences {
proto::GetReferences { proto::GetReferences {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
@ -948,7 +948,7 @@ impl LspCommand for GetReferences {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetDocumentHighlights { impl LspCommand for GetDocumentHighlights {
type Response = Vec<DocumentHighlight>; type Response = Vec<DocumentHighlight>;
type LspRequest = lsp2::request::DocumentHighlightRequest; type LspRequest = lsp::request::DocumentHighlightRequest;
type ProtoRequest = proto::GetDocumentHighlights; type ProtoRequest = proto::GetDocumentHighlights;
fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool { fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool {
@ -961,11 +961,11 @@ impl LspCommand for GetDocumentHighlights {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::DocumentHighlightParams { ) -> lsp::DocumentHighlightParams {
lsp2::DocumentHighlightParams { lsp::DocumentHighlightParams {
text_document_position_params: lsp2::TextDocumentPositionParams { text_document_position_params: lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
}, },
@ -976,7 +976,7 @@ impl LspCommand for GetDocumentHighlights {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
lsp_highlights: Option<Vec<lsp2::DocumentHighlight>>, lsp_highlights: Option<Vec<lsp::DocumentHighlight>>,
_: Model<Project>, _: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
_: LanguageServerId, _: LanguageServerId,
@ -996,7 +996,7 @@ impl LspCommand for GetDocumentHighlights {
range: buffer.anchor_after(start)..buffer.anchor_before(end), range: buffer.anchor_after(start)..buffer.anchor_before(end),
kind: lsp_highlight kind: lsp_highlight
.kind .kind
.unwrap_or(lsp2::DocumentHighlightKind::READ), .unwrap_or(lsp::DocumentHighlightKind::READ),
} }
}) })
.collect() .collect()
@ -1007,7 +1007,7 @@ impl LspCommand for GetDocumentHighlights {
proto::GetDocumentHighlights { proto::GetDocumentHighlights {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
@ -1099,7 +1099,7 @@ impl LspCommand for GetDocumentHighlights {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetHover { impl LspCommand for GetHover {
type Response = Option<Hover>; type Response = Option<Hover>;
type LspRequest = lsp2::request::HoverRequest; type LspRequest = lsp::request::HoverRequest;
type ProtoRequest = proto::GetHover; type ProtoRequest = proto::GetHover;
fn to_lsp( fn to_lsp(
@ -1108,11 +1108,11 @@ impl LspCommand for GetHover {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::HoverParams { ) -> lsp::HoverParams {
lsp2::HoverParams { lsp::HoverParams {
text_document_position_params: lsp2::TextDocumentPositionParams { text_document_position_params: lsp::TextDocumentPositionParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
position: point_to_lsp(self.position), position: point_to_lsp(self.position),
}, },
@ -1122,7 +1122,7 @@ impl LspCommand for GetHover {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<lsp2::Hover>, message: Option<lsp::Hover>,
_: Model<Project>, _: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
_: LanguageServerId, _: LanguageServerId,
@ -1144,15 +1144,13 @@ impl LspCommand for GetHover {
) )
})?; })?;
fn hover_blocks_from_marked_string( fn hover_blocks_from_marked_string(marked_string: lsp::MarkedString) -> Option<HoverBlock> {
marked_string: lsp2::MarkedString,
) -> Option<HoverBlock> {
let block = match marked_string { let block = match marked_string {
lsp2::MarkedString::String(content) => HoverBlock { lsp::MarkedString::String(content) => HoverBlock {
text: content, text: content,
kind: HoverBlockKind::Markdown, kind: HoverBlockKind::Markdown,
}, },
lsp2::MarkedString::LanguageString(lsp2::LanguageString { language, value }) => { lsp::MarkedString::LanguageString(lsp::LanguageString { language, value }) => {
HoverBlock { HoverBlock {
text: value, text: value,
kind: HoverBlockKind::Code { language }, kind: HoverBlockKind::Code { language },
@ -1167,18 +1165,18 @@ impl LspCommand for GetHover {
} }
let contents = match hover.contents { let contents = match hover.contents {
lsp2::HoverContents::Scalar(marked_string) => { lsp::HoverContents::Scalar(marked_string) => {
hover_blocks_from_marked_string(marked_string) hover_blocks_from_marked_string(marked_string)
.into_iter() .into_iter()
.collect() .collect()
} }
lsp2::HoverContents::Array(marked_strings) => marked_strings lsp::HoverContents::Array(marked_strings) => marked_strings
.into_iter() .into_iter()
.filter_map(hover_blocks_from_marked_string) .filter_map(hover_blocks_from_marked_string)
.collect(), .collect(),
lsp2::HoverContents::Markup(markup_content) => vec![HoverBlock { lsp::HoverContents::Markup(markup_content) => vec![HoverBlock {
text: markup_content.value, text: markup_content.value,
kind: if markup_content.kind == lsp2::MarkupKind::Markdown { kind: if markup_content.kind == lsp::MarkupKind::Markdown {
HoverBlockKind::Markdown HoverBlockKind::Markdown
} else { } else {
HoverBlockKind::PlainText HoverBlockKind::PlainText
@ -1197,7 +1195,7 @@ impl LspCommand for GetHover {
proto::GetHover { proto::GetHover {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
version: serialize_version(&buffer.version), version: serialize_version(&buffer.version),
@ -1234,8 +1232,8 @@ impl LspCommand for GetHover {
if let Some(response) = response { if let Some(response) = response {
let (start, end) = if let Some(range) = response.range { let (start, end) = if let Some(range) = response.range {
( (
Some(language2::proto::serialize_anchor(&range.start)), Some(language::proto::serialize_anchor(&range.start)),
Some(language2::proto::serialize_anchor(&range.end)), Some(language::proto::serialize_anchor(&range.end)),
) )
} else { } else {
(None, None) (None, None)
@ -1296,8 +1294,8 @@ impl LspCommand for GetHover {
let language = buffer.update(&mut cx, |buffer, _| buffer.language().cloned())?; let language = buffer.update(&mut cx, |buffer, _| buffer.language().cloned())?;
let range = if let (Some(start), Some(end)) = (message.start, message.end) { let range = if let (Some(start), Some(end)) = (message.start, message.end) {
language2::proto::deserialize_anchor(start) language::proto::deserialize_anchor(start)
.and_then(|start| language2::proto::deserialize_anchor(end).map(|end| start..end)) .and_then(|start| language::proto::deserialize_anchor(end).map(|end| start..end))
} else { } else {
None None
}; };
@ -1317,7 +1315,7 @@ impl LspCommand for GetHover {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetCompletions { impl LspCommand for GetCompletions {
type Response = Vec<Completion>; type Response = Vec<Completion>;
type LspRequest = lsp2::request::Completion; type LspRequest = lsp::request::Completion;
type ProtoRequest = proto::GetCompletions; type ProtoRequest = proto::GetCompletions;
fn to_lsp( fn to_lsp(
@ -1326,10 +1324,10 @@ impl LspCommand for GetCompletions {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::CompletionParams { ) -> lsp::CompletionParams {
lsp2::CompletionParams { lsp::CompletionParams {
text_document_position: lsp2::TextDocumentPositionParams::new( text_document_position: lsp::TextDocumentPositionParams::new(
lsp2::TextDocumentIdentifier::new(lsp2::Url::from_file_path(path).unwrap()), lsp::TextDocumentIdentifier::new(lsp::Url::from_file_path(path).unwrap()),
point_to_lsp(self.position), point_to_lsp(self.position),
), ),
context: Default::default(), context: Default::default(),
@ -1340,7 +1338,7 @@ impl LspCommand for GetCompletions {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
completions: Option<lsp2::CompletionResponse>, completions: Option<lsp::CompletionResponse>,
_: Model<Project>, _: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -1349,9 +1347,9 @@ impl LspCommand for GetCompletions {
let mut response_list = None; let mut response_list = None;
let completions = if let Some(completions) = completions { let completions = if let Some(completions) = completions {
match completions { match completions {
lsp2::CompletionResponse::Array(completions) => completions, lsp::CompletionResponse::Array(completions) => completions,
lsp2::CompletionResponse::List(mut list) => { lsp::CompletionResponse::List(mut list) => {
let items = std::mem::take(&mut list.items); let items = std::mem::take(&mut list.items);
response_list = Some(list); response_list = Some(list);
items items
@ -1373,7 +1371,7 @@ impl LspCommand for GetCompletions {
let (old_range, mut new_text) = match lsp_completion.text_edit.as_ref() { let (old_range, mut new_text) = match lsp_completion.text_edit.as_ref() {
// If the language server provides a range to overwrite, then // If the language server provides a range to overwrite, then
// check that the range is valid. // check that the range is valid.
Some(lsp2::CompletionTextEdit::Edit(edit)) => { Some(lsp::CompletionTextEdit::Edit(edit)) => {
let range = range_from_lsp(edit.range); let range = range_from_lsp(edit.range);
let start = snapshot.clip_point_utf16(range.start, Bias::Left); let start = snapshot.clip_point_utf16(range.start, Bias::Left);
let end = snapshot.clip_point_utf16(range.end, Bias::Left); let end = snapshot.clip_point_utf16(range.end, Bias::Left);
@ -1439,7 +1437,7 @@ impl LspCommand for GetCompletions {
(range, text) (range, text)
} }
Some(lsp2::CompletionTextEdit::InsertAndReplace(_)) => { Some(lsp::CompletionTextEdit::InsertAndReplace(_)) => {
log::info!("unsupported insert/replace completion"); log::info!("unsupported insert/replace completion");
return None; return None;
} }
@ -1457,7 +1455,7 @@ impl LspCommand for GetCompletions {
old_range, old_range,
new_text, new_text,
label: label.unwrap_or_else(|| { label: label.unwrap_or_else(|| {
language2::CodeLabel::plain( language::CodeLabel::plain(
lsp_completion.label.clone(), lsp_completion.label.clone(),
lsp_completion.filter_text.as_deref(), lsp_completion.filter_text.as_deref(),
) )
@ -1477,7 +1475,7 @@ impl LspCommand for GetCompletions {
proto::GetCompletions { proto::GetCompletions {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor(&anchor)), position: Some(language::proto::serialize_anchor(&anchor)),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
} }
} }
@ -1494,7 +1492,7 @@ impl LspCommand for GetCompletions {
.await?; .await?;
let position = message let position = message
.position .position
.and_then(language2::proto::deserialize_anchor) .and_then(language::proto::deserialize_anchor)
.map(|p| { .map(|p| {
buffer.update(&mut cx, |buffer, _| { buffer.update(&mut cx, |buffer, _| {
buffer.clip_point_utf16(Unclipped(p.to_point_utf16(buffer)), Bias::Left) buffer.clip_point_utf16(Unclipped(p.to_point_utf16(buffer)), Bias::Left)
@ -1514,7 +1512,7 @@ impl LspCommand for GetCompletions {
proto::GetCompletionsResponse { proto::GetCompletionsResponse {
completions: completions completions: completions
.iter() .iter()
.map(language2::proto::serialize_completion) .map(language::proto::serialize_completion)
.collect(), .collect(),
version: serialize_version(&buffer_version), version: serialize_version(&buffer_version),
} }
@ -1535,7 +1533,7 @@ impl LspCommand for GetCompletions {
let language = buffer.update(&mut cx, |buffer, _| buffer.language().cloned())?; let language = buffer.update(&mut cx, |buffer, _| buffer.language().cloned())?;
let completions = message.completions.into_iter().map(|completion| { let completions = message.completions.into_iter().map(|completion| {
language2::proto::deserialize_completion(completion, language.clone()) language::proto::deserialize_completion(completion, language.clone())
}); });
future::try_join_all(completions).await future::try_join_all(completions).await
} }
@ -1548,13 +1546,13 @@ impl LspCommand for GetCompletions {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for GetCodeActions { impl LspCommand for GetCodeActions {
type Response = Vec<CodeAction>; type Response = Vec<CodeAction>;
type LspRequest = lsp2::request::CodeActionRequest; type LspRequest = lsp::request::CodeActionRequest;
type ProtoRequest = proto::GetCodeActions; type ProtoRequest = proto::GetCodeActions;
fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool { fn check_capabilities(&self, capabilities: &ServerCapabilities) -> bool {
match &capabilities.code_action_provider { match &capabilities.code_action_provider {
None => false, None => false,
Some(lsp2::CodeActionProviderCapability::Simple(false)) => false, Some(lsp::CodeActionProviderCapability::Simple(false)) => false,
_ => true, _ => true,
} }
} }
@ -1565,30 +1563,30 @@ impl LspCommand for GetCodeActions {
buffer: &Buffer, buffer: &Buffer,
language_server: &Arc<LanguageServer>, language_server: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::CodeActionParams { ) -> lsp::CodeActionParams {
let relevant_diagnostics = buffer let relevant_diagnostics = buffer
.snapshot() .snapshot()
.diagnostics_in_range::<_, usize>(self.range.clone(), false) .diagnostics_in_range::<_, usize>(self.range.clone(), false)
.map(|entry| entry.to_lsp_diagnostic_stub()) .map(|entry| entry.to_lsp_diagnostic_stub())
.collect(); .collect();
lsp2::CodeActionParams { lsp::CodeActionParams {
text_document: lsp2::TextDocumentIdentifier::new( text_document: lsp::TextDocumentIdentifier::new(
lsp2::Url::from_file_path(path).unwrap(), lsp::Url::from_file_path(path).unwrap(),
), ),
range: range_to_lsp(self.range.to_point_utf16(buffer)), range: range_to_lsp(self.range.to_point_utf16(buffer)),
work_done_progress_params: Default::default(), work_done_progress_params: Default::default(),
partial_result_params: Default::default(), partial_result_params: Default::default(),
context: lsp2::CodeActionContext { context: lsp::CodeActionContext {
diagnostics: relevant_diagnostics, diagnostics: relevant_diagnostics,
only: language_server.code_action_kinds(), only: language_server.code_action_kinds(),
..lsp2::CodeActionContext::default() ..lsp::CodeActionContext::default()
}, },
} }
} }
async fn response_from_lsp( async fn response_from_lsp(
self, self,
actions: Option<lsp2::CodeActionResponse>, actions: Option<lsp::CodeActionResponse>,
_: Model<Project>, _: Model<Project>,
_: Model<Buffer>, _: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -1598,7 +1596,7 @@ impl LspCommand for GetCodeActions {
.unwrap_or_default() .unwrap_or_default()
.into_iter() .into_iter()
.filter_map(|entry| { .filter_map(|entry| {
if let lsp2::CodeActionOrCommand::CodeAction(lsp_action) = entry { if let lsp::CodeActionOrCommand::CodeAction(lsp_action) = entry {
Some(CodeAction { Some(CodeAction {
server_id, server_id,
range: self.range.clone(), range: self.range.clone(),
@ -1615,8 +1613,8 @@ impl LspCommand for GetCodeActions {
proto::GetCodeActions { proto::GetCodeActions {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
start: Some(language2::proto::serialize_anchor(&self.range.start)), start: Some(language::proto::serialize_anchor(&self.range.start)),
end: Some(language2::proto::serialize_anchor(&self.range.end)), end: Some(language::proto::serialize_anchor(&self.range.end)),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
} }
} }
@ -1629,11 +1627,11 @@ impl LspCommand for GetCodeActions {
) -> Result<Self> { ) -> Result<Self> {
let start = message let start = message
.start .start
.and_then(language2::proto::deserialize_anchor) .and_then(language::proto::deserialize_anchor)
.ok_or_else(|| anyhow!("invalid start"))?; .ok_or_else(|| anyhow!("invalid start"))?;
let end = message let end = message
.end .end
.and_then(language2::proto::deserialize_anchor) .and_then(language::proto::deserialize_anchor)
.ok_or_else(|| anyhow!("invalid end"))?; .ok_or_else(|| anyhow!("invalid end"))?;
buffer buffer
.update(&mut cx, |buffer, _| { .update(&mut cx, |buffer, _| {
@ -1654,7 +1652,7 @@ impl LspCommand for GetCodeActions {
proto::GetCodeActionsResponse { proto::GetCodeActionsResponse {
actions: code_actions actions: code_actions
.iter() .iter()
.map(language2::proto::serialize_code_action) .map(language::proto::serialize_code_action)
.collect(), .collect(),
version: serialize_version(&buffer_version), version: serialize_version(&buffer_version),
} }
@ -1675,7 +1673,7 @@ impl LspCommand for GetCodeActions {
message message
.actions .actions
.into_iter() .into_iter()
.map(language2::proto::deserialize_code_action) .map(language::proto::deserialize_code_action)
.collect() .collect()
} }
@ -1687,10 +1685,10 @@ impl LspCommand for GetCodeActions {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for OnTypeFormatting { impl LspCommand for OnTypeFormatting {
type Response = Option<Transaction>; type Response = Option<Transaction>;
type LspRequest = lsp2::request::OnTypeFormatting; type LspRequest = lsp::request::OnTypeFormatting;
type ProtoRequest = proto::OnTypeFormatting; type ProtoRequest = proto::OnTypeFormatting;
fn check_capabilities(&self, server_capabilities: &lsp2::ServerCapabilities) -> bool { fn check_capabilities(&self, server_capabilities: &lsp::ServerCapabilities) -> bool {
let Some(on_type_formatting_options) = let Some(on_type_formatting_options) =
&server_capabilities.document_on_type_formatting_provider &server_capabilities.document_on_type_formatting_provider
else { else {
@ -1712,10 +1710,10 @@ impl LspCommand for OnTypeFormatting {
_: &Buffer, _: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::DocumentOnTypeFormattingParams { ) -> lsp::DocumentOnTypeFormattingParams {
lsp2::DocumentOnTypeFormattingParams { lsp::DocumentOnTypeFormattingParams {
text_document_position: lsp2::TextDocumentPositionParams::new( text_document_position: lsp::TextDocumentPositionParams::new(
lsp2::TextDocumentIdentifier::new(lsp2::Url::from_file_path(path).unwrap()), lsp::TextDocumentIdentifier::new(lsp::Url::from_file_path(path).unwrap()),
point_to_lsp(self.position), point_to_lsp(self.position),
), ),
ch: self.trigger.clone(), ch: self.trigger.clone(),
@ -1725,7 +1723,7 @@ impl LspCommand for OnTypeFormatting {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<Vec<lsp2::TextEdit>>, message: Option<Vec<lsp::TextEdit>>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -1753,7 +1751,7 @@ impl LspCommand for OnTypeFormatting {
proto::OnTypeFormatting { proto::OnTypeFormatting {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
position: Some(language2::proto::serialize_anchor( position: Some(language::proto::serialize_anchor(
&buffer.anchor_before(self.position), &buffer.anchor_before(self.position),
)), )),
trigger: self.trigger.clone(), trigger: self.trigger.clone(),
@ -1798,7 +1796,7 @@ impl LspCommand for OnTypeFormatting {
) -> proto::OnTypeFormattingResponse { ) -> proto::OnTypeFormattingResponse {
proto::OnTypeFormattingResponse { proto::OnTypeFormattingResponse {
transaction: response transaction: response
.map(|transaction| language2::proto::serialize_transaction(&transaction)), .map(|transaction| language::proto::serialize_transaction(&transaction)),
} }
} }
@ -1812,9 +1810,7 @@ impl LspCommand for OnTypeFormatting {
let Some(transaction) = message.transaction else { let Some(transaction) = message.transaction else {
return Ok(None); return Ok(None);
}; };
Ok(Some(language2::proto::deserialize_transaction( Ok(Some(language::proto::deserialize_transaction(transaction)?))
transaction,
)?))
} }
fn buffer_id_from_proto(message: &proto::OnTypeFormatting) -> u64 { fn buffer_id_from_proto(message: &proto::OnTypeFormatting) -> u64 {
@ -1824,7 +1820,7 @@ impl LspCommand for OnTypeFormatting {
impl InlayHints { impl InlayHints {
pub async fn lsp_to_project_hint( pub async fn lsp_to_project_hint(
lsp_hint: lsp2::InlayHint, lsp_hint: lsp::InlayHint,
buffer_handle: &Model<Buffer>, buffer_handle: &Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
resolve_state: ResolveState, resolve_state: ResolveState,
@ -1832,8 +1828,8 @@ impl InlayHints {
cx: &mut AsyncAppContext, cx: &mut AsyncAppContext,
) -> anyhow::Result<InlayHint> { ) -> anyhow::Result<InlayHint> {
let kind = lsp_hint.kind.and_then(|kind| match kind { let kind = lsp_hint.kind.and_then(|kind| match kind {
lsp2::InlayHintKind::TYPE => Some(InlayHintKind::Type), lsp::InlayHintKind::TYPE => Some(InlayHintKind::Type),
lsp2::InlayHintKind::PARAMETER => Some(InlayHintKind::Parameter), lsp::InlayHintKind::PARAMETER => Some(InlayHintKind::Parameter),
_ => None, _ => None,
}); });
@ -1861,12 +1857,12 @@ impl InlayHints {
label, label,
kind, kind,
tooltip: lsp_hint.tooltip.map(|tooltip| match tooltip { tooltip: lsp_hint.tooltip.map(|tooltip| match tooltip {
lsp2::InlayHintTooltip::String(s) => InlayHintTooltip::String(s), lsp::InlayHintTooltip::String(s) => InlayHintTooltip::String(s),
lsp2::InlayHintTooltip::MarkupContent(markup_content) => { lsp::InlayHintTooltip::MarkupContent(markup_content) => {
InlayHintTooltip::MarkupContent(MarkupContent { InlayHintTooltip::MarkupContent(MarkupContent {
kind: match markup_content.kind { kind: match markup_content.kind {
lsp2::MarkupKind::PlainText => HoverBlockKind::PlainText, lsp::MarkupKind::PlainText => HoverBlockKind::PlainText,
lsp2::MarkupKind::Markdown => HoverBlockKind::Markdown, lsp::MarkupKind::Markdown => HoverBlockKind::Markdown,
}, },
value: markup_content.value, value: markup_content.value,
}) })
@ -1877,25 +1873,25 @@ impl InlayHints {
} }
async fn lsp_inlay_label_to_project( async fn lsp_inlay_label_to_project(
lsp_label: lsp2::InlayHintLabel, lsp_label: lsp::InlayHintLabel,
server_id: LanguageServerId, server_id: LanguageServerId,
) -> anyhow::Result<InlayHintLabel> { ) -> anyhow::Result<InlayHintLabel> {
let label = match lsp_label { let label = match lsp_label {
lsp2::InlayHintLabel::String(s) => InlayHintLabel::String(s), lsp::InlayHintLabel::String(s) => InlayHintLabel::String(s),
lsp2::InlayHintLabel::LabelParts(lsp_parts) => { lsp::InlayHintLabel::LabelParts(lsp_parts) => {
let mut parts = Vec::with_capacity(lsp_parts.len()); let mut parts = Vec::with_capacity(lsp_parts.len());
for lsp_part in lsp_parts { for lsp_part in lsp_parts {
parts.push(InlayHintLabelPart { parts.push(InlayHintLabelPart {
value: lsp_part.value, value: lsp_part.value,
tooltip: lsp_part.tooltip.map(|tooltip| match tooltip { tooltip: lsp_part.tooltip.map(|tooltip| match tooltip {
lsp2::InlayHintLabelPartTooltip::String(s) => { lsp::InlayHintLabelPartTooltip::String(s) => {
InlayHintLabelPartTooltip::String(s) InlayHintLabelPartTooltip::String(s)
} }
lsp2::InlayHintLabelPartTooltip::MarkupContent(markup_content) => { lsp::InlayHintLabelPartTooltip::MarkupContent(markup_content) => {
InlayHintLabelPartTooltip::MarkupContent(MarkupContent { InlayHintLabelPartTooltip::MarkupContent(MarkupContent {
kind: match markup_content.kind { kind: match markup_content.kind {
lsp2::MarkupKind::PlainText => HoverBlockKind::PlainText, lsp::MarkupKind::PlainText => HoverBlockKind::PlainText,
lsp2::MarkupKind::Markdown => HoverBlockKind::Markdown, lsp::MarkupKind::Markdown => HoverBlockKind::Markdown,
}, },
value: markup_content.value, value: markup_content.value,
}) })
@ -1933,7 +1929,7 @@ impl InlayHints {
lsp_resolve_state, lsp_resolve_state,
}); });
proto::InlayHint { proto::InlayHint {
position: Some(language2::proto::serialize_anchor(&response_hint.position)), position: Some(language::proto::serialize_anchor(&response_hint.position)),
padding_left: response_hint.padding_left, padding_left: response_hint.padding_left,
padding_right: response_hint.padding_right, padding_right: response_hint.padding_right,
label: Some(proto::InlayHintLabel { label: Some(proto::InlayHintLabel {
@ -1992,7 +1988,7 @@ impl InlayHints {
let resolve_state_data = resolve_state let resolve_state_data = resolve_state
.lsp_resolve_state.as_ref() .lsp_resolve_state.as_ref()
.map(|lsp_resolve_state| { .map(|lsp_resolve_state| {
serde_json::from_str::<Option<lsp2::LSPAny>>(&lsp_resolve_state.value) serde_json::from_str::<Option<lsp::LSPAny>>(&lsp_resolve_state.value)
.with_context(|| format!("incorrect proto inlay hint message: non-json resolve state {lsp_resolve_state:?}")) .with_context(|| format!("incorrect proto inlay hint message: non-json resolve state {lsp_resolve_state:?}"))
.map(|state| (LanguageServerId(lsp_resolve_state.server_id as usize), state)) .map(|state| (LanguageServerId(lsp_resolve_state.server_id as usize), state))
}) })
@ -2015,7 +2011,7 @@ impl InlayHints {
Ok(InlayHint { Ok(InlayHint {
position: message_hint position: message_hint
.position .position
.and_then(language2::proto::deserialize_anchor) .and_then(language::proto::deserialize_anchor)
.context("invalid position")?, .context("invalid position")?,
label: match message_hint label: match message_hint
.label .label
@ -2058,10 +2054,10 @@ impl InlayHints {
{ {
Some(((uri, range), server_id)) => Some(( Some(((uri, range), server_id)) => Some((
LanguageServerId(server_id as usize), LanguageServerId(server_id as usize),
lsp2::Location { lsp::Location {
uri: lsp2::Url::parse(&uri) uri: lsp::Url::parse(&uri)
.context("invalid uri in hint part {part:?}")?, .context("invalid uri in hint part {part:?}")?,
range: lsp2::Range::new( range: lsp::Range::new(
point_to_lsp(PointUtf16::new( point_to_lsp(PointUtf16::new(
range.start.row, range.start.row,
range.start.column, range.start.column,
@ -2107,22 +2103,22 @@ impl InlayHints {
}) })
} }
pub fn project_to_lsp_hint(hint: InlayHint, snapshot: &BufferSnapshot) -> lsp2::InlayHint { pub fn project_to_lsp_hint(hint: InlayHint, snapshot: &BufferSnapshot) -> lsp::InlayHint {
lsp2::InlayHint { lsp::InlayHint {
position: point_to_lsp(hint.position.to_point_utf16(snapshot)), position: point_to_lsp(hint.position.to_point_utf16(snapshot)),
kind: hint.kind.map(|kind| match kind { kind: hint.kind.map(|kind| match kind {
InlayHintKind::Type => lsp2::InlayHintKind::TYPE, InlayHintKind::Type => lsp::InlayHintKind::TYPE,
InlayHintKind::Parameter => lsp2::InlayHintKind::PARAMETER, InlayHintKind::Parameter => lsp::InlayHintKind::PARAMETER,
}), }),
text_edits: None, text_edits: None,
tooltip: hint.tooltip.and_then(|tooltip| { tooltip: hint.tooltip.and_then(|tooltip| {
Some(match tooltip { Some(match tooltip {
InlayHintTooltip::String(s) => lsp2::InlayHintTooltip::String(s), InlayHintTooltip::String(s) => lsp::InlayHintTooltip::String(s),
InlayHintTooltip::MarkupContent(markup_content) => { InlayHintTooltip::MarkupContent(markup_content) => {
lsp2::InlayHintTooltip::MarkupContent(lsp2::MarkupContent { lsp::InlayHintTooltip::MarkupContent(lsp::MarkupContent {
kind: match markup_content.kind { kind: match markup_content.kind {
HoverBlockKind::PlainText => lsp2::MarkupKind::PlainText, HoverBlockKind::PlainText => lsp::MarkupKind::PlainText,
HoverBlockKind::Markdown => lsp2::MarkupKind::Markdown, HoverBlockKind::Markdown => lsp::MarkupKind::Markdown,
HoverBlockKind::Code { .. } => return None, HoverBlockKind::Code { .. } => return None,
}, },
value: markup_content.value, value: markup_content.value,
@ -2131,26 +2127,26 @@ impl InlayHints {
}) })
}), }),
label: match hint.label { label: match hint.label {
InlayHintLabel::String(s) => lsp2::InlayHintLabel::String(s), InlayHintLabel::String(s) => lsp::InlayHintLabel::String(s),
InlayHintLabel::LabelParts(label_parts) => lsp2::InlayHintLabel::LabelParts( InlayHintLabel::LabelParts(label_parts) => lsp::InlayHintLabel::LabelParts(
label_parts label_parts
.into_iter() .into_iter()
.map(|part| lsp2::InlayHintLabelPart { .map(|part| lsp::InlayHintLabelPart {
value: part.value, value: part.value,
tooltip: part.tooltip.and_then(|tooltip| { tooltip: part.tooltip.and_then(|tooltip| {
Some(match tooltip { Some(match tooltip {
InlayHintLabelPartTooltip::String(s) => { InlayHintLabelPartTooltip::String(s) => {
lsp2::InlayHintLabelPartTooltip::String(s) lsp::InlayHintLabelPartTooltip::String(s)
} }
InlayHintLabelPartTooltip::MarkupContent(markup_content) => { InlayHintLabelPartTooltip::MarkupContent(markup_content) => {
lsp2::InlayHintLabelPartTooltip::MarkupContent( lsp::InlayHintLabelPartTooltip::MarkupContent(
lsp2::MarkupContent { lsp::MarkupContent {
kind: match markup_content.kind { kind: match markup_content.kind {
HoverBlockKind::PlainText => { HoverBlockKind::PlainText => {
lsp2::MarkupKind::PlainText lsp::MarkupKind::PlainText
} }
HoverBlockKind::Markdown => { HoverBlockKind::Markdown => {
lsp2::MarkupKind::Markdown lsp::MarkupKind::Markdown
} }
HoverBlockKind::Code { .. } => return None, HoverBlockKind::Code { .. } => return None,
}, },
@ -2182,8 +2178,8 @@ impl InlayHints {
.and_then(|options| match options { .and_then(|options| match options {
OneOf::Left(_is_supported) => None, OneOf::Left(_is_supported) => None,
OneOf::Right(capabilities) => match capabilities { OneOf::Right(capabilities) => match capabilities {
lsp2::InlayHintServerCapabilities::Options(o) => o.resolve_provider, lsp::InlayHintServerCapabilities::Options(o) => o.resolve_provider,
lsp2::InlayHintServerCapabilities::RegistrationOptions(o) => { lsp::InlayHintServerCapabilities::RegistrationOptions(o) => {
o.inlay_hint_options.resolve_provider o.inlay_hint_options.resolve_provider
} }
}, },
@ -2195,18 +2191,18 @@ impl InlayHints {
#[async_trait(?Send)] #[async_trait(?Send)]
impl LspCommand for InlayHints { impl LspCommand for InlayHints {
type Response = Vec<InlayHint>; type Response = Vec<InlayHint>;
type LspRequest = lsp2::InlayHintRequest; type LspRequest = lsp::InlayHintRequest;
type ProtoRequest = proto::InlayHints; type ProtoRequest = proto::InlayHints;
fn check_capabilities(&self, server_capabilities: &lsp2::ServerCapabilities) -> bool { fn check_capabilities(&self, server_capabilities: &lsp::ServerCapabilities) -> bool {
let Some(inlay_hint_provider) = &server_capabilities.inlay_hint_provider else { let Some(inlay_hint_provider) = &server_capabilities.inlay_hint_provider else {
return false; return false;
}; };
match inlay_hint_provider { match inlay_hint_provider {
lsp2::OneOf::Left(enabled) => *enabled, lsp::OneOf::Left(enabled) => *enabled,
lsp2::OneOf::Right(inlay_hint_capabilities) => match inlay_hint_capabilities { lsp::OneOf::Right(inlay_hint_capabilities) => match inlay_hint_capabilities {
lsp2::InlayHintServerCapabilities::Options(_) => true, lsp::InlayHintServerCapabilities::Options(_) => true,
lsp2::InlayHintServerCapabilities::RegistrationOptions(_) => false, lsp::InlayHintServerCapabilities::RegistrationOptions(_) => false,
}, },
} }
} }
@ -2217,10 +2213,10 @@ impl LspCommand for InlayHints {
buffer: &Buffer, buffer: &Buffer,
_: &Arc<LanguageServer>, _: &Arc<LanguageServer>,
_: &AppContext, _: &AppContext,
) -> lsp2::InlayHintParams { ) -> lsp::InlayHintParams {
lsp2::InlayHintParams { lsp::InlayHintParams {
text_document: lsp2::TextDocumentIdentifier { text_document: lsp::TextDocumentIdentifier {
uri: lsp2::Url::from_file_path(path).unwrap(), uri: lsp::Url::from_file_path(path).unwrap(),
}, },
range: range_to_lsp(self.range.to_point_utf16(buffer)), range: range_to_lsp(self.range.to_point_utf16(buffer)),
work_done_progress_params: Default::default(), work_done_progress_params: Default::default(),
@ -2229,7 +2225,7 @@ impl LspCommand for InlayHints {
async fn response_from_lsp( async fn response_from_lsp(
self, self,
message: Option<Vec<lsp2::InlayHint>>, message: Option<Vec<lsp::InlayHint>>,
project: Model<Project>, project: Model<Project>,
buffer: Model<Buffer>, buffer: Model<Buffer>,
server_id: LanguageServerId, server_id: LanguageServerId,
@ -2278,8 +2274,8 @@ impl LspCommand for InlayHints {
proto::InlayHints { proto::InlayHints {
project_id, project_id,
buffer_id: buffer.remote_id(), buffer_id: buffer.remote_id(),
start: Some(language2::proto::serialize_anchor(&self.range.start)), start: Some(language::proto::serialize_anchor(&self.range.start)),
end: Some(language2::proto::serialize_anchor(&self.range.end)), end: Some(language::proto::serialize_anchor(&self.range.end)),
version: serialize_version(&buffer.version()), version: serialize_version(&buffer.version()),
} }
} }
@ -2292,11 +2288,11 @@ impl LspCommand for InlayHints {
) -> Result<Self> { ) -> Result<Self> {
let start = message let start = message
.start .start
.and_then(language2::proto::deserialize_anchor) .and_then(language::proto::deserialize_anchor)
.context("invalid start")?; .context("invalid start")?;
let end = message let end = message
.end .end
.and_then(language2::proto::deserialize_anchor) .and_then(language::proto::deserialize_anchor)
.context("invalid end")?; .context("invalid end")?;
buffer buffer
.update(&mut cx, |buffer, _| { .update(&mut cx, |buffer, _| {

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,8 @@
use collections::HashMap; use collections::HashMap;
use gpui2::AppContext; use gpui::AppContext;
use schemars::JsonSchema; use schemars::JsonSchema;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings2::Settings; use settings::Settings;
use std::sync::Arc; use std::sync::Arc;
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)] #[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
use aho_corasick::{AhoCorasick, AhoCorasickBuilder}; use aho_corasick::{AhoCorasick, AhoCorasickBuilder};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use client2::proto; use client::proto;
use globset::{Glob, GlobMatcher}; use globset::{Glob, GlobMatcher};
use itertools::Itertools; use itertools::Itertools;
use language2::{char_kind, BufferSnapshot}; use language::{char_kind, BufferSnapshot};
use regex::{Regex, RegexBuilder}; use regex::{Regex, RegexBuilder};
use smol::future::yield_now; use smol::future::yield_now;
use std::{ use std::{

View file

@ -1,8 +1,8 @@
use crate::Project; use crate::Project;
use gpui2::{AnyWindowHandle, Context, Entity, Model, ModelContext, WeakModel}; use gpui::{AnyWindowHandle, Context, Entity, Model, ModelContext, WeakModel};
use settings2::Settings; use settings::Settings;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use terminal2::{ use terminal::{
terminal_settings::{self, TerminalSettings, VenvSettingsContent}, terminal_settings::{self, TerminalSettings, VenvSettingsContent},
Terminal, TerminalBuilder, Terminal, TerminalBuilder,
}; };
@ -11,7 +11,7 @@ use terminal2::{
use std::os::unix::ffi::OsStrExt; use std::os::unix::ffi::OsStrExt;
pub struct Terminals { pub struct Terminals {
pub(crate) local_handles: Vec<WeakModel<terminal2::Terminal>>, pub(crate) local_handles: Vec<WeakModel<terminal::Terminal>>,
} }
impl Project { impl Project {
@ -121,7 +121,7 @@ impl Project {
} }
} }
pub fn local_terminal_handles(&self) -> &Vec<WeakModel<terminal2::Terminal>> { pub fn local_terminal_handles(&self) -> &Vec<WeakModel<terminal::Terminal>> {
&self.terminals.local_handles &self.terminals.local_handles
} }
} }

View file

@ -3,10 +3,10 @@ use crate::{
}; };
use ::ignore::gitignore::{Gitignore, GitignoreBuilder}; use ::ignore::gitignore::{Gitignore, GitignoreBuilder};
use anyhow::{anyhow, Context as _, Result}; use anyhow::{anyhow, Context as _, Result};
use client2::{proto, Client}; use client::{proto, Client};
use clock::ReplicaId; use clock::ReplicaId;
use collections::{HashMap, HashSet, VecDeque}; use collections::{HashMap, HashSet, VecDeque};
use fs2::{ use fs::{
repository::{GitFileStatus, GitRepository, RepoPath}, repository::{GitFileStatus, GitRepository, RepoPath},
Fs, Fs,
}; };
@ -19,20 +19,20 @@ use futures::{
task::Poll, task::Poll,
FutureExt as _, Stream, StreamExt, FutureExt as _, Stream, StreamExt,
}; };
use fuzzy2::CharBag; use fuzzy::CharBag;
use git::{DOT_GIT, GITIGNORE}; use git::{DOT_GIT, GITIGNORE};
use gpui2::{ use gpui::{
AppContext, AsyncAppContext, BackgroundExecutor, Context, EventEmitter, Model, ModelContext, AppContext, AsyncAppContext, BackgroundExecutor, Context, EventEmitter, Model, ModelContext,
Task, Task,
}; };
use language2::{ use language::{
proto::{ proto::{
deserialize_fingerprint, deserialize_version, serialize_fingerprint, serialize_line_ending, deserialize_fingerprint, deserialize_version, serialize_fingerprint, serialize_line_ending,
serialize_version, serialize_version,
}, },
Buffer, DiagnosticEntry, File as _, LineEnding, PointUtf16, Rope, RopeFingerprint, Unclipped, Buffer, DiagnosticEntry, File as _, LineEnding, PointUtf16, Rope, RopeFingerprint, Unclipped,
}; };
use lsp2::LanguageServerId; use lsp::LanguageServerId;
use parking_lot::Mutex; use parking_lot::Mutex;
use postage::{ use postage::{
barrier, barrier,
@ -2587,8 +2587,8 @@ pub struct File {
pub(crate) is_deleted: bool, pub(crate) is_deleted: bool,
} }
impl language2::File for File { impl language::File for File {
fn as_local(&self) -> Option<&dyn language2::LocalFile> { fn as_local(&self) -> Option<&dyn language::LocalFile> {
if self.is_local { if self.is_local {
Some(self) Some(self)
} else { } else {
@ -2648,8 +2648,8 @@ impl language2::File for File {
self self
} }
fn to_proto(&self) -> rpc2::proto::File { fn to_proto(&self) -> rpc::proto::File {
rpc2::proto::File { rpc::proto::File {
worktree_id: self.worktree.entity_id().as_u64(), worktree_id: self.worktree.entity_id().as_u64(),
entry_id: self.entry_id.to_proto(), entry_id: self.entry_id.to_proto(),
path: self.path.to_string_lossy().into(), path: self.path.to_string_lossy().into(),
@ -2659,7 +2659,7 @@ impl language2::File for File {
} }
} }
impl language2::LocalFile for File { impl language::LocalFile for File {
fn abs_path(&self, cx: &AppContext) -> PathBuf { fn abs_path(&self, cx: &AppContext) -> PathBuf {
let worktree_path = &self.worktree.read(cx).as_local().unwrap().abs_path; let worktree_path = &self.worktree.read(cx).as_local().unwrap().abs_path;
if self.path.as_ref() == Path::new("") { if self.path.as_ref() == Path::new("") {
@ -2716,7 +2716,7 @@ impl File {
} }
pub fn from_proto( pub fn from_proto(
proto: rpc2::proto::File, proto: rpc::proto::File,
worktree: Model<Worktree>, worktree: Model<Worktree>,
cx: &AppContext, cx: &AppContext,
) -> Result<Self> { ) -> Result<Self> {
@ -2740,7 +2740,7 @@ impl File {
}) })
} }
pub fn from_dyn(file: Option<&Arc<dyn language2::File>>) -> Option<&Self> { pub fn from_dyn(file: Option<&Arc<dyn language::File>>) -> Option<&Self> {
file.and_then(|f| f.as_any().downcast_ref()) file.and_then(|f| f.as_any().downcast_ref())
} }
@ -2818,7 +2818,7 @@ pub type UpdatedGitRepositoriesSet = Arc<[(Arc<Path>, GitRepositoryChange)]>;
impl Entry { impl Entry {
fn new( fn new(
path: Arc<Path>, path: Arc<Path>,
metadata: &fs2::Metadata, metadata: &fs::Metadata,
next_entry_id: &AtomicUsize, next_entry_id: &AtomicUsize,
root_char_bag: CharBag, root_char_bag: CharBag,
) -> Self { ) -> Self {
@ -4037,7 +4037,7 @@ pub trait WorktreeModelHandle {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
fn flush_fs_events<'a>( fn flush_fs_events<'a>(
&self, &self,
cx: &'a mut gpui2::TestAppContext, cx: &'a mut gpui::TestAppContext,
) -> futures::future::LocalBoxFuture<'a, ()>; ) -> futures::future::LocalBoxFuture<'a, ()>;
} }
@ -4051,7 +4051,7 @@ impl WorktreeModelHandle for Model<Worktree> {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
fn flush_fs_events<'a>( fn flush_fs_events<'a>(
&self, &self,
cx: &'a mut gpui2::TestAppContext, cx: &'a mut gpui::TestAppContext,
) -> futures::future::LocalBoxFuture<'a, ()> { ) -> futures::future::LocalBoxFuture<'a, ()> {
let file_name = "fs-event-sentinel"; let file_name = "fs-event-sentinel";

View file

@ -10,12 +10,12 @@ path = "src/rpc.rs"
doctest = false doctest = false
[features] [features]
test-support = ["collections/test-support", "gpui2/test-support"] test-support = ["collections/test-support", "gpui/test-support"]
[dependencies] [dependencies]
clock = { path = "../clock" } clock = { path = "../clock" }
collections = { path = "../collections" } collections = { path = "../collections" }
gpui2 = { path = "../gpui2", optional = true } gpui = { package = "gpui2", path = "../gpui2", optional = true }
util = { path = "../util" } util = { path = "../util" }
anyhow.workspace = true anyhow.workspace = true
async-lock = "2.4" async-lock = "2.4"
@ -37,7 +37,7 @@ prost-build = "0.9"
[dev-dependencies] [dev-dependencies]
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
smol.workspace = true smol.workspace = true
tempdir.workspace = true tempdir.workspace = true
ctor.workspace = true ctor.workspace = true

View file

@ -34,7 +34,7 @@ impl Connection {
#[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
pub fn in_memory( pub fn in_memory(
executor: gpui2::BackgroundExecutor, executor: gpui::BackgroundExecutor,
) -> (Self, Self, std::sync::Arc<std::sync::atomic::AtomicBool>) { ) -> (Self, Self, std::sync::Arc<std::sync::atomic::AtomicBool>) {
use std::sync::{ use std::sync::{
atomic::{AtomicBool, Ordering::SeqCst}, atomic::{AtomicBool, Ordering::SeqCst},
@ -53,7 +53,7 @@ impl Connection {
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
fn channel( fn channel(
killed: Arc<AtomicBool>, killed: Arc<AtomicBool>,
executor: gpui2::BackgroundExecutor, executor: gpui::BackgroundExecutor,
) -> ( ) -> (
Box<dyn Send + Unpin + futures::Sink<WebSocketMessage, Error = anyhow::Error>>, Box<dyn Send + Unpin + futures::Sink<WebSocketMessage, Error = anyhow::Error>>,
Box<dyn Send + Unpin + futures::Stream<Item = Result<WebSocketMessage, anyhow::Error>>>, Box<dyn Send + Unpin + futures::Stream<Item = Result<WebSocketMessage, anyhow::Error>>>,

View file

@ -342,7 +342,7 @@ impl Peer {
pub fn add_test_connection( pub fn add_test_connection(
self: &Arc<Self>, self: &Arc<Self>,
connection: Connection, connection: Connection,
executor: gpui2::BackgroundExecutor, executor: gpui::BackgroundExecutor,
) -> ( ) -> (
ConnectionId, ConnectionId,
impl Future<Output = anyhow::Result<()>> + Send, impl Future<Output = anyhow::Result<()>> + Send,
@ -557,7 +557,7 @@ mod tests {
use super::*; use super::*;
use crate::TypedEnvelope; use crate::TypedEnvelope;
use async_tungstenite::tungstenite::Message as WebSocketMessage; use async_tungstenite::tungstenite::Message as WebSocketMessage;
use gpui2::TestAppContext; use gpui::TestAppContext;
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { if std::env::var("RUST_LOG").is_ok() {
@ -565,7 +565,7 @@ mod tests {
} }
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
async fn test_request_response(cx: &mut TestAppContext) { async fn test_request_response(cx: &mut TestAppContext) {
init_logger(); init_logger();
@ -663,7 +663,7 @@ mod tests {
} }
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
async fn test_order_of_response_and_incoming(cx: &mut TestAppContext) { async fn test_order_of_response_and_incoming(cx: &mut TestAppContext) {
let executor = cx.executor(); let executor = cx.executor();
let server = Peer::new(0); let server = Peer::new(0);
@ -761,7 +761,7 @@ mod tests {
); );
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
async fn test_dropping_request_before_completion(cx: &mut TestAppContext) { async fn test_dropping_request_before_completion(cx: &mut TestAppContext) {
let executor = cx.executor().clone(); let executor = cx.executor().clone();
let server = Peer::new(0); let server = Peer::new(0);
@ -873,7 +873,7 @@ mod tests {
); );
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
async fn test_disconnect(cx: &mut TestAppContext) { async fn test_disconnect(cx: &mut TestAppContext) {
let executor = cx.executor(); let executor = cx.executor();
@ -909,7 +909,7 @@ mod tests {
.is_err()); .is_err());
} }
#[gpui2::test(iterations = 50)] #[gpui::test(iterations = 50)]
async fn test_io_error(cx: &mut TestAppContext) { async fn test_io_error(cx: &mut TestAppContext) {
let executor = cx.executor(); let executor = cx.executor();
let (client_conn, mut server_conn, _kill) = Connection::in_memory(executor.clone()); let (client_conn, mut server_conn, _kill) = Connection::in_memory(executor.clone());

View file

@ -616,7 +616,7 @@ pub fn split_worktree_update(
mod tests { mod tests {
use super::*; use super::*;
#[gpui2::test] #[gpui::test]
async fn test_buffer_size() { async fn test_buffer_size() {
let (tx, rx) = futures::channel::mpsc::unbounded(); let (tx, rx) = futures::channel::mpsc::unbounded();
let mut sink = MessageStream::new(tx.sink_map_err(|_| anyhow!(""))); let mut sink = MessageStream::new(tx.sink_map_err(|_| anyhow!("")));
@ -648,7 +648,7 @@ mod tests {
assert!(stream.encoding_buffer.capacity() <= MAX_BUFFER_LEN); assert!(stream.encoding_buffer.capacity() <= MAX_BUFFER_LEN);
} }
#[gpui2::test] #[gpui::test]
fn test_converting_peer_id_from_and_to_u64() { fn test_converting_peer_id_from_and_to_u64() {
let peer_id = PeerId { let peer_id = PeerId {
owner_id: 10, owner_id: 10,

View file

@ -9,14 +9,14 @@ path = "src/settings2.rs"
doctest = false doctest = false
[features] [features]
test-support = ["gpui2/test-support", "fs/test-support"] test-support = ["gpui/test-support", "fs/test-support"]
[dependencies] [dependencies]
collections = { path = "../collections" } collections = { path = "../collections" }
gpui2 = { path = "../gpui2" } gpui = {package = "gpui2", path = "../gpui2" }
sqlez = { path = "../sqlez" } sqlez = { path = "../sqlez" }
fs2 = { path = "../fs2" } fs = {package = "fs2", path = "../fs2" }
feature_flags2 = { path = "../feature_flags2" } feature_flags = {package = "feature_flags2", path = "../feature_flags2" }
util = { path = "../util" } util = { path = "../util" }
anyhow.workspace = true anyhow.workspace = true
@ -35,8 +35,8 @@ tree-sitter.workspace = true
tree-sitter-json = "*" tree-sitter-json = "*"
[dev-dependencies] [dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = {package = "gpui2", path = "../gpui2", features = ["test-support"] }
fs = { path = "../fs", features = ["test-support"] } fs = { package = "fs2", path = "../fs2", features = ["test-support"] }
indoc.workspace = true indoc.workspace = true
pretty_assertions.workspace = true pretty_assertions.workspace = true
unindent.workspace = true unindent.workspace = true

View file

@ -1,7 +1,7 @@
use crate::{settings_store::parse_json_with_comments, SettingsAssets}; use crate::{settings_store::parse_json_with_comments, SettingsAssets};
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use collections::BTreeMap; use collections::BTreeMap;
use gpui2::{AppContext, KeyBinding, SharedString}; use gpui::{AppContext, KeyBinding, SharedString};
use schemars::{ use schemars::{
gen::{SchemaGenerator, SchemaSettings}, gen::{SchemaGenerator, SchemaSettings},
schema::{InstanceType, Schema, SchemaObject, SingleOrVec, SubschemaValidation}, schema::{InstanceType, Schema, SchemaObject, SingleOrVec, SubschemaValidation},
@ -137,7 +137,7 @@ impl KeymapFile {
} }
} }
fn no_action() -> Box<dyn gpui2::Action> { fn no_action() -> Box<dyn gpui::Action> {
todo!() todo!()
} }

View file

@ -1,8 +1,8 @@
use crate::{settings_store::SettingsStore, Settings}; use crate::{settings_store::SettingsStore, Settings};
use anyhow::Result; use anyhow::Result;
use fs2::Fs; use fs::Fs;
use futures::{channel::mpsc, StreamExt}; use futures::{channel::mpsc, StreamExt};
use gpui2::{AppContext, BackgroundExecutor}; use gpui::{AppContext, BackgroundExecutor};
use std::{io::ErrorKind, path::PathBuf, str, sync::Arc, time::Duration}; use std::{io::ErrorKind, path::PathBuf, str, sync::Arc, time::Duration};
use util::{paths, ResultExt}; use util::{paths, ResultExt};

View file

@ -1,6 +1,6 @@
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use collections::{btree_map, hash_map, BTreeMap, HashMap}; use collections::{btree_map, hash_map, BTreeMap, HashMap};
use gpui2::AppContext; use gpui::AppContext;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use schemars::{gen::SchemaGenerator, schema::RootSchema, JsonSchema}; use schemars::{gen::SchemaGenerator, schema::RootSchema, JsonSchema};
use serde::{de::DeserializeOwned, Deserialize as _, Serialize}; use serde::{de::DeserializeOwned, Deserialize as _, Serialize};
@ -877,7 +877,7 @@ mod tests {
use serde_derive::Deserialize; use serde_derive::Deserialize;
use unindent::Unindent; use unindent::Unindent;
#[gpui2::test] #[gpui::test]
fn test_settings_store_basic(cx: &mut AppContext) { fn test_settings_store_basic(cx: &mut AppContext) {
let mut store = SettingsStore::default(); let mut store = SettingsStore::default();
store.register_setting::<UserSettings>(cx); store.register_setting::<UserSettings>(cx);
@ -994,7 +994,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_setting_store_assign_json_before_register(cx: &mut AppContext) { fn test_setting_store_assign_json_before_register(cx: &mut AppContext) {
let mut store = SettingsStore::default(); let mut store = SettingsStore::default();
store store
@ -1037,7 +1037,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_setting_store_update(cx: &mut AppContext) { fn test_setting_store_update(cx: &mut AppContext) {
let mut store = SettingsStore::default(); let mut store = SettingsStore::default();
store.register_setting::<MultiKeySettings>(cx); store.register_setting::<MultiKeySettings>(cx);

View file

@ -10,10 +10,10 @@ doctest = false
[dependencies] [dependencies]
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
db2 = { path = "../db2" } db = { package = "db2", path = "../db2" }
theme2 = { path = "../theme2" } theme = { package = "theme2", path = "../theme2" }
util = { path = "../util" } util = { path = "../util" }
alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "33306142195b354ef3485ca2b1d8a85dfc6605ca" } alacritty_terminal = { git = "https://github.com/zed-industries/alacritty", rev = "33306142195b354ef3485ca2b1d8a85dfc6605ca" }

View file

@ -113,7 +113,7 @@ use alacritty_terminal::term::color::Rgb as AlacRgb;
// let b = (i % 36) % 6; // let b = (i % 36) % 6;
// (r, g, b) // (r, g, b)
// } // }
use gpui2::Rgba; use gpui::Rgba;
//Convenience method to convert from a GPUI color to an alacritty Rgb //Convenience method to convert from a GPUI color to an alacritty Rgb
pub fn to_alac_rgb(color: impl Into<Rgba>) -> AlacRgb { pub fn to_alac_rgb(color: impl Into<Rgba>) -> AlacRgb {

View file

@ -1,6 +1,6 @@
/// The mappings defined in this file where created from reading the alacritty source /// The mappings defined in this file where created from reading the alacritty source
use alacritty_terminal::term::TermMode; use alacritty_terminal::term::TermMode;
use gpui2::Keystroke; use gpui::Keystroke;
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
enum AlacModifiers { enum AlacModifiers {
@ -278,7 +278,7 @@ fn modifier_code(keystroke: &Keystroke) -> u32 {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use gpui2::Modifiers; use gpui::Modifiers;
use super::*; use super::*;

View file

@ -6,7 +6,7 @@ use alacritty_terminal::grid::Dimensions;
/// with modifications for our circumstances /// with modifications for our circumstances
use alacritty_terminal::index::{Column as GridCol, Line as GridLine, Point as AlacPoint, Side}; use alacritty_terminal::index::{Column as GridCol, Line as GridLine, Point as AlacPoint, Side};
use alacritty_terminal::term::TermMode; use alacritty_terminal::term::TermMode;
use gpui2::{px, Modifiers, MouseButton, MouseMoveEvent, Pixels, Point, ScrollWheelEvent}; use gpui::{px, Modifiers, MouseButton, MouseMoveEvent, Pixels, Point, ScrollWheelEvent};
use crate::TerminalSize; use crate::TerminalSize;
@ -45,10 +45,10 @@ impl AlacMouseButton {
fn from_move(e: &MouseMoveEvent) -> Self { fn from_move(e: &MouseMoveEvent) -> Self {
match e.pressed_button { match e.pressed_button {
Some(b) => match b { Some(b) => match b {
gpui2::MouseButton::Left => AlacMouseButton::LeftMove, gpui::MouseButton::Left => AlacMouseButton::LeftMove,
gpui2::MouseButton::Middle => AlacMouseButton::MiddleMove, gpui::MouseButton::Middle => AlacMouseButton::MiddleMove,
gpui2::MouseButton::Right => AlacMouseButton::RightMove, gpui::MouseButton::Right => AlacMouseButton::RightMove,
gpui2::MouseButton::Navigate(_) => AlacMouseButton::Other, gpui::MouseButton::Navigate(_) => AlacMouseButton::Other,
}, },
None => AlacMouseButton::NoneMove, None => AlacMouseButton::NoneMove,
} }
@ -56,17 +56,17 @@ impl AlacMouseButton {
fn from_button(e: MouseButton) -> Self { fn from_button(e: MouseButton) -> Self {
match e { match e {
gpui2::MouseButton::Left => AlacMouseButton::LeftButton, gpui::MouseButton::Left => AlacMouseButton::LeftButton,
gpui2::MouseButton::Right => AlacMouseButton::MiddleButton, gpui::MouseButton::Right => AlacMouseButton::MiddleButton,
gpui2::MouseButton::Middle => AlacMouseButton::RightButton, gpui::MouseButton::Middle => AlacMouseButton::RightButton,
gpui2::MouseButton::Navigate(_) => AlacMouseButton::Other, gpui::MouseButton::Navigate(_) => AlacMouseButton::Other,
} }
} }
fn from_scroll(e: &ScrollWheelEvent) -> Self { fn from_scroll(e: &ScrollWheelEvent) -> Self {
let is_positive = match e.delta { let is_positive = match e.delta {
gpui2::ScrollDelta::Pixels(pixels) => pixels.y > px(0.), gpui::ScrollDelta::Pixels(pixels) => pixels.y > px(0.),
gpui2::ScrollDelta::Lines(lines) => lines.y > 0., gpui::ScrollDelta::Lines(lines) => lines.y > 0.,
}; };
if is_positive { if is_positive {
@ -118,7 +118,7 @@ pub fn alt_scroll(scroll_lines: i32) -> Vec<u8> {
pub fn mouse_button_report( pub fn mouse_button_report(
point: AlacPoint, point: AlacPoint,
button: gpui2::MouseButton, button: gpui::MouseButton,
modifiers: Modifiers, modifiers: Modifiers,
pressed: bool, pressed: bool,
mode: TermMode, mode: TermMode,

View file

@ -33,7 +33,7 @@ use mappings::mouse::{
use procinfo::LocalProcessInfo; use procinfo::LocalProcessInfo;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use settings2::Settings; use settings::Settings;
use terminal_settings::{AlternateScroll, Shell, TerminalBlink, TerminalSettings}; use terminal_settings::{AlternateScroll, Shell, TerminalBlink, TerminalSettings};
use util::truncate_and_trailoff; use util::truncate_and_trailoff;
@ -49,7 +49,7 @@ use std::{
}; };
use thiserror::Error; use thiserror::Error;
use gpui2::{ use gpui::{
px, AnyWindowHandle, AppContext, Bounds, ClipboardItem, EventEmitter, Hsla, Keystroke, px, AnyWindowHandle, AppContext, Bounds, ClipboardItem, EventEmitter, Hsla, Keystroke,
ModelContext, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels, ModelContext, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Pixels,
Point, ScrollWheelEvent, Size, Task, TouchPhase, Point, ScrollWheelEvent, Size, Task, TouchPhase,
@ -1409,7 +1409,7 @@ mod tests {
index::{Column, Line, Point as AlacPoint}, index::{Column, Line, Point as AlacPoint},
term::cell::Cell, term::cell::Cell,
}; };
use gpui2::{point, size, Pixels}; use gpui::{point, size, Pixels};
use rand::{distributions::Alphanumeric, rngs::ThreadRng, thread_rng, Rng}; use rand::{distributions::Alphanumeric, rngs::ThreadRng, thread_rng, Rng};
use crate::{content_index_for_mouse, IndexedCell, TerminalContent, TerminalSize}; use crate::{content_index_for_mouse, IndexedCell, TerminalContent, TerminalSize};

View file

@ -1,4 +1,4 @@
use gpui2::{AppContext, FontFeatures}; use gpui::{AppContext, FontFeatures};
use schemars::JsonSchema; use schemars::JsonSchema;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use std::{collections::HashMap, path::PathBuf}; use std::{collections::HashMap, path::PathBuf};
@ -98,7 +98,7 @@ impl TerminalSettings {
// } // }
} }
impl settings2::Settings for TerminalSettings { impl settings::Settings for TerminalSettings {
const KEY: Option<&'static str> = Some("terminal"); const KEY: Option<&'static str> = Some("terminal");
type FileContent = TerminalSettingsContent; type FileContent = TerminalSettingsContent;

View file

@ -30,7 +30,7 @@ regex.workspace = true
[dev-dependencies] [dev-dependencies]
collections = { path = "../collections", features = ["test-support"] } collections = { path = "../collections", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] } util = { path = "../util", features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true env_logger.workspace = true

View file

@ -91,7 +91,7 @@ mod tests {
use rand::prelude::*; use rand::prelude::*;
use std::mem; use std::mem;
#[gpui2::test(iterations = 100)] #[gpui::test(iterations = 100)]
fn test_locators(mut rng: StdRng) { fn test_locators(mut rng: StdRng) {
let mut lhs = Default::default(); let mut lhs = Default::default();
let mut rhs = Default::default(); let mut rhs = Default::default();

View file

@ -256,7 +256,7 @@ mod tests {
use rand::prelude::*; use rand::prelude::*;
use std::env; use std::env;
#[gpui2::test] #[gpui::test]
fn test_one_disjoint_edit() { fn test_one_disjoint_edit() {
assert_patch_composition( assert_patch_composition(
Patch(vec![Edit { Patch(vec![Edit {
@ -301,7 +301,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_one_overlapping_edit() { fn test_one_overlapping_edit() {
assert_patch_composition( assert_patch_composition(
Patch(vec![Edit { Patch(vec![Edit {
@ -319,7 +319,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_two_disjoint_and_overlapping() { fn test_two_disjoint_and_overlapping() {
assert_patch_composition( assert_patch_composition(
Patch(vec![ Patch(vec![
@ -355,7 +355,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_two_new_edits_overlapping_one_old_edit() { fn test_two_new_edits_overlapping_one_old_edit() {
assert_patch_composition( assert_patch_composition(
Patch(vec![Edit { Patch(vec![Edit {
@ -421,7 +421,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_two_new_edits_touching_one_old_edit() { fn test_two_new_edits_touching_one_old_edit() {
assert_patch_composition( assert_patch_composition(
Patch(vec![ Patch(vec![
@ -457,7 +457,7 @@ mod tests {
); );
} }
#[gpui2::test] #[gpui::test]
fn test_old_to_new() { fn test_old_to_new() {
let patch = Patch(vec![ let patch = Patch(vec![
Edit { Edit {
@ -481,7 +481,7 @@ mod tests {
assert_eq!(patch.old_to_new(9), 12); assert_eq!(patch.old_to_new(9), 12);
} }
#[gpui2::test(iterations = 100)] #[gpui::test(iterations = 100)]
fn test_random_patch_compositions(mut rng: StdRng) { fn test_random_patch_compositions(mut rng: StdRng) {
let operations = env::var("OPERATIONS") let operations = env::var("OPERATIONS")
.map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .map(|i| i.parse().expect("invalid `OPERATIONS` variable"))

View file

@ -32,7 +32,7 @@ fn test_edit() {
assert_eq!(buffer.text(), "ghiamnoef"); assert_eq!(buffer.text(), "ghiamnoef");
} }
#[gpui2::test(iterations = 100)] #[gpui::test(iterations = 100)]
fn test_random_edits(mut rng: StdRng) { fn test_random_edits(mut rng: StdRng) {
let operations = env::var("OPERATIONS") let operations = env::var("OPERATIONS")
.map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .map(|i| i.parse().expect("invalid `OPERATIONS` variable"))
@ -687,7 +687,7 @@ fn test_concurrent_edits() {
assert_eq!(buffer3.text(), "a12c34e56"); assert_eq!(buffer3.text(), "a12c34e56");
} }
#[gpui2::test(iterations = 100)] #[gpui::test(iterations = 100)]
fn test_random_concurrent_edits(mut rng: StdRng) { fn test_random_concurrent_edits(mut rng: StdRng) {
let peers = env::var("PEERS") let peers = env::var("PEERS")
.map(|i| i.parse().expect("invalid `PEERS` variable")) .map(|i| i.parse().expect("invalid `PEERS` variable"))

View file

@ -6,9 +6,9 @@ publish = false
[features] [features]
test-support = [ test-support = [
"gpui2/test-support", "gpui/test-support",
"fs/test-support", "fs/test-support",
"settings2/test-support" "settings/test-support"
] ]
[lib] [lib]
@ -18,7 +18,7 @@ doctest = false
[dependencies] [dependencies]
anyhow.workspace = true anyhow.workspace = true
fs = { path = "../fs" } fs = { path = "../fs" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
indexmap = "1.6.2" indexmap = "1.6.2"
parking_lot.workspace = true parking_lot.workspace = true
refineable.workspace = true refineable.workspace = true
@ -26,11 +26,11 @@ schemars.workspace = true
serde.workspace = true serde.workspace = true
serde_derive.workspace = true serde_derive.workspace = true
serde_json.workspace = true serde_json.workspace = true
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
toml.workspace = true toml.workspace = true
util = { path = "../util" } util = { path = "../util" }
[dev-dependencies] [dev-dependencies]
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
fs = { path = "../fs", features = ["test-support"] } fs = { path = "../fs", features = ["test-support"] }
settings2 = { path = "../settings2", features = ["test-support"] } settings = { package = "settings2", path = "../settings2", features = ["test-support"] }

View file

@ -1,4 +1,4 @@
use gpui2::Hsla; use gpui::Hsla;
use refineable::Refineable; use refineable::Refineable;
use crate::SyntaxTheme; use crate::SyntaxTheme;
@ -109,7 +109,7 @@ mod tests {
fn override_a_single_theme_color() { fn override_a_single_theme_color() {
let mut colors = ThemeColors::default_light(); let mut colors = ThemeColors::default_light();
let magenta: Hsla = gpui2::rgb(0xff00ff); let magenta: Hsla = gpui::rgb(0xff00ff);
assert_ne!(colors.text, magenta); assert_ne!(colors.text, magenta);
@ -127,8 +127,8 @@ mod tests {
fn override_multiple_theme_colors() { fn override_multiple_theme_colors() {
let mut colors = ThemeColors::default_light(); let mut colors = ThemeColors::default_light();
let magenta: Hsla = gpui2::rgb(0xff00ff); let magenta: Hsla = gpui::rgb(0xff00ff);
let green: Hsla = gpui2::rgb(0x00ff00); let green: Hsla = gpui::rgb(0x00ff00);
assert_ne!(colors.text, magenta); assert_ne!(colors.text, magenta);
assert_ne!(colors.background, green); assert_ne!(colors.background, green);

View file

@ -1,6 +1,6 @@
use std::num::ParseIntError; use std::num::ParseIntError;
use gpui2::{hsla, Hsla, Rgba}; use gpui::{hsla, Hsla, Rgba};
use crate::{ use crate::{
colors::{GitStatusColors, PlayerColor, PlayerColors, StatusColors, SystemColors, ThemeColors}, colors::{GitStatusColors, PlayerColor, PlayerColors, StatusColors, SystemColors, ThemeColors},

View file

@ -1,6 +1,6 @@
use crate::{zed_pro_family, ThemeFamily, ThemeVariant}; use crate::{zed_pro_family, ThemeFamily, ThemeVariant};
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use gpui2::SharedString; use gpui::SharedString;
use std::{collections::HashMap, sync::Arc}; use std::{collections::HashMap, sync::Arc};
pub struct ThemeRegistry { pub struct ThemeRegistry {

View file

@ -1,4 +1,4 @@
use gpui2::{AppContext, Hsla, SharedString}; use gpui::{AppContext, Hsla, SharedString};
use crate::{ActiveTheme, Appearance}; use crate::{ActiveTheme, Appearance};

View file

@ -1,6 +1,6 @@
use crate::{ThemeRegistry, ThemeVariant}; use crate::{ThemeRegistry, ThemeVariant};
use anyhow::Result; use anyhow::Result;
use gpui2::{px, AppContext, Font, FontFeatures, FontStyle, FontWeight, Pixels}; use gpui::{px, AppContext, Font, FontFeatures, FontStyle, FontWeight, Pixels};
use schemars::{ use schemars::{
gen::SchemaGenerator, gen::SchemaGenerator,
schema::{InstanceType, Schema, SchemaObject}, schema::{InstanceType, Schema, SchemaObject},
@ -8,7 +8,7 @@ use schemars::{
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
use settings2::{Settings, SettingsJsonSchemaParams}; use settings::{Settings, SettingsJsonSchemaParams};
use std::sync::Arc; use std::sync::Arc;
use util::ResultExt as _; use util::ResultExt as _;
@ -105,7 +105,7 @@ pub fn reset_font_size(cx: &mut AppContext) {
} }
} }
impl settings2::Settings for ThemeSettings { impl settings::Settings for ThemeSettings {
const KEY: Option<&'static str> = None; const KEY: Option<&'static str> = None;
type FileContent = ThemeSettingsContent; type FileContent = ThemeSettingsContent;

View file

@ -1,4 +1,4 @@
use gpui2::{HighlightStyle, Hsla}; use gpui::{HighlightStyle, Hsla};
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct SyntaxTheme { pub struct SyntaxTheme {

View file

@ -6,6 +6,7 @@ mod scale;
mod settings; mod settings;
mod syntax; mod syntax;
use ::settings::Settings;
pub use colors::*; pub use colors::*;
pub use default_colors::*; pub use default_colors::*;
pub use default_theme::*; pub use default_theme::*;
@ -14,8 +15,7 @@ pub use scale::*;
pub use settings::*; pub use settings::*;
pub use syntax::*; pub use syntax::*;
use gpui2::{AppContext, Hsla, SharedString}; use gpui::{AppContext, Hsla, SharedString};
use settings2::Settings;
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum Appearance { pub enum Appearance {

View file

@ -15,12 +15,12 @@ name = "Zed"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
ai2 = { path = "../ai2"} ai = { package = "ai2", path = "../ai2"}
# audio = { path = "../audio" } # audio = { path = "../audio" }
# activity_indicator = { path = "../activity_indicator" } # activity_indicator = { path = "../activity_indicator" }
# auto_update = { path = "../auto_update" } # auto_update = { path = "../auto_update" }
# breadcrumbs = { path = "../breadcrumbs" } # breadcrumbs = { path = "../breadcrumbs" }
call2 = { path = "../call2" } call = { package = "call2", path = "../call2" }
# channel = { path = "../channel" } # channel = { path = "../channel" }
cli = { path = "../cli" } cli = { path = "../cli" }
# collab_ui = { path = "../collab_ui" } # collab_ui = { path = "../collab_ui" }
@ -28,44 +28,44 @@ collections = { path = "../collections" }
# command_palette = { path = "../command_palette" } # command_palette = { path = "../command_palette" }
# component_test = { path = "../component_test" } # component_test = { path = "../component_test" }
# context_menu = { path = "../context_menu" } # context_menu = { path = "../context_menu" }
client2 = { path = "../client2" } client = { package = "client2", path = "../client2" }
# clock = { path = "../clock" } # clock = { path = "../clock" }
copilot2 = { path = "../copilot2" } copilot = { package = "copilot2", path = "../copilot2" }
# copilot_button = { path = "../copilot_button" } # copilot_button = { path = "../copilot_button" }
# diagnostics = { path = "../diagnostics" } # diagnostics = { path = "../diagnostics" }
db2 = { path = "../db2" } db = { package = "db2", path = "../db2" }
# editor = { path = "../editor" } # editor = { path = "../editor" }
# feedback = { path = "../feedback" } # feedback = { path = "../feedback" }
# file_finder = { path = "../file_finder" } # file_finder = { path = "../file_finder" }
# search = { path = "../search" } # search = { path = "../search" }
fs2 = { path = "../fs2" } fs = { package = "fs2", path = "../fs2" }
fsevent = { path = "../fsevent" } fsevent = { path = "../fsevent" }
fuzzy = { path = "../fuzzy" } fuzzy = { path = "../fuzzy" }
# go_to_line = { path = "../go_to_line" } # go_to_line = { path = "../go_to_line" }
gpui2 = { path = "../gpui2" } gpui = { package = "gpui2", path = "../gpui2" }
install_cli = { path = "../install_cli" } install_cli = { path = "../install_cli" }
journal2 = { path = "../journal2" } journal = { package = "journal2", path = "../journal2" }
language2 = { path = "../language2" } language = { package = "language2", path = "../language2" }
# language_selector = { path = "../language_selector" } # language_selector = { path = "../language_selector" }
lsp2 = { path = "../lsp2" } lsp = { package = "lsp2", path = "../lsp2" }
language_tools = { path = "../language_tools" } language_tools = { path = "../language_tools" }
node_runtime = { path = "../node_runtime" } node_runtime = { path = "../node_runtime" }
# assistant = { path = "../assistant" } # assistant = { path = "../assistant" }
# outline = { path = "../outline" } # outline = { path = "../outline" }
# plugin_runtime = { path = "../plugin_runtime",optional = true } # plugin_runtime = { path = "../plugin_runtime",optional = true }
project2 = { path = "../project2" } project = { package = "project2", path = "../project2" }
# project_panel = { path = "../project_panel" } # project_panel = { path = "../project_panel" }
# project_symbols = { path = "../project_symbols" } # project_symbols = { path = "../project_symbols" }
# quick_action_bar = { path = "../quick_action_bar" } # quick_action_bar = { path = "../quick_action_bar" }
# recent_projects = { path = "../recent_projects" } # recent_projects = { path = "../recent_projects" }
rpc2 = { path = "../rpc2" } rpc = { package = "rpc2", path = "../rpc2" }
settings2 = { path = "../settings2" } settings = { package = "settings2", path = "../settings2" }
feature_flags2 = { path = "../feature_flags2" } feature_flags = { package = "feature_flags2", path = "../feature_flags2" }
sum_tree = { path = "../sum_tree" } sum_tree = { path = "../sum_tree" }
shellexpand = "2.1.0" shellexpand = "2.1.0"
text2 = { path = "../text2" } text = { package = "text2", path = "../text2" }
# terminal_view = { path = "../terminal_view" } # terminal_view = { path = "../terminal_view" }
theme2 = { path = "../theme2" } theme = { package = "theme2", path = "../theme2" }
# theme_selector = { path = "../theme_selector" } # theme_selector = { path = "../theme_selector" }
util = { path = "../util" } util = { path = "../util" }
# semantic_index = { path = "../semantic_index" } # semantic_index = { path = "../semantic_index" }
@ -142,17 +142,17 @@ urlencoding = "2.1.2"
uuid.workspace = true uuid.workspace = true
[dev-dependencies] [dev-dependencies]
call2 = { path = "../call2", features = ["test-support"] } call = { package = "call2", path = "../call2", features = ["test-support"] }
# client = { path = "../client", features = ["test-support"] } # client = { path = "../client", features = ["test-support"] }
# editor = { path = "../editor", features = ["test-support"] } # editor = { path = "../editor", features = ["test-support"] }
# gpui = { path = "../gpui", features = ["test-support"] } # gpui = { path = "../gpui", features = ["test-support"] }
gpui2 = { path = "../gpui2", features = ["test-support"] } gpui = { package = "gpui2", path = "../gpui2", features = ["test-support"] }
language2 = { path = "../language2", features = ["test-support"] } language = { package = "language2", path = "../language2", features = ["test-support"] }
# lsp = { path = "../lsp", features = ["test-support"] } # lsp = { path = "../lsp", features = ["test-support"] }
project2 = { path = "../project2", features = ["test-support"] } project = { package = "project2", path = "../project2", features = ["test-support"] }
# rpc = { path = "../rpc", features = ["test-support"] } # rpc = { path = "../rpc", features = ["test-support"] }
# settings = { path = "../settings", features = ["test-support"] } # settings = { path = "../settings", features = ["test-support"] }
text2 = { path = "../text2", features = ["test-support"] } text = { package = "text2", path = "../text2", features = ["test-support"] }
# util = { path = "../util", features = ["test-support"] } # util = { path = "../util", features = ["test-support"] }
# workspace = { path = "../workspace", features = ["test-support"] } # workspace = { path = "../workspace", features = ["test-support"] }
unindent.workspace = true unindent.workspace = true

View file

@ -1,5 +1,6 @@
use anyhow::anyhow; use anyhow::anyhow;
use gpui2::{AssetSource, Result, SharedString};
use gpui::{AssetSource, Result, SharedString};
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
#[derive(RustEmbed)] #[derive(RustEmbed)]

View file

@ -1,9 +1,9 @@
use anyhow::Context; use anyhow::Context;
use gpui2::AppContext; use gpui::AppContext;
pub use language2::*; pub use language::*;
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use settings2::Settings; use settings::Settings;
use std::{borrow::Cow, str, sync::Arc}; use std::{borrow::Cow, str, sync::Arc};
use util::asset_str; use util::asset_str;

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use futures::StreamExt; use futures::StreamExt;
pub use language2::*; pub use language::*;
use lsp2::LanguageServerBinary; use lsp::LanguageServerBinary;
use smol::fs::{self, File}; use smol::fs::{self, File};
use std::{any::Any, path::PathBuf, sync::Arc}; use std::{any::Any, path::PathBuf, sync::Arc};
use util::{ use util::{
@ -108,7 +108,7 @@ impl super::LspAdapter for CLspAdapter {
async fn label_for_completion( async fn label_for_completion(
&self, &self,
completion: &lsp2::CompletionItem, completion: &lsp::CompletionItem,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
let label = completion let label = completion
@ -118,7 +118,7 @@ impl super::LspAdapter for CLspAdapter {
.trim(); .trim();
match completion.kind { match completion.kind {
Some(lsp2::CompletionItemKind::FIELD) if completion.detail.is_some() => { Some(lsp::CompletionItemKind::FIELD) if completion.detail.is_some() => {
let detail = completion.detail.as_ref().unwrap(); let detail = completion.detail.as_ref().unwrap();
let text = format!("{} {}", detail, label); let text = format!("{} {}", detail, label);
let source = Rope::from(format!("struct S {{ {} }}", text).as_str()); let source = Rope::from(format!("struct S {{ {} }}", text).as_str());
@ -129,7 +129,7 @@ impl super::LspAdapter for CLspAdapter {
runs, runs,
}); });
} }
Some(lsp2::CompletionItemKind::CONSTANT | lsp2::CompletionItemKind::VARIABLE) Some(lsp::CompletionItemKind::CONSTANT | lsp::CompletionItemKind::VARIABLE)
if completion.detail.is_some() => if completion.detail.is_some() =>
{ {
let detail = completion.detail.as_ref().unwrap(); let detail = completion.detail.as_ref().unwrap();
@ -141,7 +141,7 @@ impl super::LspAdapter for CLspAdapter {
runs, runs,
}); });
} }
Some(lsp2::CompletionItemKind::FUNCTION | lsp2::CompletionItemKind::METHOD) Some(lsp::CompletionItemKind::FUNCTION | lsp::CompletionItemKind::METHOD)
if completion.detail.is_some() => if completion.detail.is_some() =>
{ {
let detail = completion.detail.as_ref().unwrap(); let detail = completion.detail.as_ref().unwrap();
@ -155,13 +155,13 @@ impl super::LspAdapter for CLspAdapter {
} }
Some(kind) => { Some(kind) => {
let highlight_name = match kind { let highlight_name = match kind {
lsp2::CompletionItemKind::STRUCT lsp::CompletionItemKind::STRUCT
| lsp2::CompletionItemKind::INTERFACE | lsp::CompletionItemKind::INTERFACE
| lsp2::CompletionItemKind::CLASS | lsp::CompletionItemKind::CLASS
| lsp2::CompletionItemKind::ENUM => Some("type"), | lsp::CompletionItemKind::ENUM => Some("type"),
lsp2::CompletionItemKind::ENUM_MEMBER => Some("variant"), lsp::CompletionItemKind::ENUM_MEMBER => Some("variant"),
lsp2::CompletionItemKind::KEYWORD => Some("keyword"), lsp::CompletionItemKind::KEYWORD => Some("keyword"),
lsp2::CompletionItemKind::VALUE | lsp2::CompletionItemKind::CONSTANT => { lsp::CompletionItemKind::VALUE | lsp::CompletionItemKind::CONSTANT => {
Some("constant") Some("constant")
} }
_ => None, _ => None,
@ -186,47 +186,47 @@ impl super::LspAdapter for CLspAdapter {
async fn label_for_symbol( async fn label_for_symbol(
&self, &self,
name: &str, name: &str,
kind: lsp2::SymbolKind, kind: lsp::SymbolKind,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
let (text, filter_range, display_range) = match kind { let (text, filter_range, display_range) = match kind {
lsp2::SymbolKind::METHOD | lsp2::SymbolKind::FUNCTION => { lsp::SymbolKind::METHOD | lsp::SymbolKind::FUNCTION => {
let text = format!("void {} () {{}}", name); let text = format!("void {} () {{}}", name);
let filter_range = 0..name.len(); let filter_range = 0..name.len();
let display_range = 5..5 + name.len(); let display_range = 5..5 + name.len();
(text, filter_range, display_range) (text, filter_range, display_range)
} }
lsp2::SymbolKind::STRUCT => { lsp::SymbolKind::STRUCT => {
let text = format!("struct {} {{}}", name); let text = format!("struct {} {{}}", name);
let filter_range = 7..7 + name.len(); let filter_range = 7..7 + name.len();
let display_range = 0..filter_range.end; let display_range = 0..filter_range.end;
(text, filter_range, display_range) (text, filter_range, display_range)
} }
lsp2::SymbolKind::ENUM => { lsp::SymbolKind::ENUM => {
let text = format!("enum {} {{}}", name); let text = format!("enum {} {{}}", name);
let filter_range = 5..5 + name.len(); let filter_range = 5..5 + name.len();
let display_range = 0..filter_range.end; let display_range = 0..filter_range.end;
(text, filter_range, display_range) (text, filter_range, display_range)
} }
lsp2::SymbolKind::INTERFACE | lsp2::SymbolKind::CLASS => { lsp::SymbolKind::INTERFACE | lsp::SymbolKind::CLASS => {
let text = format!("class {} {{}}", name); let text = format!("class {} {{}}", name);
let filter_range = 6..6 + name.len(); let filter_range = 6..6 + name.len();
let display_range = 0..filter_range.end; let display_range = 0..filter_range.end;
(text, filter_range, display_range) (text, filter_range, display_range)
} }
lsp2::SymbolKind::CONSTANT => { lsp::SymbolKind::CONSTANT => {
let text = format!("const int {} = 0;", name); let text = format!("const int {} = 0;", name);
let filter_range = 10..10 + name.len(); let filter_range = 10..10 + name.len();
let display_range = 0..filter_range.end; let display_range = 0..filter_range.end;
(text, filter_range, display_range) (text, filter_range, display_range)
} }
lsp2::SymbolKind::MODULE => { lsp::SymbolKind::MODULE => {
let text = format!("namespace {} {{}}", name); let text = format!("namespace {} {{}}", name);
let filter_range = 10..10 + name.len(); let filter_range = 10..10 + name.len();
let display_range = 0..filter_range.end; let display_range = 0..filter_range.end;
(text, filter_range, display_range) (text, filter_range, display_range)
} }
lsp2::SymbolKind::TYPE_PARAMETER => { lsp::SymbolKind::TYPE_PARAMETER => {
let text = format!("typename {} {{}};", name); let text = format!("typename {} {{}};", name);
let filter_range = 9..9 + name.len(); let filter_range = 9..9 + name.len();
let display_range = 0..filter_range.end; let display_range = 0..filter_range.end;
@ -273,18 +273,18 @@ async fn get_cached_server_binary(container_dir: PathBuf) -> Option<LanguageServ
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use gpui2::{Context, TestAppContext}; use gpui::{Context, TestAppContext};
use language2::{language_settings::AllLanguageSettings, AutoindentMode, Buffer}; use language::{language_settings::AllLanguageSettings, AutoindentMode, Buffer};
use settings2::SettingsStore; use settings::SettingsStore;
use std::num::NonZeroU32; use std::num::NonZeroU32;
#[gpui2::test] #[gpui::test]
async fn test_c_autoindent(cx: &mut TestAppContext) { async fn test_c_autoindent(cx: &mut TestAppContext) {
// cx.executor().set_block_on_ticks(usize::MAX..=usize::MAX); // cx.executor().set_block_on_ticks(usize::MAX..=usize::MAX);
cx.update(|cx| { cx.update(|cx| {
let test_settings = SettingsStore::test(cx); let test_settings = SettingsStore::test(cx);
cx.set_global(test_settings); cx.set_global(test_settings);
language2::init(cx); language::init(cx);
cx.update_global::<SettingsStore, _>(|store, cx| { cx.update_global::<SettingsStore, _>(|store, cx| {
store.update_user_settings::<AllLanguageSettings>(cx, |s| { store.update_user_settings::<AllLanguageSettings>(cx, |s| {
s.defaults.tab_size = NonZeroU32::new(2); s.defaults.tab_size = NonZeroU32::new(2);

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use async_trait::async_trait; use async_trait::async_trait;
use futures::StreamExt; use futures::StreamExt;
use language2::{LanguageServerName, LspAdapter, LspAdapterDelegate}; use language::{LanguageServerName, LspAdapter, LspAdapterDelegate};
use lsp2::LanguageServerBinary; use lsp::LanguageServerBinary;
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use serde_json::json; use serde_json::json;
use smol::fs; use smol::fs;

View file

@ -1,12 +1,12 @@
use anyhow::{anyhow, bail, Context, Result}; use anyhow::{anyhow, bail, Context, Result};
use async_trait::async_trait; use async_trait::async_trait;
use futures::StreamExt; use futures::StreamExt;
use gpui2::{AsyncAppContext, Task}; use gpui::{AsyncAppContext, Task};
pub use language2::*; pub use language::*;
use lsp2::{CompletionItemKind, LanguageServerBinary, SymbolKind}; use lsp::{CompletionItemKind, LanguageServerBinary, SymbolKind};
use schemars::JsonSchema; use schemars::JsonSchema;
use serde_derive::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use settings2::Settings; use settings::Settings;
use smol::fs::{self, File}; use smol::fs::{self, File};
use std::{ use std::{
any::Any, any::Any,
@ -54,7 +54,7 @@ impl Settings for ElixirSettings {
fn load( fn load(
default_value: &Self::FileContent, default_value: &Self::FileContent,
user_values: &[&Self::FileContent], user_values: &[&Self::FileContent],
_: &mut gpui2::AppContext, _: &mut gpui::AppContext,
) -> Result<Self> ) -> Result<Self>
where where
Self: Sized, Self: Sized,
@ -200,7 +200,7 @@ impl LspAdapter for ElixirLspAdapter {
async fn label_for_completion( async fn label_for_completion(
&self, &self,
completion: &lsp2::CompletionItem, completion: &lsp::CompletionItem,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
match completion.kind.zip(completion.detail.as_ref()) { match completion.kind.zip(completion.detail.as_ref()) {
@ -404,7 +404,7 @@ impl LspAdapter for NextLspAdapter {
async fn label_for_completion( async fn label_for_completion(
&self, &self,
completion: &lsp2::CompletionItem, completion: &lsp::CompletionItem,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
label_for_completion_elixir(completion, language) label_for_completion_elixir(completion, language)
@ -506,7 +506,7 @@ impl LspAdapter for LocalLspAdapter {
async fn label_for_completion( async fn label_for_completion(
&self, &self,
completion: &lsp2::CompletionItem, completion: &lsp::CompletionItem,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
label_for_completion_elixir(completion, language) label_for_completion_elixir(completion, language)
@ -523,7 +523,7 @@ impl LspAdapter for LocalLspAdapter {
} }
fn label_for_completion_elixir( fn label_for_completion_elixir(
completion: &lsp2::CompletionItem, completion: &lsp::CompletionItem,
language: &Arc<Language>, language: &Arc<Language>,
) -> Option<CodeLabel> { ) -> Option<CodeLabel> {
return Some(CodeLabel { return Some(CodeLabel {

Some files were not shown because too many files have changed in this diff Show more