Part of #7450 Big thanks to @macmv for pushing this forwards so much! Rebased version of https://github.com/zed-industries/zed/pull/39539 as working on an in-org branch simplifies a lot of things for us) Release Notes: - Added LSP semantic tokens highlighting support --------- Co-authored-by: Neil Macneale V <neil.macneale.v@gmail.com> Co-authored-by: Kirill Bulatov <kirill@zed.dev> Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
58 lines
1.4 KiB
Rust
58 lines
1.4 KiB
Rust
mod highlights_tree_view;
|
|
mod key_context_view;
|
|
pub mod lsp_button;
|
|
pub mod lsp_log_view;
|
|
mod syntax_tree_view;
|
|
|
|
#[cfg(test)]
|
|
mod lsp_log_view_tests;
|
|
|
|
use gpui::{App, AppContext, Entity};
|
|
|
|
pub use highlights_tree_view::{HighlightsTreeToolbarItemView, HighlightsTreeView};
|
|
pub use lsp_log_view::LspLogView;
|
|
pub use syntax_tree_view::{SyntaxTreeToolbarItemView, SyntaxTreeView};
|
|
use ui::{Context, Window};
|
|
use workspace::{Item, ItemHandle, SplitDirection, Workspace};
|
|
|
|
pub fn init(cx: &mut App) {
|
|
highlights_tree_view::init(cx);
|
|
lsp_log_view::init(false, cx);
|
|
syntax_tree_view::init(cx);
|
|
key_context_view::init(cx);
|
|
}
|
|
|
|
fn get_or_create_tool<T>(
|
|
workspace: &mut Workspace,
|
|
destination: SplitDirection,
|
|
window: &mut Window,
|
|
cx: &mut Context<Workspace>,
|
|
new_tool: impl FnOnce(&mut Window, &mut Context<T>) -> T,
|
|
) -> Entity<T>
|
|
where
|
|
T: Item,
|
|
{
|
|
if let Some(item) = workspace.item_of_type::<T>(cx) {
|
|
return item;
|
|
}
|
|
|
|
let new_tool = cx.new(|cx| new_tool(window, cx));
|
|
match workspace.find_pane_in_direction(destination, cx) {
|
|
Some(right_pane) => {
|
|
workspace.add_item(
|
|
right_pane,
|
|
new_tool.boxed_clone(),
|
|
None,
|
|
true,
|
|
true,
|
|
window,
|
|
cx,
|
|
);
|
|
}
|
|
None => {
|
|
workspace.split_item(destination, new_tool.boxed_clone(), window, cx);
|
|
}
|
|
}
|
|
new_tool
|
|
}
|