Skip to content

Commit

Permalink
Removing Symbols viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
notdanilo committed Oct 26, 2023
1 parent b6d48c3 commit c422ba7
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 179 deletions.
6 changes: 3 additions & 3 deletions tools/editor/src/gui/ui/layout/editor/ir/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ impl Interface {
Visibility::new().show(ui, &mut interface.visibility);
Identifier::new().show(ui, &mut interface.identifier);
});
EditableList::new("Objects", "Add object").show(ui, &mut interface.objects, |ui, object| {
EditableList::new(format!("Objects - Symbols: {}", interface.objects.len()), "Add object").show(ui, &mut interface.objects, |ui, object| {
Object::new().show(ui, object);
});
EditableList::new("Functions", "Add function").show(ui, &mut interface.functions, |ui, function| {
EditableList::new(format!("Functions - Symbols: {}", interface.functions.len()), "Add function").show(ui, &mut interface.functions, |ui, function| {
Function::new().show(ui, function);
});
EditableList::new("Methods", "Add method").show(ui, &mut interface.methods, |ui, function| {
EditableList::new(format!("Methods - Symbols: {}", interface.methods.len()), "Add method").show(ui, &mut interface.methods, |ui, function| {
Method::new().show(ui, function);
});
EditableList::new("Interfaces", "Add interface").show(ui, &mut interface.interfaces, |ui, interface| {
Expand Down
2 changes: 1 addition & 1 deletion tools/editor/src/gui/ui/layout/editor/ir/menu_button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl MenuButton for EditorMenuButton {

if let Some(entry) = entry {
stacker::grow(1024 * 1024 * 10, || {
let project = PythonParser::full().parse(entry.as_path()).unwrap();
let project = PythonParser::symbol().parse(entry.as_path()).unwrap();
panes.new_pane(Box::new(Editor::new(project)));
});
}
Expand Down
18 changes: 16 additions & 2 deletions tools/editor/src/gui/ui/layout/editor/ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@ pub use module::*;
pub use literal::*;
pub use menu_button::*;
pub use interface::*;
use ligen_ir::symbols::Symbols;
use crate::gui::ui::List;

use crate::gui::ui::panes::Pane;

#[derive(Default)]
pub struct Editor {
project: ligen_ir::Project
project: ligen_ir::Project,
filter: String,
symbols: Symbols
}

impl Editor {
pub fn new(project: ligen_ir::Project) -> Self {
Self { project }
let filter = Default::default();
let symbols = Symbols::new(&project);
Self { project, symbols, filter }
}
}

Expand Down Expand Up @@ -67,6 +73,14 @@ impl Pane for Editor {
});
ui.separator();
Project::new().show(ui, &mut self.project);
ui.separator();
ui.horizontal(|ui| {
ui.label("Filter");
ui.text_edit_singleline(&mut self.filter);
});
List::new("Symbols").show(ui, &mut self.symbols.symbols.iter_mut().filter(|symbol| symbol.to_string().contains(self.filter.as_str())), |ui, symbol| {
ui.label(symbol.to_string());
});
UiResponse::None
}
}
20 changes: 10 additions & 10 deletions tools/editor/src/gui/ui/layout/editor/ir/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ impl Module {
}

pub fn show(&mut self, ui: &mut egui::Ui, module: &mut ligen_ir::Module) {
CollapsingHeader::new(module.identifier.to_string())
CollapsingHeader::new(format!("{} - Symbols: {}", module.identifier, module.count_symbols()))
.id_source("module")
.show(ui, |ui| {
ui.horizontal_top(|ui| {
Visibility::new().show(ui, &mut module.visibility);
Identifier::new().show(ui, &mut module.identifier);
});
EditableList::new("Types", "Add type").show(ui, &mut module.types, |ui, type_| {
EditableList::new(format!("Types - Symbols: {}", module.types.len()), "Add type").show(ui, &mut module.types, |ui, type_| {
TypeDefinition::new().show(ui, type_);
});
EditableList::new("Imports", "Add import").show(ui, &mut module.imports, |ui, import| {
Import::new().show(ui, import);
});
EditableList::new("Objects", "Add object").show(ui, &mut module.objects, |ui, object| {
EditableList::new(format!("Objects - Symbols: {}", module.objects.len()), "Add object").show(ui, &mut module.objects, |ui, object| {
Object::new().show(ui, object);
});
EditableList::new("Functions", "Add function").show(ui, &mut module.functions, |ui, function| {
EditableList::new(format!("Functions - Symbols: {}", module.functions.len()), "Add function").show(ui, &mut module.functions, |ui, function| {
Function::new().show(ui, function);
});
EditableList::new("Modules", "Add module").show(ui, &mut module.modules, |ui, module| {
EditableList::new(format!("Interfaces - Symbols: {}", module.count_symbols_in_interfaces()), "Add interface").show(ui, &mut module.interfaces, |ui, interface| {
Interface::new().show(ui, interface);
});
EditableList::new(format!("Modules - Symbols: {}", module.count_symbols_in_modules()), "Add module").show(ui, &mut module.modules, |ui, module| {
Module::new().show(ui, module);
});
EditableList::new("Interfaces", "Add interface").show(ui, &mut module.interfaces, |ui, interface| {
Interface::new().show(ui, interface);
EditableList::new("Imports", "Add import").show(ui, &mut module.imports, |ui, import| {
Import::new().show(ui, import);
});
Attributes::new().show(ui, &mut module.attributes);
});
Expand Down
1 change: 0 additions & 1 deletion tools/editor/src/gui/ui/layout/editor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod ir;
pub mod symbols;
26 changes: 0 additions & 26 deletions tools/editor/src/gui/ui/layout/editor/symbols/interface.rs

This file was deleted.

30 changes: 0 additions & 30 deletions tools/editor/src/gui/ui/layout/editor/symbols/menu_button.rs

This file was deleted.

46 changes: 0 additions & 46 deletions tools/editor/src/gui/ui/layout/editor/symbols/mod.rs

This file was deleted.

38 changes: 0 additions & 38 deletions tools/editor/src/gui/ui/layout/editor/symbols/module.rs

This file was deleted.

19 changes: 0 additions & 19 deletions tools/editor/src/gui/ui/layout/editor/symbols/project.rs

This file was deleted.

5 changes: 2 additions & 3 deletions tools/editor/src/gui/ui/layout/menu/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::gui::ui::editor::{ir, symbols};
use crate::gui::ui::editor::ir;
use crate::gui::ui::panes::Panes;
use crate::prelude::*;

Expand All @@ -20,8 +20,7 @@ pub struct Menu {
impl Menu {
pub fn new() -> Self {
let buttons: Vec<Box<dyn MenuButton>> = vec![
Box::new(ir::EditorMenuButton),
Box::new(symbols::menu_button::EditorMenuButton)
Box::new(ir::EditorMenuButton)
];
Self { buttons }
}
Expand Down

0 comments on commit c422ba7

Please sign in to comment.