A simple CPU rendered GUI IDE experience.
Diffstat (limited to 'src/edi/ra.rs')
| -rw-r--r-- | src/edi/ra.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/edi/ra.rs b/src/edi/ra.rs new file mode 100644 index 0000000..ef0c7c8 --- /dev/null +++ b/src/edi/ra.rs @@ -0,0 +1,38 @@ +use std::path::PathBuf; + +use lsp_server::Connection; +use rootcause::compat::IntoRootcause; + +use crate::hash; + +pub fn ra( + w: PathBuf, +) -> ( + std::thread::JoinHandle<Result<(), rootcause::Report>>, + lsp_server::Connection, +) { + let (a, b) = Connection::memory(); + let dh = std::panic::take_hook(); + let main = std::thread::current_id(); + let jh = std::thread::Builder::new() + .name("Rust Analyzer".into()) + .stack_size(1024 * 1024 * 8) + .spawn(move || { + let ra = std::thread::current_id(); + std::panic::set_hook(Box::new(move |info| { + if std::thread::current_id() == main { + println!("{:x}", hash(&w)); + dh(info); + } else if std::thread::current_id() == ra + || std::thread::current() + .name() + .is_some_and(|x| x.starts_with("RA")) + { + println!("RA panic @ {}", info.location().unwrap()); + } + })); + rust_analyzer::bin::run_server(b).into_rootcause() + }) + .unwrap(); + (jh, a) +} |