Skip to content

enable deprecated warnings, minimum neovim version 0.9, harden support for greater versions #2787

Closed
@alex-courtis

Description

@alex-courtis

API changed many times during the 0.10 dev cycle. Many users are using various versions of 0.10 pre-release. We must ensure that the correct functions are being used. Resolves issues such as #2781 (comment)

We can use a lazily loaded cache of supported API. Requires minimum nvim version of 0.9

Testing :h api-level

local log = require "amc.log"

local api_info = vim.fn.api_info()

log.line("version %s", vim.inspect(api_info.version))
log.line("ui_options %s", vim.inspect(api_info.ui_options))

for _, v in ipairs(api_info.functions) do
  if v.deprecated_since and v.deprecated_since ~= 1 then
    log.line("%s %s %s", v.name, vim.inspect(v.since), vim.inspect(v.deprecated_since))
  end
end

0.9.5

version {
  api_compatible = 0,
  api_level = 11,
  api_prerelease = false,
  major = 0,
  minor = 9,
  patch = 5,
  prerelease = false
}

nvim_exec 7 11
nvim_command_output 1 7
nvim_execute_lua 3 7
nvim_buf_get_number 1 2
nvim_buf_clear_highlight 1 7
nvim_buf_set_virtual_text 5 8
nvim_get_hl_by_id 3 9
nvim_get_hl_by_name 3 9

0.10.0

version {
  api_compatible = 0,
  api_level = 12,
  api_prerelease = vim.NIL,
  build = vim.NIL,
  major = 0,
  minor = 10,
  patch = 0,
  prerelease = true
}
nvim_exec 7 11
nvim_command_output 1 7
nvim_execute_lua 3 7
nvim_buf_get_number 1 2
nvim_buf_clear_highlight 1 7
nvim_buf_set_virtual_text 5 8
nvim_get_hl_by_id 3 9
nvim_get_hl_by_name 3 9
nvim_get_option_info 7 11
nvim_set_option 1 11
nvim_get_option 1 11
nvim_buf_get_option 1 11
nvim_buf_set_option 1 11
nvim_win_get_option 1 11
nvim_win_set_option 1 11
nvim_call_atomic 1 12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions