Add walkup for now
This commit is contained in:
+14
-2
@@ -50,6 +50,18 @@ local function fuzzy_filter(list, query)
|
||||
return result
|
||||
end
|
||||
|
||||
local loaded_languages = {}
|
||||
function M.load_language_module(lang, opts)
|
||||
if loaded_languages[lang] then return true end
|
||||
|
||||
local ok, mod = pcall(require, "Polydev.languages." .. lang)
|
||||
if not ok or type(mod.setup) ~= "function" then return false end
|
||||
|
||||
mod.setup(opts and opts[lang] or {})
|
||||
loaded_languages[lang] = mod
|
||||
return true
|
||||
end
|
||||
|
||||
function M.open_project_manager()
|
||||
local templates = require("Polydev.templates")
|
||||
local Popup = require("nui.popup")
|
||||
@@ -277,7 +289,7 @@ function M.open_project_manager()
|
||||
vim.ui.input({ prompt = "Enter language for new file: " }, function(lang)
|
||||
if not lang or lang == "" then return print("File creation canceled.") end
|
||||
|
||||
if load_language_module(lang) and templates.files[lang] and templates.files[lang].run then
|
||||
if M.load_language_module(lang) and templates.files[lang] and templates.files[lang].run then
|
||||
vim.ui.input({ prompt = "Enter file name: " }, function(file_name)
|
||||
if not file_name or file_name == "" then return print("File creation canceled.") end
|
||||
popup:unmount()
|
||||
@@ -297,7 +309,7 @@ function M.open_project_manager()
|
||||
vim.ui.input({ prompt = "Enter language for project: " }, function(lang)
|
||||
if not lang or lang == "" then return print("Project creation canceled.") end
|
||||
opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get(lang), opts or {})
|
||||
if load_language_module(lang) and templates.projects[lang] and templates.projects[lang].run then
|
||||
if M.load_language_module(lang) and templates.projects[lang] and templates.projects[lang].run then
|
||||
popup:unmount()
|
||||
vim.schedule(function()
|
||||
templates.create_project(lang, opts.project_root)
|
||||
|
||||
Reference in New Issue
Block a user