Revert "project: Fine-grained language server management" (#23977)
Reverts zed-industries/zed#23805
This commit is contained in:
parent
7adf9cb1a0
commit
399e2c1ed3
28 changed files with 935 additions and 2226 deletions
|
@ -9,7 +9,6 @@ pub mod lsp_ext_command;
|
|||
pub mod lsp_store;
|
||||
pub mod prettier_store;
|
||||
pub mod project_settings;
|
||||
mod project_tree;
|
||||
pub mod search;
|
||||
mod task_inventory;
|
||||
pub mod task_store;
|
||||
|
@ -478,7 +477,6 @@ pub struct DocumentHighlight {
|
|||
pub struct Symbol {
|
||||
pub language_server_name: LanguageServerName,
|
||||
pub source_worktree_id: WorktreeId,
|
||||
pub source_language_server_id: LanguageServerId,
|
||||
pub path: ProjectPath,
|
||||
pub label: CodeLabel,
|
||||
pub name: String,
|
||||
|
@ -1931,7 +1929,7 @@ impl Project {
|
|||
pub fn open_buffer(
|
||||
&mut self,
|
||||
path: impl Into<ProjectPath>,
|
||||
cx: &mut App,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<Entity<Buffer>>> {
|
||||
if self.is_disconnected(cx) {
|
||||
return Task::ready(Err(anyhow!(ErrorCode::Disconnected)));
|
||||
|
@ -1946,11 +1944,11 @@ impl Project {
|
|||
pub fn open_buffer_with_lsp(
|
||||
&mut self,
|
||||
path: impl Into<ProjectPath>,
|
||||
cx: &mut App,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<(Entity<Buffer>, lsp_store::OpenLspBufferHandle)>> {
|
||||
let buffer = self.open_buffer(path, cx);
|
||||
let lsp_store = self.lsp_store().clone();
|
||||
cx.spawn(|mut cx| async move {
|
||||
cx.spawn(|_, mut cx| async move {
|
||||
let buffer = buffer.await?;
|
||||
let handle = lsp_store.update(&mut cx, |lsp_store, cx| {
|
||||
lsp_store.register_buffer_with_language_servers(&buffer, cx)
|
||||
|
@ -4273,25 +4271,14 @@ impl Project {
|
|||
self.lsp_store.read(cx).supplementary_language_servers()
|
||||
}
|
||||
|
||||
pub fn language_server_for_id(
|
||||
&self,
|
||||
id: LanguageServerId,
|
||||
cx: &App,
|
||||
) -> Option<Arc<LanguageServer>> {
|
||||
self.lsp_store.read(cx).language_server_for_id(id)
|
||||
}
|
||||
|
||||
pub fn for_language_servers_for_local_buffer<R: 'static>(
|
||||
&self,
|
||||
buffer: &Buffer,
|
||||
callback: impl FnOnce(
|
||||
Box<dyn Iterator<Item = (&Arc<CachedLspAdapter>, &Arc<LanguageServer>)> + '_>,
|
||||
) -> R,
|
||||
cx: &mut App,
|
||||
) -> R {
|
||||
self.lsp_store.update(cx, |this, cx| {
|
||||
callback(Box::new(this.language_servers_for_local_buffer(buffer, cx)))
|
||||
})
|
||||
pub fn language_servers_for_local_buffer<'a>(
|
||||
&'a self,
|
||||
buffer: &'a Buffer,
|
||||
cx: &'a App,
|
||||
) -> impl Iterator<Item = (&'a Arc<CachedLspAdapter>, &'a Arc<LanguageServer>)> {
|
||||
self.lsp_store
|
||||
.read(cx)
|
||||
.language_servers_for_local_buffer(buffer, cx)
|
||||
}
|
||||
|
||||
pub fn buffer_store(&self) -> &Entity<BufferStore> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue