use crate::vscode_sys;
pub mod hover;
pub mod line_annotation;
pub struct LineDecoration {
pub line_number: usize,
pub line_annotation_text: String,
pub hover_message_text: String,
}
#[tracing::instrument(skip_all)]
pub fn create_decoration_type<'env>(
env: &'env napi::Env,
) -> Result<vscode_sys::TextEditorDecorationType<'env>, napi::Error> {
let theme_color =
vscode_sys::ThemeColor::new(env, "pijul.decorations.inlineCredit.foreground")?;
let after = vscode_sys::ThemableDecorationAttachmentRenderOptions::new(env)?
// Margin of roughly 10 characters to the right
// https://developer.mozilla.org/en-US/docs/Web/CSS/length#ch
.margin("0 0 0 10ch")?
.color(&theme_color)?;
let render_options = vscode_sys::DecorationRenderOptions::new(env)?.after(after)?;
let decoration_type =
vscode_sys::window::create_text_editor_decoration_type(env, render_options)?;
Ok(decoration_type)
}