Skip to content

Conversation

@carlosala
Copy link

vim.validate in its spec form is deprecated.
This fixes it.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for finding and fixing this. We would need to provide a backwards compatible shim for the minimum supported nvim version 0.9.

However, I reckon we should just remove this validate completely:

  • This one and only one use was from a time when we were heavily experimenting with legacy options and we didn't have LSP / type checking / CI.
  • We have proper luadoc type annotations now

@carlosala
Copy link
Author

Sounds good. Yeah, I didn't know it wasn't available on older versions 👍🏻

@surbliss
Copy link

What about adding an nvim-version check? I.e. something like this

  local safe_validate = function(arr)
    if vim.fn.has("nvim-0.9") == 1 then
      for key, args in pairs(arr) do
        vim.validate(key, unpack(args))
      end
    else
      vim.validate(arr)
    end
  end
  local ok, err = pcall(safe_validate, {
    src = { src, "table" },
    -- rest

@alex-courtis
Copy link
Member

What about adding an nvim-version check? I.e. something like this

  local safe_validate = function(arr)
    if vim.fn.has("nvim-0.9") == 1 then
      for key, args in pairs(arr) do
        vim.validate(key, unpack(args))
      end
    else
      vim.validate(arr)
    end
  end
  local ok, err = pcall(safe_validate, {
    src = { src, "table" },
    -- rest

Sorry, I mean just delete this whole check block that's not needed:

https://github.com/nvim-tree/nvim-tree.lua/pull/3096/files#diff-7c68f0fc800988f242ac61f7db0c2167124815cb6b65f1d01a99df9a4bb609f1R352-R368

@carlosala
Copy link
Author

Hey! Closing then, since it can be removed. Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants