You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created two versions of console.log snippets, since they are compatible across multiple languages I tried combining them into a single file. However doesn't seem to get loaded.
Snippet only seems to work when the snippet is included on a file named after the language e.g. "custom/snippets/javascript.lua"
I couldn't find on the docs a reference to the filenames with the filetypes so perhaps it is a bug ?
Snippet only seems to work when the snippet is included on a file named after the language e.g. "custom/snippets/javascript.lua"
Jup, that is as it should be, the lua-loader associates the snippets loaded from some file only with the filetype given by the filename.
One way to use some collection of snippets in the same filetypes is ls.filetype_extend, you could for example do ls.filetype_extend("javascript", {"jslikes"}) and ls.filetype_extend("typescript", {"jslikes"}) and then write the snippets into a file custom/snippets/jslikes.lua
Another idea would be the multisnippet, where you could use the filetype-key to add one snippet to all these filetypes: ms({{filetype="javascript"}, {filetype="typescript"}, common={trig="lv"}}, {ls.text_node ...}) and return this snippet in custom/snippets/all.lua so that it is loaded for all possible filetypes you may use (this comes with the tiny disadvantage/uncleanness that the snippet is processed even if you don't edit a type/javascript file)
Hope that helped, feel free to ask more about either option, it's possible I made some mistake in the code I gave, I didn't test it :)
I created two versions of console.log snippets, since they are compatible across multiple languages I tried combining them into a single file. However doesn't seem to get loaded.
Snippet only seems to work when the snippet is included on a file named after the language e.g. "custom/snippets/javascript.lua"
I couldn't find on the docs a reference to the filenames with the filetypes so perhaps it is a bug ?
Loading:
https://github.com/ccolorado/kickstart.nvim/blob/536cb9c312b18013c439d8f435b9e0b5fdfcc4c4/init.lua#L724
Snippets directory:
https://github.com/ccolorado/kickstart.nvim/tree/multilang_snippets/lua/custom/snippets
The text was updated successfully, but these errors were encountered: