Skip to content

fix: adjust to vim.validate deprecation in Nvim 0.12#3555

Merged
clason merged 2 commits intomasterfrom
fix/validate
Nov 4, 2025
Merged

fix: adjust to vim.validate deprecation in Nvim 0.12#3555
clason merged 2 commits intomasterfrom
fix/validate

Conversation

@clason
Copy link
Contributor

@clason clason commented Nov 3, 2025

requires #3552

Closes #3499

@clason clason changed the title fix/validate fix: adjust to vim.validate deprecation in Nvim 0.12 Nov 3, 2025
@clason clason force-pushed the fix/validate branch 2 times, most recently from 27b7160 to f697728 Compare November 3, 2025 19:25
@clason
Copy link
Contributor Author

clason commented Nov 3, 2025

Note to self: dispatch outside of function definition, not inside.

@DrKJeff16
Copy link
Contributor

Shouldn't the title be for Nvim 0.11? since we're doing checks against that version.

@clason
Copy link
Contributor Author

clason commented Nov 3, 2025

No, because the deprecation message got added in 0.12.

@DrKJeff16
Copy link
Contributor

Weird stuff, but I get it.

---@return integer
utils.str_byteindex = function(s, i, encoding)
if vim.fn.has "nvim-0.11" == 1 then
return vim.str_byteindex(s, encoding, i, false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

nil is falsy in Lua, so we can use the same signature for both branches.

@clason
Copy link
Contributor Author

clason commented Nov 4, 2025

Follow-up (not critical but forward-looking):

  • replace nvim_buf_get_option() with nvim_get_option_value() (deprecated in Nvim 0.10; could use vim.bo but that is less stable API)
  • replace nvim_buf_add_highlight() with vim.hl.range() or nvim_buf_set_extmark() (deprecated in Nvim 0.11)
  •  replace err_writeln with utils.notify/error (deprecated in Nvim 0.11)
  • pet peeve: make consistent use of vim.api or vim.lsp locals

@clason clason force-pushed the fix/validate branch 2 times, most recently from 418ac07 to 6d39931 Compare November 4, 2025 18:40
@clason clason merged commit 47a8530 into master Nov 4, 2025
12 checks passed
@clason clason deleted the fix/validate branch November 4, 2025 18:46
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.

vim.validate is deprecated. Feature will be removed in Nvim 1.0

2 participants