A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/rnd.rs')
-rw-r--r--src/rnd.rs49
1 files changed, 19 insertions, 30 deletions
diff --git a/src/rnd.rs b/src/rnd.rs
index 8e2ba9b..3c27366 100644
--- a/src/rnd.rs
+++ b/src/rnd.rs
@@ -21,8 +21,8 @@ use crate::edi::{Editor, lsp_m};
use crate::lsp::Rq;
use crate::text::{CoerceOption, RopeExt, col, color_};
use crate::{
- BG, BORDER, CompletionAction, CompletionState, FG, FONT, complete,
- filter, lsp, sig,
+ BG, BORDER, CompletionAction, CompletionState, FG, FONT, com, filter,
+ lsp, sig,
};
#[implicit_fn::implicit_fn]
@@ -134,15 +134,6 @@ pub fn render(
x.style.fg = col!("#FFD173");
});
} }
- if let Some(crate::hov::Hovr{ range:Some(r),..} ) = &ed.requests.hovering.result {
- x.get_range(text.map_to_visual((r.start.character as _, r.start.line as _)),
- text.map_to_visual((r.end.character as usize, r.end.line as _)))
- .for_each(|x| {
- x.style.secondary_color = col!("#73d0ff");
- x.style.flags |= Style::UNDERCURL;
- });
- // x.range;
- }
if let Some((lsp, p)) = lsp_m!(ed + p) && let uri = Url::from_file_path(p).unwrap() && let Some(diag) = lsp.diagnostics.get(&uri, &lsp.diagnostics.guard()) {
#[derive(Copy, Clone, Debug)]
enum EType {
@@ -678,13 +669,13 @@ pub fn render(
BORDER,
);
}
- State::Command(x) => 'out: {
+ State::Symbols(Rq { result: Some(x), .. }) => 'out: {
let ws = ed.workspace.as_deref().unwrap();
let c = x.cells(50, ws);
// let (_x, _y) = text.cursor_visual();
let _x = 0;
let _y = r - 1;
- let Ok((_, left, top, w, h)) = place_around(
+ let Ok((_is_above, left, top, w, h)) = place_around(
(_x, _y),
i.copy(),
&c,
@@ -707,14 +698,14 @@ pub fn render(
h as _,
BORDER,
);
- }
- State::Symbols(Rq { result: Some(x), .. }) => 'out: {
+ },
+ State::Command(x) => 'out: {
let ws = ed.workspace.as_deref().unwrap();
let c = x.cells(50, ws);
// let (_x, _y) = text.cursor_visual();
let _x = 0;
let _y = r - 1;
- let Ok((_is_above, left, top, w, h)) = place_around(
+ let Ok((is_above, left, top, w, mut h)) = place_around(
(_x, _y),
i.copy(),
&c,
@@ -744,7 +735,7 @@ pub fn render(
CompletionState::Complete(Rq {
result: Some(ref x), ..
}) => {
- let c = complete::s(x, 40, &filter(&text));
+ let c = com::s(x, 40, &filter(&text));
if c.len() == 0 {
ed.requests
.complete
@@ -942,17 +933,15 @@ pub fn render(
}
pub fn simplify_path(x: &str) -> String {
- static DEP: LazyLock<Regex> = LazyLock::new(|| {
- Regex::new(r"\.cargo\/git\/checkouts\/(?<name>[^/]+)\-[a-f0-9]+\/[a-f0-9]+").unwrap()
- });
- static DEP2: LazyLock<Regex> = LazyLock::new(|| {
- Regex::new(r"\.cargo\/registry\/src/index.crates.io-[0-9a-f]+/(?<name>[^/]+)\-(?<version>[0-9]+\.[0-9]+\.[0-9]+)").unwrap()
- });
- static RUST_SRC: LazyLock<Regex> = LazyLock::new(|| {
- Regex::new(r".rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library").unwrap()
- });
- let x = x.replace(env!("HOME"), " ");
- [(&*RUST_SRC, " "), (&*DEP, " /$name"), (&*DEP2, " /$name")]
- .into_iter()
- .fold(x, |acc, (r, repl)| r.replace(&acc, repl).into_owned())
+ static DEP: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\.cargo\/git\/checkouts\/(?<name>[^/]+)\-[a-f0-9]+\/[a-f0-9]+").unwrap());
+ static DEP2: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\.cargo\/registry\/src/index.crates.io-[0-9a-f]+/(?<name>[^/]+)\-(?<version>[0-9]+\.[0-9]+\.[0-9]+)").unwrap());
+ static RUST_SRC: LazyLock<Regex> = LazyLock::new(|| Regex::new(r".rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library").unwrap());
+ let x = x.replace(env!("HOME"), " ");
+ [
+ (&*RUST_SRC, " "),
+ (&*DEP, " /$name"),
+ (&*DEP2, " /$name"),
+ ].into_iter().fold(x, |acc, (r, repl)| {
+ r.replace(&acc, repl).into_owned()
+ })
}