Skip to content

Commit 24e647e

Browse files
authored
feat(config): new config to disable specific languages' snippet (#2)
1 parent 66456da commit 24e647e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lua/luasnip-snippets/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
---@field user? LSSnippets.Config.User
3030
---@field snippet? LSSnippets.Config.Snippet
3131
---@field disable_auto_expansion? table<LSSnippets.SupportLangs, LSSnippets.Config.Snippet.DisableSnippets>
32+
---@field disable_langs? LSSnippets.SupportLangs[]
3233
local config = {}
3334

3435
---@param opts? LSSnippets.Config

lua/luasnip-snippets/init.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@ function M.setup(opts)
4343
Config.setup(opts)
4444

4545
-- register snippets
46-
load_and_add_snippet {
46+
load_and_add_snippet(vim.tbl_filter(function(l)
47+
return not vim.tbl_contains(Config.get("disable_langs") or {}, l)
48+
end, {
4749
"cpp",
4850
"rust",
4951
"lua",
5052
"dart",
5153
"nix",
5254
"all",
5355
"typescript",
54-
}
56+
}))
5557
end
5658

5759
return M

0 commit comments

Comments
 (0)