aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorundyamon <148129121+undyamon@users.noreply.github.com>2023-12-30 15:58:34 +0100
committerGitHub <noreply@github.com>2023-12-30 16:58:34 +0200
commit2730051a3ff2eaf34e392f2304bab217d884fc30 (patch)
tree0f9e46da10b2583794bb02aebafd3df82a56482b
parentf2cbe8f4f5fbfc73ae8eb08521cd0080f536e626 (diff)
downloadneovim-tasks-2730051a3ff2eaf34e392f2304bab217d884fc30.tar.gz
neovim-tasks-2730051a3ff2eaf34e392f2304bab217d884fc30.zip
Fix module search to include runtime (#20)
-rw-r--r--lua/tasks/utils.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/lua/tasks/utils.lua b/lua/tasks/utils.lua
index fab3be7..be60cf6 100644
--- a/lua/tasks/utils.lua
+++ b/lua/tasks/utils.lua
@@ -1,5 +1,3 @@
1local scandir = require('plenary.scandir')
2local Path = require('plenary.path')
3local utils = {} 1local utils = {}
4 2
5local args_regex = vim.regex([[\s\%(\%([^'"]*\(['"]\)[^'"]*\1\)*[^'"]*$\)\@=]]) 3local args_regex = vim.regex([[\s\%(\%([^'"]*\(['"]\)[^'"]*\1\)*[^'"]*$\)\@=]])
@@ -60,14 +58,11 @@ end
60 58
61---@return table 59---@return table
62function utils.get_module_names() 60function utils.get_module_names()
63 local module_dir = Path:new(debug.getinfo(1).source:sub(2)):parent() / 'module'
64
65 local modules = {} 61 local modules = {}
66 for _, entry in ipairs(scandir.scan_dir(module_dir.filename, { depth = 1 })) do 62
67 -- Strip full path and extension 63 local runtime_files = vim.api.nvim_get_runtime_file('lua/tasks/module/*.lua', true)
68 local extension_len = 4 64 for _, file in ipairs(runtime_files) do
69 local parent_offset = 2 65 table.insert(modules, vim.fn.fnamemodify(file, ':t:r'))
70 table.insert(modules, entry:sub(#Path:new(entry):parent().filename + parent_offset, #entry - extension_len))
71 end 66 end
72 67
73 return modules 68 return modules