A simple CPU rendered GUI IDE experience.
fix
| -rw-r--r-- | src/bar.rs | 3 | ||||
| -rw-r--r-- | src/com.rs | 6 | ||||
| -rw-r--r-- | src/hov.rs | 8 | ||||
| -rw-r--r-- | src/lsp.rs | 4 | ||||
| -rw-r--r-- | src/main.rs | 22 | ||||
| -rw-r--r-- | src/text.rs | 37 |
6 files changed, 26 insertions, 54 deletions
@@ -1,9 +1,8 @@ -use std::iter::{once, repeat}; +use std::iter::repeat; use dsb::Cell; use dsb::cell::Style; use lsp_types::WorkDoneProgress; -use winit::keyboard::{Key, ModifiersState, NamedKey}; use crate::lsp::Client; use crate::text::TextArea; @@ -3,9 +3,8 @@ use std::mem::MaybeUninit; use std::sync::LazyLock; use Default::default; +use dsb::Cell; use dsb::cell::Style; -use dsb::{Cell, F}; -use fimg::Image; use itertools::Itertools; use lsp_types::*; @@ -176,7 +175,6 @@ fn r( to: &mut Vec<Cell>, ) { let bg = if selected { color(*b"262d3b") } else { color(*b"1c212b") }; - const T_BG: [u8; 3] = color(*b"11141a"); let ds: Style = Style { bg: bg, color: FG, flags: 0 }; let d: Cell = Cell { letter: None, style: ds }; @@ -267,6 +265,8 @@ fn r( pub const N: usize = 13; #[test] fn t() { + use dsb::F; + use fimg::Image; let ppem = 20.0; let lh = 10.0; let (w, h) = (611, 8000); @@ -1,12 +1,10 @@ use std::iter::{empty, once, repeat_n}; use std::ops::Range; use std::pin::pin; -use std::time::Instant; use std::vec::Vec; +use dsb::Cell; use dsb::cell::Style; -use dsb::{Cell, F}; -use fimg::Image; use itertools::Itertools; use markdown::mdast::{self, Node}; use ropey::Rope; @@ -266,6 +264,10 @@ pub fn markdown2(c: usize, x: &Node) -> Vec<Cell> { pub const BG: [u8; 3] = text::color(*b"191E27"); #[test] fn t() { + use std::time::Instant; + + use dsb::F; + use fimg::Image; let ppem = 18.0; let lh = 10.0; let (w, h) = (400, 8000); @@ -10,7 +10,7 @@ use std::time::Instant; use Default::default; use anyhow::Error; -use arc_swap::{ArcSwap, ArcSwapOption}; +use arc_swap::ArcSwap; use crossbeam::channel::{ Receiver, RecvError, SendError, Sender, unbounded, }; @@ -214,7 +214,7 @@ impl Client { return Ok(()); }; let mut p = self.semantic_tokens.1.lock(); - if let Some((h, task)) = &*p { + if let Some((h, _task)) = &*p { if !h.is_finished() { h.abort(); } diff --git a/src/main.rs b/src/main.rs index 8defde1..330d446 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,6 @@ )] #![allow(incomplete_features, redundant_semicolons)] use std::borrow::Cow; -use std::collections::HashSet; use std::num::NonZeroU32; use std::path::{Path, PathBuf}; use std::sync::{Arc, LazyLock}; @@ -42,16 +41,15 @@ use diff_match_patch_rs::traits::DType; use dsb::cell::Style; use dsb::{Cell, F, Fonts}; use fimg::{Image, OverlayAt}; -use lsp::{OnceOff, Rq}; +use lsp::Rq; use lsp_server::Connection; -use lsp_types::request::{HoverRequest, Request, SignatureHelpRequest}; +use lsp_types::request::{HoverRequest, SignatureHelpRequest}; use lsp_types::*; use regex::Regex; use ropey::Rope; use rust_fsm::StateMachine; use swash::{FontRef, Instance}; -use tokio::runtime::Runtime; -use tokio::task::{JoinError, JoinHandle, spawn_blocking}; +use tokio::task::spawn_blocking; use tokio_util::task::AbortOnDropHandle as DropH; use url::Url; use winit::event::{ @@ -231,7 +229,7 @@ pub(crate) fn entry(event_loop: EventLoop<()>) { (&*Box::leak(Box::new(c)), (t2), changed) }, ); - let (lsp, t, mut w) = match c { + let (lsp, _t, mut w) = match c { Some((a, b, c)) => (Some(a), Some(b), Some(c)), None => (None, None, None), }; @@ -419,7 +417,7 @@ pub(crate) fn entry(event_loop: EventLoop<()>) { (&mut cells, (c, r)), (t_ox, 0), x, - |(c, r), text, mut x| { + |(_c, _r), text, mut x| { if let State::Search(re, j, _) = &state { re.find_iter(&text.rope.to_string()) @@ -574,9 +572,9 @@ pub(crate) fn entry(event_loop: EventLoop<()>) { *max = Some(cells.l()); cells.vo = vo; let cells = cells.displayable(cells.l().min(15)); - let (_,left_, top_, w_, h_) = place_around_cursor((_x, _y), + let (_,left_, top_, _w_, h_) = place_around_cursor((_x, _y), &mut fonts, i.as_mut(), cells, cols, ppem, ls, - 0., -(h as f32), if is_above { com.filter(|x| !x.0).map(|(is, l, t, w, h)| h).unwrap_or_default() as f32 } else { h as f32 }); + 0., -(h as f32), if is_above { com.filter(|x| !x.0).map(|(_is, _l, _t, _w, h)| h).unwrap_or_default() as f32 } else { h as f32 }); i.r#box((left_.saturating_sub(1) as _, top_.saturating_sub(1) as _), w as _,h_ as _, [0;3]); }); } @@ -1183,7 +1181,7 @@ impl State { } } -use std::ops::{Not, Range}; +use std::ops::{Range}; rust_fsm::state_machine! { #[derive(Debug)] @@ -1353,8 +1351,8 @@ fn filter(text: &TextArea) -> String { } fn frunctinator( parameter1: usize, - parameter2: u8, - paramter4: u16, + _parameter2: u8, + _paramter4: u16, ) -> usize { lower::saturating::math! { parameter1 }; 0 diff --git a/src/text.rs b/src/text.rs index 19ec21d..e67a0c8 100644 --- a/src/text.rs +++ b/src/text.rs @@ -717,7 +717,7 @@ impl TextArea { pub fn slice<'c>( &self, - (c, r): (usize, usize), + (c, _r): (usize, usize), cell: &'c mut [Cell], range: Range<usize>, ) -> &'c mut [Cell] { @@ -1059,7 +1059,7 @@ pub static LOADER: LazyLock<Loader> = LazyLock::new(|| { }); // #[test] pub fn man() { - let query_str = r#" + let _query_str = r#" (line_comment)+ @quantified_nodes ((line_comment)+) @quantified_nodes_grouped ((line_comment) (line_comment)) @multiple_nodes_grouped @@ -1067,7 +1067,7 @@ pub fn man() { let source = Rope::from_str(r#"assert_eq!(0, Some(0));"#); // dbg!(source.slice(70..)); // let mut set = std::collections::HashMap::new(); - let mut n = 0; + let _n = 0; let loader = &*LOADER; // loader.set_scopes(nam.map(|x| x.to_string()).to_vec()); let language = loader.language_for_name("rust").unwrap(); @@ -1149,9 +1149,9 @@ pub fn man() { .., ) ); - for n in 0..40 { + for _n in 0..40 { dbg!(h.next_event_offset()); - let (e, hl) = h.advance(); + let (e, _hl) = h.advance(); dbg!(e); // dbg!(hl.map(|x| NAMES[x.idx()]).collect::<Vec<_>>(), e); dbg!( @@ -1452,33 +1452,6 @@ impl<'a> IndexMut<(usize, usize)> for Output<'a> { } } -fn txt() { - let mut o = vec![Cell::default(); 4 * 2]; - let mut o_ = Output { - into: &mut o, - output: Mapper { - into_s: (4, 2), - ox: 0, - oy: 0, - from_c: 4, - from_r: 4, - vo: 0, - ho: 1, - }, - }; - - o_.into[0].letter = Some('_'); - o_.into[4].letter = Some('_'); - // dbg!(o_.translate(dbg!(o_.to_point(4))).unwrap()); - - o_.get_range_enumerated((1, 0), (5, 0)).for_each(|x| { - x.0.letter = Some('.'); - // dbg!(x.1); - }); - - dbg!(o.as_chunks::<4>().0); -} - pub trait CoerceOption<T> { fn coerce(self) -> impl Iterator<Item = T>; } |