Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alex-courtis opened this issue May 28, 2024 · 3 comments · Fixed by #2788

Comments

@alex-courtis
Copy link
Member

alex-courtis commented May 28, 2024

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
@gegoune
Copy link
Collaborator

gegoune commented May 28, 2024

We shouldn't be concerned about development versions prior to 0.10. We should support:

  • latest release (0.10)
  • previous release (0.9)
  • current nightly versions (relatively new, 0.11-dev, without many (any?) guarantees)

@alex-courtis
Copy link
Member Author

alex-courtis commented Jun 1, 2024

That works for me. We can continue to use the simple vim.fn test and keep the code clean.

The only issue is users on 0.10 dev versions (debian!), which do break. Could we just show a startup warning like "...proceed at your own risk..." ?

@alex-courtis alex-courtis reopened this Jun 1, 2024
@alex-courtis alex-courtis changed the title test api-level instead of vim.fn.has fully support 0.9, 0.10 only Jun 1, 2024
@alex-courtis alex-courtis changed the title fully support 0.9, 0.10 only minimum neovim version 0.9, harden support for greater versions Jun 1, 2024
@alex-courtis alex-courtis changed the title minimum neovim version 0.9, harden support for greater versions enable deprecated warnings, minimum neovim version 0.9, harden support for greater versions Jun 1, 2024
alex-courtis added a commit that referenced this issue Jun 1, 2024
@alex-courtis
Copy link
Member Author

We shouldn't be concerned about development versions prior to 0.10. We should support:

  • latest release (0.10)
  • previous release (0.9)
  • current nightly versions (relatively new, 0.11-dev, without many (any?) guarantees)

I couldn't find a reliable way to detect dev versions; 0.9 is now the minimum and it's up to the user to deal with issues with dev versions.

I did put off that diagnostic breakage until 0.11 as more users will likely raise issues. https://github.com/nvim-tree/nvim-tree.lua/pull/2788/files#diff-b4d683774fedaa8bdc2f7107576331513b01888c09ab2fcfd44468ef976c1b08

alex-courtis added a commit that referenced this issue Jun 6, 2024
alex-courtis added a commit that referenced this issue Jun 9, 2024
…le deprecated warnings (#2788)

* refactor(#2787): replace deprecated

* refactor(#2787): enable deprecated checks

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): use inline deprecation disabling

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): replace deprecated

* refactor(#2787): deprecated are now warnings

* refactor(#2787): 0.9 is the minimum supported version

* Revert "refactor(#2787): replace deprecated"

This reverts commit b6b4c32.

* refactor(#2787): suppress deprecated until 0.11

* refactor(#2787): minimum nvim version 0.8 -> 0.9

* refactor(#2787): reset globals

* refactor(#2787): explicitly check for vim.diagnostic.is_enabled function presence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants