Improve formatting of function autocompletion labels in Rust
Co-Authored-By: Nathan Sobo <nathan@zed.dev> Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
8d7815456c
commit
8149bcbb13
7 changed files with 63 additions and 21 deletions
|
@ -1752,11 +1752,13 @@ impl Project {
|
|||
.get(&sender_id)
|
||||
.and_then(|shared_buffers| shared_buffers.get(&envelope.payload.buffer_id).cloned())
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))?;
|
||||
let language = buffer.read(cx).language();
|
||||
let completion = language::proto::deserialize_completion(
|
||||
envelope
|
||||
.payload
|
||||
.completion
|
||||
.ok_or_else(|| anyhow!("invalid position"))?,
|
||||
language,
|
||||
)?;
|
||||
cx.spawn(|_, mut cx| async move {
|
||||
match buffer
|
||||
|
|
|
@ -14,7 +14,9 @@ use gpui::{
|
|||
executor, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext,
|
||||
Task,
|
||||
};
|
||||
use language::{Anchor, Buffer, Completion, DiagnosticEntry, Operation, PointUtf16, Rope};
|
||||
use language::{
|
||||
Anchor, Buffer, Completion, DiagnosticEntry, Language, Operation, PointUtf16, Rope,
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use parking_lot::Mutex;
|
||||
use postage::{
|
||||
|
@ -1425,6 +1427,7 @@ impl language::File for File {
|
|||
&self,
|
||||
buffer_id: u64,
|
||||
position: Anchor,
|
||||
language: Option<Arc<Language>>,
|
||||
cx: &mut MutableAppContext,
|
||||
) -> Task<Result<Vec<Completion<Anchor>>>> {
|
||||
let worktree = self.worktree.read(cx);
|
||||
|
@ -1448,7 +1451,9 @@ impl language::File for File {
|
|||
response
|
||||
.completions
|
||||
.into_iter()
|
||||
.map(language::proto::deserialize_completion)
|
||||
.map(|completion| {
|
||||
language::proto::deserialize_completion(completion, language.as_ref())
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue