Open soluty opened 5 months ago
I have found a ft_func option can fix this.
ft_func = require("luasnip.extras.filetype_functions").from_pos_or_filetype
now there is other question, is there some project based snippets can overwrite default snippets, such as in default js file, i can use pl
to expand console.log
, but in some project, i use log lib and want use pl
to expand log.info()
, and i dont want to have 2 pl selection candidate and just want use one. how to do this?
Hey :)
One way of doing this would be defining all logging-related snippets as separate filetypes "js-logging" and "loglib-logging", and for projects without loglib call ls.filetype_extend("javascript", "js-logging")
, and for those with loglib call ls.filetype_extend("javascript", "loglib-logging")
.
You'd only need a good setup for running project-specific lua, for example enable exrc
and add the filetype_extend
to a .nvimrc
in your project-directory (but do look into exrc if you're not familiar with it, I think there may be security-risks :sweat_smile:)
Thank you for awesome plugin !
There are many file type such as markdown or vue etc. They has some Piece of Snippets to trigger, for example , in markdowns
code
block with any language such as go or js, can luasnip trigger only my snippets defined in go.snippets or lua.snippets in that code block? In vscode , it can do this, but i cant find out how to do this with luasnip, is there any way?