Start work on code actions

Just print out the returned code actions for now

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-02-04 17:45:00 -08:00
parent 4900019e9b
commit 83d4fe8e3a
4 changed files with 109 additions and 1 deletions

View file

@ -860,6 +860,21 @@ impl MultiBuffer {
})
}
pub fn code_actions<T>(
&self,
position: T,
cx: &mut ModelContext<Self>,
) -> Task<Result<Vec<lsp::CodeAction>>>
where
T: ToOffset,
{
let anchor = self.read(cx).anchor_before(position);
let buffer = self.buffers.borrow()[&anchor.buffer_id].buffer.clone();
let code_actions =
buffer.update(cx, |buffer, cx| buffer.code_actions(anchor.text_anchor, cx));
cx.spawn(|this, cx| async move { code_actions.await })
}
pub fn completions<T>(
&self,
position: T,