Remove workspace::Item trait

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-03-16 13:34:04 -07:00
parent e8efaed1b2
commit a88320dc5f
10 changed files with 281 additions and 517 deletions

View file

@ -1,6 +1,5 @@
use editor::{
combine_syntax_and_fuzzy_match_highlights, items::BufferItemHandle, styled_runs_for_code_label,
Autoscroll, Bias, Editor,
combine_syntax_and_fuzzy_match_highlights, styled_runs_for_code_label, Autoscroll, Bias, Editor,
};
use fuzzy::{StringMatch, StringMatchCandidate};
use gpui::{
@ -346,6 +345,7 @@ impl ProjectSymbolsView {
let buffer = workspace
.project()
.update(cx, |project, cx| project.open_buffer_for_symbol(symbol, cx));
let symbol = symbol.clone();
cx.spawn(|workspace, mut cx| async move {
let buffer = buffer.await?;
@ -353,10 +353,8 @@ impl ProjectSymbolsView {
let position = buffer
.read(cx)
.clip_point_utf16(symbol.range.start, Bias::Left);
let editor = workspace
.open_item(BufferItemHandle(buffer), cx)
.downcast::<Editor>()
.unwrap();
let editor = Editor::find_or_create(workspace, buffer, cx);
editor.update(cx, |editor, cx| {
editor.select_ranges(
[position..position],