diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a72ab0..5b79316 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,10 +16,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - neovim: [v0.10.4, Nightly] + neovim: [v0.10.4, v0.11.1, Nightly] include: - neovim: v0.10.4 features: "--features neovim-0-10" + - neovim: v0.11.1 + features: "--features neovim-0-11" - neovim: Nightly features: "--features neovim-nightly" diff --git a/Cargo.toml b/Cargo.toml index 6021373..36a34b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,8 @@ rustdoc-args = ["--cfg", "docsrs"] [features] neovim-0-10 = ["api/neovim-0-10"] -neovim-nightly = ["neovim-0-10", "api/neovim-nightly"] +neovim-0-11 = ["api/neovim-0-10", "api/neovim-0-11"] +neovim-nightly = ["neovim-0-11", "api/neovim-nightly"] libuv = ["dep:libuv"] mlua = ["dep:mlua"] diff --git a/build.rs b/build.rs index df9078c..d2f3bab 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,11 @@ -#[cfg(not(any(feature = "neovim-0-10", feature = "neovim-nightly")))] +#[cfg(not(any( + feature = "neovim-0-10", + feature = "neovim-0-11", + feature = "neovim-nightly" +)))] compile_error!( - "You must enable one of the features: neovim-0-10, neovim-nightly" + "You must enable one of the features: neovim-0-10, neovim-0-11, \ + neovim-nightly" ); fn main() { diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index 6cbd640..974895f 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -9,7 +9,8 @@ license.workspace = true [features] neovim-0-10 = [] -neovim-nightly = ["neovim-0-10"] +neovim-0-11 = ["neovim-0-10"] +neovim-nightly = ["neovim-0-11"] [dependencies] luajit = { workspace = true } diff --git a/crates/api/src/deprecated.rs b/crates/api/src/deprecated.rs index 4d59fd1..c1b218e 100644 --- a/crates/api/src/deprecated.rs +++ b/crates/api/src/deprecated.rs @@ -14,7 +14,7 @@ use crate::{Buffer, Window}; /// /// [1]: https://neovim.io/doc/user/api.html#nvim_exec() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `exec2` instead") )] pub fn exec(src: &str, output: bool) -> Result> { @@ -36,7 +36,7 @@ pub fn exec(src: &str, output: bool) -> Result> { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_get_current_win() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `get_hl` instead") )] pub fn get_hl_by_id(hl_id: u32, rgb: bool) -> Result { @@ -55,7 +55,7 @@ pub fn get_hl_by_id(hl_id: u32, rgb: bool) -> Result { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_get_hl_by_name() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `get_hl` instead") )] pub fn get_hl_by_name(name: &str, rgb: bool) -> Result { @@ -78,7 +78,7 @@ pub fn get_hl_by_name(name: &str, rgb: bool) -> Result { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_get_option() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `get_option_value` instead") )] pub fn get_option(name: &str) -> Result @@ -97,7 +97,7 @@ where /// /// [1]: https://neovim.io/doc/user/api.html#nvim_get_option_info() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `get_option_info2` instead") )] pub fn get_option_info(name: &str) -> Result { @@ -115,7 +115,7 @@ pub fn get_option_info(name: &str) -> Result { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_set_option() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `set_option_value` instead") )] pub fn set_option(name: &str, value: Opt) -> Result<()> @@ -142,7 +142,7 @@ impl Buffer { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_buf_get_option() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `get_option_value` instead") )] pub fn get_option(&self, name: &str) -> Result @@ -164,7 +164,7 @@ impl Buffer { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_buf_set_option() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `set_option_value` instead") )] pub fn set_option(&mut self, name: &str, value: V) -> Result<()> @@ -193,7 +193,7 @@ impl Window { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_win_get_option() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `get_option_value` instead") )] pub fn get_option(&self, name: &str) -> Result @@ -215,7 +215,7 @@ impl Window { /// /// [1]: https://neovim.io/doc/user/api.html#nvim_win_set_option() #[cfg_attr( - feature = "neovim-nightly", + feature = "neovim-0-11", // On 0.11 and Nightly. deprecated(since = "0.5.0", note = "use `set_option_value` instead") )] pub fn set_option(&mut self, name: &str, value: Opt) -> Result<()> diff --git a/crates/api/src/ffi/vim.rs b/crates/api/src/ffi/vim.rs index c6dd637..7f55a71 100644 --- a/crates/api/src/ffi/vim.rs +++ b/crates/api/src/ffi/vim.rs @@ -166,7 +166,8 @@ extern "C" { // https://github.com/neovim/neovim/blob/v0.10.0/src/nvim/api/vim.c#L360 pub(crate) fn nvim_input( - #[cfg(feature = "neovim-nightly")] channel_id: u64, + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. + channel_id: u64, keys: NvimStr, ) -> Integer; diff --git a/crates/api/src/opts/create_augroup.rs b/crates/api/src/opts/create_augroup.rs index 8cce713..5a3e590 100644 --- a/crates/api/src/opts/create_augroup.rs +++ b/crates/api/src/opts/create_augroup.rs @@ -1,5 +1,5 @@ /// Options passed to [`create_augroup()`](crate::create_augroup). -#[cfg(feature = "neovim-nightly")] // Only on Nightly. +#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. #[derive(Clone, Debug, Default, macros::OptsBuilder)] #[repr(C)] pub struct CreateAugroupOpts { @@ -12,14 +12,14 @@ pub struct CreateAugroupOpts { } /// Options passed to [`create_augroup()`](crate::create_augroup). -#[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. +#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. #[derive(Clone, Debug, Default)] #[repr(C)] pub struct CreateAugroupOpts { clear: types::Object, } -#[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. +#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. impl CreateAugroupOpts { #[inline(always)] pub fn builder() -> CreateAugroupOptsBuilder { @@ -27,11 +27,11 @@ impl CreateAugroupOpts { } } -#[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. +#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. #[derive(Clone, Default)] pub struct CreateAugroupOptsBuilder(CreateAugroupOpts); -#[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. +#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. impl CreateAugroupOptsBuilder { /// Whether to clear existing commands if the group already exists. #[inline] diff --git a/crates/api/src/opts/set_extmark.rs b/crates/api/src/opts/set_extmark.rs index 5db02ad..9b0cc77 100644 --- a/crates/api/src/opts/set_extmark.rs +++ b/crates/api/src/opts/set_extmark.rs @@ -1,7 +1,7 @@ use types::{Array, Integer}; use crate::trait_utils::StringOrListOfStrings; -#[cfg(feature = "neovim-nightly")] +#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. use crate::types::VirtLinesOverflow; use crate::types::{ExtmarkHlMode, ExtmarkVirtTextPosition}; @@ -28,8 +28,8 @@ pub struct SetExtmarkOpts { end_col: types::Integer, /// Name of the highlight group used to highlight this mark. - #[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. - #[cfg_attr(docsrs, doc(cfg(not(feature = "neovim-nightly"))))] + #[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. + #[cfg_attr(docsrs, doc(cfg(not(feature = "neovim-0-11"))))] #[builder( generics = "Hl: crate::HlGroup", argtype = "Hl", @@ -38,8 +38,8 @@ pub struct SetExtmarkOpts { hl_group: types::HlGroupId, /// Name of the highlight group used to highlight this mark. - #[cfg(feature = "neovim-nightly")] // Only on Nightly. - #[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] + #[cfg(feature = "neovim-0-11")] // Only on Nightly. + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] #[builder( generics = "Hl: crate::SetExtmarkHlGroup", argtype = "Hl", @@ -135,8 +135,8 @@ pub struct SetExtmarkOpts { 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")] + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. #[builder(argtype = "VirtLinesOverflow", inline = "{0}.into()")] virt_lines_overflow: types::String, @@ -196,8 +196,8 @@ pub struct SetExtmarkOpts { /// 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")] + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. #[builder(argtype = "()", inline = "{let _ = {0}; types::String::new()}")] conceal_lines: types::String, diff --git a/crates/api/src/opts/set_highlight.rs b/crates/api/src/opts/set_highlight.rs index bff9928..8735c2b 100644 --- a/crates/api/src/opts/set_highlight.rs +++ b/crates/api/src/opts/set_highlight.rs @@ -76,7 +76,7 @@ pub struct SetHighlightOpts { #[builder(skip)] sp: Object, - #[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. + #[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. #[builder( generics = "Hl: crate::HlGroup", argtype = "Hl", @@ -84,7 +84,7 @@ pub struct SetHighlightOpts { )] link: Object, - #[cfg(feature = "neovim-nightly")] // Only on Nightly. + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. #[builder( generics = "Hl: crate::HlGroup", argtype = "Hl", @@ -92,11 +92,11 @@ pub struct SetHighlightOpts { )] link: types::HlGroupId, - #[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. + #[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. #[builder(skip)] global_link: Object, - #[cfg(feature = "neovim-nightly")] // Only on Nightly. + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. #[builder(skip)] global_link: types::HlGroupId, diff --git a/crates/api/src/trait_utils.rs b/crates/api/src/trait_utils.rs index 07502e9..00d9736 100644 --- a/crates/api/src/trait_utils.rs +++ b/crates/api/src/trait_utils.rs @@ -169,13 +169,13 @@ impl HlGroup for &str { /// A trait implemented by types that can be passed to /// [`SetExtmarkOptsBuilder::hl_group`](crate::opts::SetExtmarkOptsBuilder::hl_group). -#[cfg(feature = "neovim-nightly")] // Only on Nightly. -#[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] +#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. +#[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] pub trait SetExtmarkHlGroup { fn into_object(self) -> Object; } -#[cfg(feature = "neovim-nightly")] // Only on Nightly. +#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. impl SetExtmarkHlGroup for Integer { #[inline] fn into_object(self) -> Object { @@ -183,7 +183,7 @@ impl SetExtmarkHlGroup for Integer { } } -#[cfg(feature = "neovim-nightly")] // Only on Nightly. +#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. impl SetExtmarkHlGroup for &str { #[inline] fn into_object(self) -> Object { @@ -191,7 +191,7 @@ impl SetExtmarkHlGroup for &str { } } -#[cfg(feature = "neovim-nightly")] // Only on Nightly. +#[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. impl SetExtmarkHlGroup for Vec { #[inline] fn into_object(self) -> Object { diff --git a/crates/api/src/types/cmd_infos.rs b/crates/api/src/types/cmd_infos.rs index d9f0494..ceb3944 100644 --- a/crates/api/src/types/cmd_infos.rs +++ b/crates/api/src/types/cmd_infos.rs @@ -179,19 +179,19 @@ pub(crate) struct ParseCmdOutput { nargs: Object, // Only on 0.10. - #[cfg(not(feature = "neovim-nightly"))] + #[cfg(not(feature = "neovim-0-11"))] addr: Object, - // Only on Nightly. - #[cfg(feature = "neovim-nightly")] + // On 0.11 and Nightly. + #[cfg(feature = "neovim-0-11")] addr: NvimString, // Only on 0.10. - #[cfg(not(feature = "neovim-nightly"))] + #[cfg(not(feature = "neovim-0-11"))] nextcmd: Object, // Only on 0.10. - #[cfg(feature = "neovim-nightly")] + #[cfg(feature = "neovim-0-11")] nextcmd: NvimString, } @@ -279,9 +279,9 @@ impl TryFrom for CmdInfos { } Ok(Self { - #[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. + #[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. addr: utils::none_literal_is_none(Deserializer::new(addr))?, - #[cfg(feature = "neovim-nightly")] // Only on Nightly. + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. addr: utils::none_literal_is_none(Deserializer::new(addr.into()))?, args: deserialize(args)?, bang: deserialize(bang)?, @@ -290,11 +290,11 @@ impl TryFrom for CmdInfos { magic: deserialize(magic)?, mods: deserialize(mods)?, nargs: deserialize(nargs)?, - #[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. + #[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. nextcmd: utils::empty_string_is_none(Deserializer::new( nextcmd, ))?, - #[cfg(feature = "neovim-nightly")] // Only on Nightly. + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. nextcmd: utils::empty_string_is_none(Deserializer::new( nextcmd.into(), ))?, diff --git a/crates/api/src/types/extmark_infos.rs b/crates/api/src/types/extmark_infos.rs index a4b4766..51f8aca 100644 --- a/crates/api/src/types/extmark_infos.rs +++ b/crates/api/src/types/extmark_infos.rs @@ -23,13 +23,13 @@ pub struct ExtmarkInfos { #[serde(default)] pub hl_eol: Option, - #[cfg(not(feature = "neovim-nightly"))] // Only on 0.10. - #[cfg_attr(docsrs, doc(cfg(not(feature = "neovim-nightly"))))] + #[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. + #[cfg_attr(docsrs, doc(cfg(not(feature = "neovim-0-11"))))] #[serde(default)] pub hl_group: Option, - #[cfg(feature = "neovim-nightly")] // Only on Nightly. - #[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] #[serde(default)] pub hl_group: Option>, diff --git a/crates/api/src/types/window_config.rs b/crates/api/src/types/window_config.rs index 42befde..4c29dcd 100644 --- a/crates/api/src/types/window_config.rs +++ b/crates/api/src/types/window_config.rs @@ -53,8 +53,8 @@ pub struct WindowConfig { pub hide: Option, - #[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] - #[cfg(feature = "neovim-nightly")] // Only on Nightly. + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. #[serde(default)] pub mouse: bool, @@ -294,8 +294,8 @@ pub struct WindowOpts { bufpos: Array, external: Boolean, focusable: Boolean, - #[cfg_attr(docsrs, doc(cfg(feature = "neovim-nightly")))] - #[cfg(feature = "neovim-nightly")] + #[cfg_attr(docsrs, doc(cfg(feature = "neovim-0-11")))] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. mouse: Boolean, vertical: Boolean, zindex: Integer, @@ -361,7 +361,7 @@ impl From<&WindowConfig> for WindowOpts { builder.focusable(focusable); } - #[cfg(feature = "neovim-nightly")] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. builder.mouse(config.mouse); if let Some(vertical) = config.vertical { @@ -429,7 +429,7 @@ impl TryFrom for WindowConfig { footer_pos, height, hide, - #[cfg(feature = "neovim-nightly")] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. mouse, noautocmd, relative, @@ -503,7 +503,7 @@ impl TryFrom for WindowConfig { ))?, height: deserialize(height)?, hide: deserialize(hide)?, - #[cfg(feature = "neovim-nightly")] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. mouse, noautocmd: deserialize(noautocmd)?, relative, diff --git a/crates/api/src/vim.rs b/crates/api/src/vim.rs index 1d37fa2..1b720f8 100644 --- a/crates/api/src/vim.rs +++ b/crates/api/src/vim.rs @@ -483,7 +483,7 @@ where { unsafe { nvim_input( - #[cfg(feature = "neovim-nightly")] + #[cfg(feature = "neovim-0-11")] // On 0.11 and Nightly. LUA_INTERNAL_CALL, keys.into().as_nvim_str(), ) diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 9f9d875..8f62bc8 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -10,7 +10,8 @@ crate-type = ["cdylib"] [features] default = ["neovim-0-10"] neovim-0-10 = ["nvim-oxi/neovim-0-10"] -neovim-nightly = ["neovim-0-10", "nvim-oxi/neovim-nightly"] +neovim-0-11 = ["neovim-0-10", "nvim-oxi/neovim-0-11"] +neovim-nightly = ["neovim-0-11", "nvim-oxi/neovim-nightly"] [dependencies] all_asserts = "2.3" diff --git a/tests/src/api/global.rs b/tests/src/api/global.rs index 12f4b0f..a0444c5 100644 --- a/tests/src/api/global.rs +++ b/tests/src/api/global.rs @@ -285,7 +285,7 @@ fn set_get_del_var() { } // `api::{get,set}_option()` were deprecated on 0.11, so only test on 0.10. -#[cfg(not(feature = "neovim-nightly"))] +#[cfg(not(feature = "neovim-0-11"))] // Only on 0.10. #[nvim_oxi::test] fn set_get_option() { api::set_option("modified", true).unwrap();