Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/lib.rs')
| -rw-r--r-- | helix-view/src/lib.rs | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs index a7e9f461..a9cf5c68 100644 --- a/helix-view/src/lib.rs +++ b/helix-view/src/lib.rs @@ -1,8 +1,11 @@ #[macro_use] pub mod macros; +mod action; pub mod annotations; +pub mod base64; pub mod clipboard; +pub mod diagnostic; pub mod document; pub mod editor; pub mod events; @@ -18,25 +21,6 @@ pub mod theme; pub mod tree; pub mod view; -use std::num::NonZeroUsize; - -// uses NonZeroUsize so Option<DocumentId> use a byte rather than two -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] -pub struct DocumentId(NonZeroUsize); - -impl Default for DocumentId { - fn default() -> DocumentId { - // Safety: 1 is non-zero - DocumentId(unsafe { NonZeroUsize::new_unchecked(1) }) - } -} - -impl std::fmt::Display for DocumentId { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_fmt(format_args!("{}", self.0)) - } -} - slotmap::new_key_type! { pub struct ViewId; } @@ -72,8 +56,21 @@ pub fn align_view(doc: &mut Document, view: &View, align: Align) { doc.set_view_offset(view.id, view_offset); } +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] +pub enum Range { + Document(helix_stdx::Range), + Lsp { + range: helix_lsp::lsp::Range, + offset_encoding: helix_lsp::OffsetEncoding, + }, +} + +pub use action::Action; +pub use diagnostic::Diagnostic; pub use document::Document; pub use editor::Editor; use helix_core::char_idx_at_visual_offset; +pub use helix_core::uri::DocumentId; +pub use spellbook::Dictionary; pub use theme::Theme; pub use view::View; |