From ac7caed0c5cf7bdc82170c032097e8eae9dd4199 Mon Sep 17 00:00:00 2001 From: danymat Date: Tue, 1 Feb 2022 18:55:18 +0100 Subject: [PATCH] feat: Add API to get template --- lua/neogen/init.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lua/neogen/init.lua b/lua/neogen/init.lua index 93649c6..be315c6 100644 --- a/lua/neogen/init.lua +++ b/lua/neogen/init.lua @@ -107,7 +107,7 @@ end --- --- Neogen provides those defaults, and you can change them to suit your needs ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section) ----@test # Notes~ +---@text # Notes~ --- --- - to configure a language, just add your configurations in the `languages` table --- For example, for the `lua` lang: @@ -278,6 +278,21 @@ end -- Expose match_commands for `:Neogen` completion neogen.match_commands = helpers.match_commands +--- Get a template for a particular filetype +---@param filetype string +---@return neogen.TemplateConfig|nil +neogen.get_template = function(filetype) + if not neogen.configuration.languages[filetype] then + return + end + + if not neogen.configuration.languages[filetype].template then + return + end + + return neogen.configuration.languages[filetype].template +end + -- Required for use with completion engine ===================================== --- Jumps to the next cursor template position