A simple CPU rendered GUI IDE experience.
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/main.rs | 22 | ||||
| -rw-r--r-- | src/sym.rs | 2 |
3 files changed, 21 insertions, 4 deletions
@@ -61,6 +61,7 @@ scopeguard = "1.2.0" arc-swap = "1.7.1" atools = "0.1.10" swizzle = "0.1.0" +walkdir = "2.5.0" [profile.dev.package] rust-analyzer.opt-level = 3 diff --git a/src/main.rs b/src/main.rs index 34e16ea..6840e63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -237,6 +237,11 @@ pub(crate) fn entry(event_loop: EventLoop<()>) { .as_ref() .and_then(|x| rooter(&x.parent().unwrap())) .and_then(|x| x.canonicalize().ok()); + let tree = workspace.as_ref().map(|x| { + walkdir::WalkDir::new(x).into_iter().flatten().filter(|x| x.path().extension().is_some_and(_ == "rs") ).map(|x| { + x.path().to_owned() + }).collect::<Vec<_>>() + }); let c = workspace.as_ref().zip(origin.clone()).map( |(workspace, origin)| { let dh = std::panic::take_hook(); @@ -447,9 +452,18 @@ pub(crate) fn entry(event_loop: EventLoop<()>) { if let State::Symbols(x) = &mut state { x.poll(|x, (_, p)| x.ok().map(|r| { + let tree = tree.as_deref().unwrap().iter().map(|x| { + SymbolInformation{ name: x.file_name().unwrap().to_str().unwrap().to_string() + ,kind: SymbolKind::FILE,location: Location { + range: lsp_types::Range{end:Position::default(), start:Position::default()}, + uri: Url::from_file_path(&x).unwrap(), + + }, container_name: None,deprecated: None, + tags: None, } + }); sym::Symbols { tedit: p.map(_.tedit).unwrap_or_default(), - r,..default() // dont care about previous selection + r: tree.chain(r).collect(),..default() // dont care about previous selection } }), &l.runtime); } @@ -732,10 +746,12 @@ pub(crate) fn entry(event_loop: EventLoop<()>) { let mut r = c.len()/columns; assert_eq!(c.len()%columns, 0); let (w, h) = dsb::size(&fonts.regular, ppem, ls, (columns, r)); + // std::fs::write("cells", Cell::store(c)); + if w >= window.inner_size().width as usize // || position.1 + h >= window.inner_size().height as usize - { - unsafe { dsb::render_owned(c, (columns, c.len() / columns), 18.0, fonts, 1.1, true).save("fail.png") }; + { + unsafe { dsb::render_owned(c, (columns, c.len() / columns), ppem, fonts, ls, true).save("fail.png") }; return Err(()); } assert!(w < window.inner_size().width as _ &&h < window.inner_size().height as _); @@ -130,7 +130,7 @@ fn r( const MAP: [([u8; 3], [u8; 3], &str); 70] = { car::map!( amap::amap! { - const { SymbolKind::FILE.0 as usize } => ("#9a9b9a", " "), + const { SymbolKind::FILE.0 as usize } => ("#9a9b9a", " "), const { SymbolKind::METHOD.0 as usize } | const { SymbolKind::FUNCTION.0 as usize } => ("#FFD173", "λ "), const { SymbolKind::CONSTRUCTOR.0 as usize } => ("#FFAD66", "->"), const { SymbolKind::FIELD.0 as usize } => ("#E06C75", "x."), |