From f751ef4324fe5a4f94bec238ae9e0101aac748a3 Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Wed, 5 Mar 2025 07:35:32 +0800 Subject: [PATCH] Fix Nightly (#219) --- crates/api/src/opts/set_extmark.rs | 15 ++++++++ crates/api/src/types/mod.rs | 4 ++ crates/api/src/types/virt_lines_overflow.rs | 20 ++++++++++ flake.lock | 42 ++++++++++----------- 4 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 crates/api/src/types/virt_lines_overflow.rs diff --git a/crates/api/src/opts/set_extmark.rs b/crates/api/src/opts/set_extmark.rs index 4e8f0d7..78eeed2 100644 --- a/crates/api/src/opts/set_extmark.rs +++ b/crates/api/src/opts/set_extmark.rs @@ -1,6 +1,8 @@ use types::{Array, Integer}; use crate::trait_utils::StringOrListOfStrings; +#[cfg(feature = "neovim-nightly")] +use crate::types::VirtLinesOverflow; use crate::types::{ExtmarkHlMode, ExtmarkVirtTextPosition}; /// Options passed to [`Buffer::set_extmark()`](crate::Buffer::set_extmark). @@ -425,6 +427,12 @@ pub struct SetExtmarkOpts { #[builder(argtype = "bool")] virt_lines_leftcol: types::Boolean, + /// Controls how to handle virtual lines wider than the window. + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] + #[cfg(feature = "neovim-nightly")] + #[builder(argtype = "VirtLinesOverflow", inline = "{0}.into()")] + virt_lines_overflow: types::String, + /// Whether the extmark should not be placed if the line or column value is /// past the end of the buffer or end of the line, respectively. Defaults /// to `true`. @@ -479,6 +487,13 @@ pub struct SetExtmarkOpts { )] conceal: types::String, + /// When called, lines in the range are not drawn at all (according to + /// `conceallevel`); the next unconcealed line is drawn instead. + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] + #[cfg(feature = "neovim-nightly")] + #[builder(argtype = "()", inline = "{let _ = {0}; types::String::new()}")] + conceal_lines: types::String, + #[builder(argtype = "bool")] spell: types::Boolean, diff --git a/crates/api/src/types/mod.rs b/crates/api/src/types/mod.rs index 9e9bda1..eac249a 100644 --- a/crates/api/src/types/mod.rs +++ b/crates/api/src/types/mod.rs @@ -43,6 +43,8 @@ mod statusline_highlight_infos; mod statusline_infos; mod ui_infos; mod viml_ast_node; +#[cfg(feature = "neovim-nightly")] // On Nightly. +mod virt_lines_overflow; #[cfg(feature = "neovim-0-10")] // On 0.10 and nightly. mod win_text_height_infos; mod window_anchor; @@ -97,6 +99,8 @@ pub use statusline_highlight_infos::*; pub use statusline_infos::*; pub use ui_infos::*; pub use viml_ast_node::*; +#[cfg(feature = "neovim-nightly")] // On Nightly. +pub use virt_lines_overflow::VirtLinesOverflow; #[cfg(feature = "neovim-0-10")] // On 0.10 and nightly. pub use win_text_height_infos::*; pub use window_anchor::*; diff --git a/crates/api/src/types/virt_lines_overflow.rs b/crates/api/src/types/virt_lines_overflow.rs new file mode 100644 index 0000000..905a335 --- /dev/null +++ b/crates/api/src/types/virt_lines_overflow.rs @@ -0,0 +1,20 @@ +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum VirtLinesOverflow { + Scroll, + Trunc, +} + +impl VirtLinesOverflow { + fn as_str(&self) -> &'static str { + match self { + Self::Scroll => "scroll", + Self::Trunc => "trunk", + } + } +} + +impl From for types::String { + fn from(virt_lines_overflow: VirtLinesOverflow) -> Self { + virt_lines_overflow.as_str().into() + } +} diff --git a/flake.lock b/flake.lock index b117723..b18924e 100644 --- a/flake.lock +++ b/flake.lock @@ -40,11 +40,11 @@ ] }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", "type": "github" }, "original": { @@ -62,11 +62,11 @@ ] }, "locked": { - "lastModified": 1736143030, - "narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=", + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", "type": "github" }, "original": { @@ -146,11 +146,11 @@ ] }, "locked": { - "lastModified": 1736917206, - "narHash": "sha256-JTBWmyGf8K1Rwb+gviHIUzRJk/sITtT+72HXFkTZUjo=", + "lastModified": 1739595404, + "narHash": "sha256-0CjCfbq0yHWexOrpO06e2WU1r5JAqR6ffy1zgM3NksI=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "afd0a42e8c61ebb56899315ee4084a8b2e4ff425", + "rev": "06519cec8fb32d219006da6eacd255504a9996af", "type": "github" }, "original": { @@ -172,11 +172,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1737614530, - "narHash": "sha256-s5+trj2UfrIWlrCm+hKDB5+36kY5scH9MxM9zfU+4qc=", + "lastModified": 1740647326, + "narHash": "sha256-sna9JSHxSGqb2y+qW4cX8Tjd/jJm0gJbwnsd7RPu3H4=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "7d9aaf2f175602b8511e4c5134c4a975628c6948", + "rev": "18b8e8cca2aa0a21ded8a42423df4fb9efd24117", "type": "github" }, "original": { @@ -189,11 +189,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1737560784, - "narHash": "sha256-bW3ub7hI5Ml+4cFErZvlbbQNDmmycoroRYYAegj33qo=", + "lastModified": 1740610854, + "narHash": "sha256-pQ8BBwNdVjbiK3YgQc6twbL/1crXtM/jM9whvc6T9i8=", "owner": "neovim", "repo": "neovim", - "rev": "af0ef2ac9dd19b7c4005a3197334d3e7d554646c", + "rev": "3cce6570312830dfab9efd9d521125f0049ad55f", "type": "github" }, "original": { @@ -204,11 +204,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1737469691, - "narHash": "sha256-nmKOgAU48S41dTPIXAq0AHZSehWUn6ZPrUKijHAMmIk=", + "lastModified": 1740560979, + "narHash": "sha256-Vr3Qi346M+8CjedtbyUevIGDZW8LcA1fTG0ugPY/Hic=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9e4d5190a9482a1fb9d18adf0bdb83c6e506eaab", + "rev": "5135c59491985879812717f4c9fea69604e7f26f", "type": "github" }, "original": { @@ -248,11 +248,11 @@ ] }, "locked": { - "lastModified": 1737483750, - "narHash": "sha256-5An1wq5U8sNycOBBg3nsDDgpwBmR9liOpDGlhliA6Xo=", + "lastModified": 1739829690, + "narHash": "sha256-mL1szCeIsjh6Khn3nH2cYtwO5YXG6gBiTw1A30iGeDU=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "f2cc121df15418d028a59c9737d38e3a90fbaf8f", + "rev": "3d0579f5cc93436052d94b73925b48973a104204", "type": "github" }, "original": {