Skip to content

Conversation

Trishthedish
Copy link

@Trishthedish Trishthedish commented Jul 13, 2025

Description

This PR addresses deprecation warnings caused by the old, table-based vim.validate syntax in two functions within telescope.actions.utils. The validation calls are updated to use the new argument-based syntax recommended by Neovim.

While using Telescope (master branch at commit b4da76b), I began seeing repeated deprecation warnings related to calls like vim.validate({}).

At the time I began working on this, there wasn’t an open issue for it, so I decided to start addressing the problem incrementally — beginning with the two usages in telescope.actions.utils.

Since then, issue #3499 has been opened describing the same deprecation warnings. I’ve linked this PR to that issue for tracking purposes.

Example warning:

WARNING vim.validate is deprecated. Feature will be removed in Nvim 1.0
  ADVICE:
      - use vim.validate(name, value, validator, optional_or_msg) instead.

Motivation and Context

One of my 2025 goals is to contribute meaningfully to an open-source Neovim plugin I use regularly. I’ve been looking for small, self-contained improvements that would let me practice writing and testing Lua code in the Neovim ecosystem — ideally in a way that supports test-driven development approach.

This change gave me an opportunity to explore Neovim plugin internals while also getting some hands-on experience writing tests before modifying behavior, which helped build confidence in the refactor.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Added unit tests for map_entries and map_selections
Located in tests/automated/actions/utils_spec.lua
Covers:

  • Input validation (e.g. nil, wrong types)
  • Edge cases (empty or malformed inputs)
  • Row/index mapping per Telescope conventions
  • Integration scenarios with realistic selections
  • Performance (1000+ entries, 500+ selections)
  • TDD-style validation tests for both functions that only pass with the new vim.validate syntax

Reproduction Instructions:

Clone branch: git checkout feat/improve-actions-utils-validation
To run only newly added tests use:

make test-utils

(Temporary Makefile helper I added for local dev; happy to remove before merge)

Configuration:

  • Neovim version: NVIM v0.11.0 Build type: Release LuaJIT 2.1.1744318430
  • Operating system and version: macOS Sequoia 15.5 (Apple Silicon - M2)

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation (lua annotations)

N/A – no new public API or parameter changes

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.

1 participant