Skip to content

Conversation

@joe-p
Copy link

@joe-p joe-p commented May 10, 2025

Adds a new run.get_command function that returns the command (string[]) that would be ran for the given args.

For example, I have added a keybind to yank the command for the nearest test:

    {
      '<leader>ty',
      function()
        local cmd = require('neotest').run.get_command()

        if cmd then
          vim.fn.setreg('*', table.concat(cmd, ' '))
          -- get_command may block for a bit, so send a notification when it is done
          vim.notify('Copied ' .. cmd[1] .. ' command!')
        end
      end,
      desc = 'Yank',
    },

Closes #272

@joe-p joe-p force-pushed the feat/get_command branch from e675d97 to b3e5677 Compare May 10, 2025 12:42
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.

[FEAT] Inspect the test commands run by Neotest

1 participant