From 125cac705822a4fd040f334d19fdbf7ff0b90611 Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Sun, 13 Nov 2022 14:13:00 +0200 Subject: [PATCH] refactor(gotests): move requires inside of functions --- lua/gopher/gotests.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/gopher/gotests.lua b/lua/gopher/gotests.lua index 2e43017..724971c 100644 --- a/lua/gopher/gotests.lua +++ b/lua/gopher/gotests.lua @@ -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 M = {} ---@param cmd_args table local function run(cmd_args) + local Job = require "plenary.job" + local c = require("gopher.config").config.commands + Job:new({ command = c.gotests, args = cmd_args, @@ -31,6 +31,8 @@ end ---generate unit test for one function ---@param parallel boolean 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))) if ns == nil or ns.name == nil then u.notify("cursor on func/method and execute the command again", "info")