Skip to content

Commit

Permalink
fix(module): snippets_overwrite does nothing
Browse files Browse the repository at this point in the history
closes: #19
  • Loading branch information
pysan3 committed Nov 23, 2023
1 parent 493d4de commit ef9fc2c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lua/neorg/modules/external/templates/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,17 @@ module.load = function()
end

-- Add user defined snippets and append keywords
default_snippets = vim.tbl_deep_extend("force", default_snippets, module.config.public.snippets_overwrite)
snippet_handler.add_keywords(default_snippets.default_keywords)
for key, value in pairs(module.config.public.snippets_overwrite) do
local default_value = default_snippets[key]
if type(value) == "table" and type(default_value) == "table" then
default_snippets[key] = vim.tbl_deep_extend("force", default_value, value)
else
default_snippets[key] = value
end
end
snippet_handler.add_keywords(default_snippets.default_keywords or {})
snippet_handler.add_keywords(module.config.public.keywords or {})
snippet_handler.magic_keywords = default_snippets.magic_keywords
snippet_handler.magic_keywords = default_snippets.magic_keywords or {}
end

module.on_event = function(event)
Expand Down

0 comments on commit ef9fc2c

Please sign in to comment.