Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'src/hov.rs')
-rw-r--r--src/hov.rs22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/hov.rs b/src/hov.rs
index 48ab1cd..96725dc 100644
--- a/src/hov.rs
+++ b/src/hov.rs
@@ -1,6 +1,5 @@
use std::fmt::Debug;
use std::iter::{empty, once, repeat_n};
-use std::os::fd::AsFd;
use std::pin::pin;
use std::str::FromStr;
use std::sync::Arc;
@@ -310,7 +309,7 @@ fn t() {
let (w, h) = (400, 8000);
let (c, r) = dsb::fit(&crate::FONT, ppem, lh, (w, h));
- let cells = markdown2(c, &p(include_str!("vec.md")).unwrap());
+ let cells = markdown2(c, &p(include_str!("vec.md")).unwrap(), None);
dbg!(l(&p(include_str!("vec.md")).unwrap()));
dbg!(cells.len() / c);
dbg!(w, h);
@@ -399,7 +398,13 @@ impl DiagnosticHovr {
simplify_path(&dawg.replace('\n', "\r\n").replace("βΈ¬", ":"))
.bytes()
{
- t.rx(b, std::fs::File::open("/dev/null").unwrap().as_fd());
+ t.rx(
+ b,
+ #[cfg(target_family = "unix")]
+ std::os::fd::AsFd::as_fd(
+ &std::fs::File::open("/dev/null").unwrap(),
+ ),
+ );
}
let y_lim = t
.cells
@@ -491,12 +496,15 @@ pub fn to_snippet<'a: 'c, 'b: 'c, 'c>(
) -> annotate_snippets::Group<'c> {
use annotate_snippets::*;
match severity {
- Some(DiagnosticSeverity::WARNING) => Level::WARNING,
- Some(DiagnosticSeverity::INFORMATION) => Level::INFO,
- Some(DiagnosticSeverity::HINT) => Level::HELP,
+ Some(DiagnosticSeverity::Warning) => Level::WARNING,
+ Some(DiagnosticSeverity::Information) => Level::INFO,
+ Some(DiagnosticSeverity::Hint) => Level::HELP,
_ => Level::ERROR,
}
- .primary_title(message)
+ .primary_title(match message {
+ lsp_types::Message::String(x) => x,
+ lsp_types::Message::MarkupContent(_) => unimplemented!(),
+ })
.element(Snippet::source(t).annotation(
AnnotationKind::Primary.span(t.l_range(*range).unwrap()),
))