A simple CPU rendered GUI IDE experience.
changes
| -rw-r--r-- | languages.toml | 2 | ||||
| -rw-r--r-- | src/edi.rs | 38 | ||||
| -rw-r--r-- | src/edi/input_handlers/keyboard.rs | 32 | ||||
| -rw-r--r-- | src/lsp/communication.rs | 1 | ||||
| -rw-r--r-- | src/main.rs | 2 |
5 files changed, 43 insertions, 32 deletions
diff --git a/languages.toml b/languages.toml index ea92bab..61ed0fc 100644 --- a/languages.toml +++ b/languages.toml @@ -287,6 +287,8 @@ typing.triggerChars = ".=<>{(+" assist.preferSelf = true checkOnSave = true diagnostics.enable = true +diagnostics.experimental.enable = true +diagnostics.styleLints.enable = true semanticHighlighting.punctuation.separate.macroBang = true semanticHighlighting.punctuation.specialization.enable = true semanticHighlighting.punctuation.enable = true @@ -359,24 +359,24 @@ impl Editor { println!("set git dir {:?}", &me.git_dir); me.language = n; me.origin = o; - me.tree = ws.as_ref().map(|x| { - walkdir::WalkDir::new(x) - .into_iter() - .flatten() - .filter(|x| { - let x = x.path(); - l.is_some_and(|l| { - l.file_types.iter().any(|y| match y { - FileType::Extension(e) => - x.extension().is_some_and(|x| x == &**e), - FileType::Glob(glob) => - glob.compile_matcher().is_match(x), - }) - }) - }) - .map(|x| x.path().to_owned()) - .collect::<Vec<_>>() - }); + // me.tree = ws.as_ref().map(|x| { + // walkdir::WalkDir::new(x) + // .into_iter() + // .flatten() + // .filter(|x| { + // let x = x.path(); + // l.is_some_and(|l| { + // l.file_types.iter().any(|y| match y { + // FileType::Extension(e) => + // x.extension().is_some_and(|x| x == &**e), + // FileType::Glob(glob) => + // glob.compile_matcher().is_match(x), + // }) + // }) + // }) + // .map(|x| x.path().to_owned()) + // .collect::<Vec<_>>() + // }); let g = me.git_dir.clone(); if let Some(o) = me.origin.clone() @@ -590,7 +590,6 @@ impl Editor { let r = self.text.r; // let ws = self.workspace.clone(); let git_dir = self.git_dir.clone(); - let tree = self.tree.clone(); // let lsp = self.lsp.take(); let mut me = take(self); @@ -604,7 +603,6 @@ impl Editor { } self.open_or_restore(&x, git_dir, Some(w), lsp_mn)?; self.text.r = r; - self.tree = tree; Ok(()) } diff --git a/src/edi/input_handlers/keyboard.rs b/src/edi/input_handlers/keyboard.rs index b1e780d..d91e562 100644 --- a/src/edi/input_handlers/keyboard.rs +++ b/src/edi/input_handlers/keyboard.rs @@ -83,15 +83,25 @@ impl Editor { l.matching_brace(f, &mut self.text) }, Do::DeleteBracketPair => self.delete_bracket_pair(), - Do::Symbols => + Do::Symbols if let Some((lsp, o)) = lsp!(self + p) - && let Ok(syms) = lsp.workspace_symbols("".into()) - { - let mut q = Rq::new(lsp.runtime.spawn( - syms.map(Anonymize::anonymize).map(|x| { - x.map(|x| x.map(SymbolsList::Workspace)) - }), - )); + && let Ok(syms) = lsp.workspace_symbols("".into()) => + { + let mut q = Rq::new( + lsp.runtime.spawn(syms.map(Anonymize::anonymize).map( + |x| x.map(|x| x.map(SymbolsList::Workspace)), + )), + ); + q.result = Some(Symbols::new( + self.tree.as_deref().unwrap(), + self.text.bookmarks.clone(), + o.into(), + )); + self.state = State::Symbols(q); + } + Do::Symbols => + if let Some(o) = &self.origin { + let mut q = Rq::default(); q.result = Some(Symbols::new( self.tree.as_deref().unwrap(), self.text.bookmarks.clone(), @@ -536,14 +546,14 @@ impl Editor { .cursor .inner .iter() - .map(|cursor| { + .filter_map(|cursor| { let (x, y) = cursor.cursor(&self.text.rope); let y = match dir { - Direction::Above => y - 1, + Direction::Above => y.checked_sub(1)?, Direction::Below => y + 1, }; let position = self.text.line_to_char(y) + x; - position + Some(position) }) .filter(|&p| self.text.cursor.iter().all(|x| x != p)) .collect::<Vec<_>>() diff --git a/src/lsp/communication.rs b/src/lsp/communication.rs index 2ef150c..4c4f49d 100644 --- a/src/lsp/communication.rs +++ b/src/lsp/communication.rs @@ -150,6 +150,7 @@ impl super::Client { &'me self, y: &X::Params, ) -> Result<X::Result, RequestError<X>> { + let _guard = self.runtime.enter(); self.runtime .block_on(tokio::time::timeout( tokio::time::Duration::from_secs(20), diff --git a/src/main.rs b/src/main.rs index 6dfe02b..7e81e5e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #![feature( -unsized_const_params, + unsized_const_params, exact_div, yeet_expr, const_array, |