refactor(gotests): move requires inside of functions
This commit is contained in:
parent
68ccd20e94
commit
125cac7058
1 changed files with 5 additions and 3 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
local Job = require "plenary.job"
|
|
||||||
local ts_utils = require "gopher._utils.ts"
|
|
||||||
local c = require("gopher.config").config.commands
|
|
||||||
local u = require "gopher._utils"
|
local u = require "gopher._utils"
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@param cmd_args table
|
---@param cmd_args table
|
||||||
local function run(cmd_args)
|
local function run(cmd_args)
|
||||||
|
local Job = require "plenary.job"
|
||||||
|
local c = require("gopher.config").config.commands
|
||||||
|
|
||||||
Job:new({
|
Job:new({
|
||||||
command = c.gotests,
|
command = c.gotests,
|
||||||
args = cmd_args,
|
args = cmd_args,
|
||||||
|
|
@ -31,6 +31,8 @@ end
|
||||||
---generate unit test for one function
|
---generate unit test for one function
|
||||||
---@param parallel boolean
|
---@param parallel boolean
|
||||||
function M.func_test(parallel)
|
function M.func_test(parallel)
|
||||||
|
local ts_utils = require "gopher._utils.ts"
|
||||||
|
|
||||||
local ns = ts_utils.get_func_method_node_at_pos(unpack(vim.api.nvim_win_get_cursor(0)))
|
local ns = ts_utils.get_func_method_node_at_pos(unpack(vim.api.nvim_win_get_cursor(0)))
|
||||||
if ns == nil or ns.name == nil then
|
if ns == nil or ns.name == nil then
|
||||||
u.notify("cursor on func/method and execute the command again", "info")
|
u.notify("cursor on func/method and execute the command again", "info")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue