lsp: Identify language servers by their configuration (#35270)
- **WIP: reorganize dispositions** - **Introduce a LocalToolchainStore trait and use it for LspAdapter methods** Closes #35782 Closes #27331 Release Notes: - Python: Improved propagation of a selected virtual environment into the LSP configuration. This should the make all language-related features such as Go to definition or Find all references more reliable. --------- Co-authored-by: Cole Miller <cole@zed.dev> Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
parent
42ffa8900a
commit
b8a106632f
32 changed files with 1037 additions and 1085 deletions
|
@ -16022,38 +16022,24 @@ impl Editor {
|
|||
cx.spawn_in(window, async move |editor, cx| {
|
||||
let location_task = editor.update(cx, |_, cx| {
|
||||
project.update(cx, |project, cx| {
|
||||
let language_server_name = project
|
||||
.language_server_statuses(cx)
|
||||
.find(|(id, _)| server_id == *id)
|
||||
.map(|(_, status)| status.name.clone());
|
||||
language_server_name.map(|language_server_name| {
|
||||
project.open_local_buffer_via_lsp(
|
||||
lsp_location.uri.clone(),
|
||||
server_id,
|
||||
language_server_name,
|
||||
cx,
|
||||
)
|
||||
})
|
||||
project.open_local_buffer_via_lsp(lsp_location.uri.clone(), server_id, cx)
|
||||
})
|
||||
})?;
|
||||
let location = match location_task {
|
||||
Some(task) => Some({
|
||||
let target_buffer_handle = task.await.context("open local buffer")?;
|
||||
let range = target_buffer_handle.read_with(cx, |target_buffer, _| {
|
||||
let target_start = target_buffer
|
||||
.clip_point_utf16(point_from_lsp(lsp_location.range.start), Bias::Left);
|
||||
let target_end = target_buffer
|
||||
.clip_point_utf16(point_from_lsp(lsp_location.range.end), Bias::Left);
|
||||
target_buffer.anchor_after(target_start)
|
||||
..target_buffer.anchor_before(target_end)
|
||||
})?;
|
||||
Location {
|
||||
buffer: target_buffer_handle,
|
||||
range,
|
||||
}
|
||||
}),
|
||||
None => None,
|
||||
};
|
||||
let location = Some({
|
||||
let target_buffer_handle = location_task.await.context("open local buffer")?;
|
||||
let range = target_buffer_handle.read_with(cx, |target_buffer, _| {
|
||||
let target_start = target_buffer
|
||||
.clip_point_utf16(point_from_lsp(lsp_location.range.start), Bias::Left);
|
||||
let target_end = target_buffer
|
||||
.clip_point_utf16(point_from_lsp(lsp_location.range.end), Bias::Left);
|
||||
target_buffer.anchor_after(target_start)
|
||||
..target_buffer.anchor_before(target_end)
|
||||
})?;
|
||||
Location {
|
||||
buffer: target_buffer_handle,
|
||||
range,
|
||||
}
|
||||
});
|
||||
Ok(location)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue