Start on integrating rust-analyzer
Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
a0c8b60a1b
commit
2c6aeaed7c
8 changed files with 279 additions and 9 deletions
|
@ -8,15 +8,15 @@ test-support = []
|
|||
|
||||
[dependencies]
|
||||
buffer = { path = "../buffer" }
|
||||
client = { path = "../client" }
|
||||
clock = { path = "../clock" }
|
||||
fsevent = { path = "../fsevent" }
|
||||
fuzzy = { path = "../fuzzy" }
|
||||
gpui = { path = "../gpui" }
|
||||
client = { path = "../client" }
|
||||
lsp = { path = "../lsp" }
|
||||
rpc = { path = "../rpc" }
|
||||
sum_tree = { path = "../sum_tree" }
|
||||
util = { path = "../util" }
|
||||
rpc = { path = "../rpc" }
|
||||
|
||||
anyhow = "1.0.38"
|
||||
async-trait = "0.1"
|
||||
futures = "0.3"
|
||||
|
@ -35,6 +35,5 @@ toml = "0.5"
|
|||
client = { path = "../client", features = ["test-support"] }
|
||||
util = { path = "../util", features = ["test-support"] }
|
||||
rpc = { path = "../rpc", features = ["test-support"] }
|
||||
|
||||
rand = "0.8.3"
|
||||
tempdir = { version = "0.3.7" }
|
||||
|
|
|
@ -7,7 +7,8 @@ use buffer::LanguageRegistry;
|
|||
use client::Client;
|
||||
use futures::Future;
|
||||
use fuzzy::{PathMatch, PathMatchCandidate, PathMatchCandidateSet};
|
||||
use gpui::{AppContext, Entity, ModelContext, ModelHandle, Task};
|
||||
use gpui::{executor, AppContext, Entity, ModelContext, ModelHandle, Task};
|
||||
use lsp::LanguageServer;
|
||||
use std::{
|
||||
path::Path,
|
||||
sync::{atomic::AtomicBool, Arc},
|
||||
|
@ -23,6 +24,7 @@ pub struct Project {
|
|||
languages: Arc<LanguageRegistry>,
|
||||
client: Arc<client::Client>,
|
||||
fs: Arc<dyn Fs>,
|
||||
language_server: Arc<LanguageServer>,
|
||||
}
|
||||
|
||||
pub enum Event {
|
||||
|
@ -43,13 +45,23 @@ pub struct ProjectEntry {
|
|||
}
|
||||
|
||||
impl Project {
|
||||
pub fn new(languages: Arc<LanguageRegistry>, rpc: Arc<Client>, fs: Arc<dyn Fs>) -> Self {
|
||||
pub fn new(
|
||||
languages: Arc<LanguageRegistry>,
|
||||
rpc: Arc<Client>,
|
||||
fs: Arc<dyn Fs>,
|
||||
background: &executor::Background,
|
||||
) -> Self {
|
||||
Self {
|
||||
worktrees: Default::default(),
|
||||
active_entry: None,
|
||||
languages,
|
||||
client: rpc,
|
||||
fs,
|
||||
language_server: LanguageServer::new(
|
||||
Path::new("/Users/as-cii/Downloads/rust-analyzer-x86_64-apple-darwin"),
|
||||
background,
|
||||
)
|
||||
.unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,6 +420,6 @@ mod tests {
|
|||
let languages = Arc::new(LanguageRegistry::new());
|
||||
let fs = Arc::new(RealFs);
|
||||
let rpc = client::Client::new();
|
||||
cx.add_model(|_| Project::new(languages, rpc, fs))
|
||||
cx.add_model(|cx| Project::new(languages, rpc, fs, cx.background()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue